mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
lint
This commit is contained in:
parent
b064e512e2
commit
95827a2d70
@ -6,7 +6,6 @@ import { configService, Log, Webhook } from '@config/env.config';
|
|||||||
import { Logger } from '@config/logger.config';
|
import { Logger } from '@config/logger.config';
|
||||||
import { BadRequestException } from '@exceptions';
|
import { BadRequestException } from '@exceptions';
|
||||||
import axios, { AxiosInstance } from 'axios';
|
import axios, { AxiosInstance } from 'axios';
|
||||||
import { isURL } from 'class-validator';
|
|
||||||
import * as jwt from 'jsonwebtoken';
|
import * as jwt from 'jsonwebtoken';
|
||||||
|
|
||||||
import { EmitData, EventController, EventControllerInterface } from '../event.controller';
|
import { EmitData, EventController, EventControllerInterface } from '../event.controller';
|
||||||
@ -75,8 +74,8 @@ export class WebhookController extends EventController implements EventControlle
|
|||||||
|
|
||||||
const webhookConfig = configService.get<Webhook>('WEBHOOK');
|
const webhookConfig = configService.get<Webhook>('WEBHOOK');
|
||||||
const webhookLocal = instance?.events;
|
const webhookLocal = instance?.events;
|
||||||
const webhookHeaders = { ...(instance?.headers as Record<string, string> || {}) };
|
const webhookHeaders = { ...((instance?.headers as Record<string, string>) || {}) };
|
||||||
|
|
||||||
if (webhookHeaders && 'jwt_key' in webhookHeaders) {
|
if (webhookHeaders && 'jwt_key' in webhookHeaders) {
|
||||||
const jwtKey = webhookHeaders['jwt_key'];
|
const jwtKey = webhookHeaders['jwt_key'];
|
||||||
const jwtToken = this.generateJwtToken(jwtKey);
|
const jwtToken = this.generateJwtToken(jwtKey);
|
||||||
@ -84,7 +83,7 @@ export class WebhookController extends EventController implements EventControlle
|
|||||||
|
|
||||||
delete webhookHeaders['jwt_key'];
|
delete webhookHeaders['jwt_key'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const we = event.replace(/[.-]/gm, '_').toUpperCase();
|
const we = event.replace(/[.-]/gm, '_').toUpperCase();
|
||||||
const transformedWe = we.replace(/_/gm, '-').toLowerCase();
|
const transformedWe = we.replace(/_/gm, '-').toLowerCase();
|
||||||
const enabledLog = configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS');
|
const enabledLog = configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS');
|
||||||
@ -250,7 +249,7 @@ export class WebhookController extends EventController implements EventControlle
|
|||||||
app: 'evolution',
|
app: 'evolution',
|
||||||
action: 'webhook',
|
action: 'webhook',
|
||||||
};
|
};
|
||||||
|
|
||||||
const token = jwt.sign(payload, authToken, { algorithm: 'HS256' });
|
const token = jwt.sign(payload, authToken, { algorithm: 'HS256' });
|
||||||
return token;
|
return token;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user