lint changes

This commit is contained in:
pedro-php 2025-05-14 16:13:57 -03:00
parent 855c24f38d
commit d656727b7a
6 changed files with 47 additions and 42 deletions

View File

@ -1,6 +1,4 @@
import { WAMonitoringService } from '@api/services/monitor.service'; import { WAMonitoringService } from '@api/services/monitor.service';
import { UnauthorizedException } from '../../exceptions';
import { PrismaRepository } from '../repository/repository.service'; import { PrismaRepository } from '../repository/repository.service';
export class HealthController { export class HealthController {

View File

@ -1364,24 +1364,33 @@ export class BaileysStartupService extends ChannelStartupService {
} }
} }
} }
if (1/* this.localWebhook.enabled */) { if (this.localWebhook.enabled) {
if (1/* isMedia && this.localWebhook.webhookBase64 */) { if (isMedia && this.localWebhook.webhookBase64) {
try { try {
let buffer : Buffer = null; let buffer: Buffer = null;
console.dir({received}, {depth: null}); console.dir({ received }, { depth: null });
if ((received.message.stickerMessage && received.message.stickerMessage.url === 'https://web.whatsapp.net') if (
|| (received.message.lottieStickerMessage && received.message.lottieStickerMessage.message.stickerMessage.url)) { /*Fixing broken URLs from sticker messages*/ (received.message.stickerMessage &&
const newUrl = `https://mmg.whatsapp.net${received.message.lottieStickerMessage ? received.message.lottieStickerMessage.message.stickerMessage.directPath : received.message.stickerMessage.directPath }`; received.message.stickerMessage.url === 'https://web.whatsapp.net') ||
(received.message.lottieStickerMessage &&
received.message.lottieStickerMessage.message.stickerMessage.url)
) {
/*Fixing broken URLs from sticker messages*/
const newUrl = `https://mmg.whatsapp.net${received.message.lottieStickerMessage ? received.message.lottieStickerMessage.message.stickerMessage.directPath : received.message.stickerMessage.directPath}`;
const stream = await downloadContentFromMessage( const stream = await downloadContentFromMessage(
{ {
mediaKey: received.message?.stickerMessage?.mediaKey || received.message.lottieStickerMessage?.message?.stickerMessage?.mediaKey, mediaKey:
directPath: received.message?.stickerMessage?.directPath || received.message.lottieStickerMessage?.message?.stickerMessage?.directPath, received.message?.stickerMessage?.mediaKey ||
url: newUrl received.message.lottieStickerMessage?.message?.stickerMessage?.mediaKey,
directPath:
received.message?.stickerMessage?.directPath ||
received.message.lottieStickerMessage?.message?.stickerMessage?.directPath,
url: newUrl,
}, },
'sticker', 'sticker',
{}, {},
) );
const chunks = []; const chunks = [];
for await (const chunk of stream) { for await (const chunk of stream) {
chunks.push(chunk); chunks.push(chunk);
@ -1406,7 +1415,7 @@ export class BaileysStartupService extends ChannelStartupService {
} }
} }
console.dir({webhookMessage: messageRaw}, {depth: null}) console.dir({ webhookMessage: messageRaw }, { depth: null });
this.logger.log(messageRaw); this.logger.log(messageRaw);
this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw); this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
@ -1778,7 +1787,7 @@ export class BaileysStartupService extends ChannelStartupService {
} }
if (events['messages.upsert']) { if (events['messages.upsert']) {
const payload = events['messages.upsert'] const payload = events['messages.upsert'];
this.messageHandle['messages.upsert'](payload, settings); this.messageHandle['messages.upsert'](payload, settings);
} }

View File

@ -1,17 +1,15 @@
import { RequestHandler, Router } from "express"; import { healthController } from '@api/server.module';
import { RouterBroker } from "../abstract/abstract.router";
import { HttpStatus } from "./index.router";
import { healthController } from "@api/server.module";
import { RouterBroker } from '../abstract/abstract.router';
import { HttpStatus } from './index.router';
export class HealthRouter extends RouterBroker { export class HealthRouter extends RouterBroker {
constructor() { constructor() {
super(); super();
this.router this.router.get(this.routerPath('healthz', false), async (req, res) => {
.get(this.routerPath('healthz', false), async (req, res) => {
await healthController.checkHealth(); await healthController.checkHealth();
return res.status(HttpStatus.OK).json({msg: 'healthy'}); return res.status(HttpStatus.OK).json({ msg: 'healthy' });
}) });
} }
public readonly router: Router = Router(); public readonly router: Router = Router();

View File

@ -15,6 +15,7 @@ import { BusinessRouter } from './business.router';
import { CallRouter } from './call.router'; import { CallRouter } from './call.router';
import { ChatRouter } from './chat.router'; import { ChatRouter } from './chat.router';
import { GroupRouter } from './group.router'; import { GroupRouter } from './group.router';
import { HealthRouter } from './health.router';
import { InstanceRouter } from './instance.router'; import { InstanceRouter } from './instance.router';
import { LabelRouter } from './label.router'; import { LabelRouter } from './label.router';
import { ProxyRouter } from './proxy.router'; import { ProxyRouter } from './proxy.router';
@ -22,7 +23,6 @@ import { MessageRouter } from './sendMessage.router';
import { SettingsRouter } from './settings.router'; import { SettingsRouter } from './settings.router';
import { TemplateRouter } from './template.router'; import { TemplateRouter } from './template.router';
import { ViewsRouter } from './view.router'; import { ViewsRouter } from './view.router';
import { HealthRouter} from './health.router';
enum HttpStatus { enum HttpStatus {
OK = 200, OK = 200,

View File

@ -7,6 +7,7 @@ import { BusinessController } from './controllers/business.controller';
import { CallController } from './controllers/call.controller'; import { CallController } from './controllers/call.controller';
import { ChatController } from './controllers/chat.controller'; import { ChatController } from './controllers/chat.controller';
import { GroupController } from './controllers/group.controller'; import { GroupController } from './controllers/group.controller';
import { HealthController } from './controllers/health.controller';
import { InstanceController } from './controllers/instance.controller'; import { InstanceController } from './controllers/instance.controller';
import { LabelController } from './controllers/label.controller'; import { LabelController } from './controllers/label.controller';
import { ProxyController } from './controllers/proxy.controller'; import { ProxyController } from './controllers/proxy.controller';
@ -40,7 +41,6 @@ import { WAMonitoringService } from './services/monitor.service';
import { ProxyService } from './services/proxy.service'; import { ProxyService } from './services/proxy.service';
import { SettingsService } from './services/settings.service'; import { SettingsService } from './services/settings.service';
import { TemplateService } from './services/template.service'; import { TemplateService } from './services/template.service';
import { HealthController } from './controllers/health.controller';
const logger = new Logger('WA MODULE'); const logger = new Logger('WA MODULE');

View File

@ -553,7 +553,7 @@ export class ChannelStartupService {
} }
// Limpa LottieStickerMessage // Limpa LottieStickerMessage
if(cleanedMessage.message.lottieStickerMessage) { if (cleanedMessage.message.lottieStickerMessage) {
cleanedMessage.message.lottieStickerMessage = {}; cleanedMessage.message.lottieStickerMessage = {};
} }