mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 15:06:41 +07:00
getting webhook pathname from url
This commit is contained in:
parent
87da9078fe
commit
f444a7d194
3 changed files with 6 additions and 6 deletions
|
@ -7,6 +7,7 @@ import logger from "../../service/logger";
|
|||
import { TelegramService } from "../../service/telegram";
|
||||
import http from "http";
|
||||
import { WebhookConfig } from "../../config/types";
|
||||
import url, { URL } from "url";
|
||||
|
||||
export class HttpApi {
|
||||
app: Express;
|
||||
|
@ -37,9 +38,10 @@ export class HttpApi {
|
|||
this.app.use(bodyParser.json());
|
||||
this.app.use(express.json());
|
||||
|
||||
if (this?.webhook?.enabled && this?.webhook?.path) {
|
||||
logger.info(`using webhook at ${this.webhook.path}`);
|
||||
this.app.post(props.webhook.url, this.handleWebhook);
|
||||
if (this?.webhook?.enabled && this?.webhook?.url) {
|
||||
const url = new URL(this.webhook.url);
|
||||
logger.info(`using webhook at ${url.pathname}`);
|
||||
this.app.post(url.pathname, this.handleWebhook);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue