Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6346433d45 | ||
|
|
44e63e00c3 | ||
|
|
8648b44583 | ||
|
|
086d540ee2 | ||
|
|
adf6836ee5 | ||
|
|
62f4406c51 | ||
|
|
e4c201e105 | ||
|
|
b6b0b1e7b3 | ||
|
|
9d857d015f | ||
|
|
2055c595bb | ||
|
|
00e33ceac7 | ||
|
|
77ef1ecebf |
No files matched your search
@@ -32,7 +32,7 @@ for-swagger:
|
||||
WHATSAPP_SWAGGER_CONFIG_ADVANCED=true . ${NVM_DIR}/nvm.sh && nvm exec yarn start
|
||||
|
||||
up-noweb:
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up @adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-channels-2
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up @adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-channels-678
|
||||
|
||||
up-webjs:
|
||||
. ${NVM_DIR}/nvm.sh && nvm exec yarn up whatsapp-web.js@github:devlikeapro/whatsapp-web.js#fork-main-channels
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ uv_threadpool_size=$(($cpus * 2))
|
||||
export UV_THREADPOOL_SIZE="${UV_THREADPOOL_SIZE:-$uv_threadpool_size}"
|
||||
|
||||
# Start your application using yarn
|
||||
node dist/main
|
||||
exec node dist/main
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-channels-2",
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-channels-678",
|
||||
"@adiwajshing/keyed-db": "^0.2.4",
|
||||
"@aws-sdk/client-s3": "^3.633.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.633.0",
|
||||
|
||||
@@ -9,14 +9,11 @@ import {
|
||||
NotFoundException,
|
||||
Post,
|
||||
Query,
|
||||
Res,
|
||||
StreamableFile,
|
||||
UseInterceptors,
|
||||
UsePipes,
|
||||
} from '@nestjs/common';
|
||||
import { ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger';
|
||||
import { WhatsappConfigService } from '@waha/config.service';
|
||||
import { getApp } from '@waha/main';
|
||||
import { WAHAValidationPipe } from '@waha/nestjs/pipes/WAHAValidationPipe';
|
||||
import { WAHAEnvironment } from '@waha/structures/environment.dto';
|
||||
import {
|
||||
@@ -25,6 +22,7 @@ import {
|
||||
StopRequest,
|
||||
StopResponse,
|
||||
} from '@waha/structures/server.dto';
|
||||
import { sleep } from '@waha/utils/promiseTimeout';
|
||||
import { VERSION } from '@waha/version';
|
||||
import * as lodash from 'lodash';
|
||||
|
||||
@@ -97,16 +95,14 @@ export class ServerController {
|
||||
setTimeout(() => {
|
||||
this.logger.log('Force stopping the server');
|
||||
process.kill(process.pid, 'SIGKILL');
|
||||
process.exit(0);
|
||||
}, timeout);
|
||||
} else {
|
||||
this.logger.log(`Gracefully stopping the server in ${timeout}ms`);
|
||||
setTimeout(async () => {
|
||||
this.logger.log('Gracefully closing the application...');
|
||||
const app = getApp();
|
||||
if (app) {
|
||||
await app.close();
|
||||
}
|
||||
this.logger.log('Application closed');
|
||||
process.kill(process.pid, 'SIGTERM');
|
||||
await sleep(10_000);
|
||||
process.exit(0);
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import makeWASocket, {
|
||||
Browsers,
|
||||
Contact,
|
||||
DisconnectReason,
|
||||
downloadMediaMessage,
|
||||
extractMessageContent,
|
||||
getAggregateVotesInPollMessage,
|
||||
getContentType,
|
||||
@@ -19,7 +20,6 @@ import makeWASocket, {
|
||||
WAMessageContent,
|
||||
WAMessageKey,
|
||||
} from '@adiwajshing/baileys';
|
||||
import { downloadMediaMessage } from '@adiwajshing/baileys';
|
||||
import { WACallEvent } from '@adiwajshing/baileys/lib/Types/Call';
|
||||
import { Label as NOWEBLabel } from '@adiwajshing/baileys/lib/Types/Label';
|
||||
import { LabelAssociationType } from '@adiwajshing/baileys/lib/Types/LabelAssociation';
|
||||
@@ -163,6 +163,8 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
private msgRetryCounterCache: NodeCache;
|
||||
protected engineLogger: BaileysLogger;
|
||||
|
||||
private authNOWEBStore: any;
|
||||
|
||||
get listenConnectionEventsFromTheStart() {
|
||||
return true;
|
||||
}
|
||||
@@ -202,6 +204,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
delay * SECOND,
|
||||
this.logger,
|
||||
);
|
||||
this.authNOWEBStore = null;
|
||||
}
|
||||
|
||||
async start() {
|
||||
@@ -240,10 +243,13 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
}
|
||||
|
||||
async makeSocket(): Promise<any> {
|
||||
const { state, saveCreds } = await this.authFactory.buildAuth(
|
||||
this.sessionStore,
|
||||
this.name,
|
||||
);
|
||||
if (!this.authNOWEBStore) {
|
||||
this.authNOWEBStore = await this.authFactory.buildAuth(
|
||||
this.sessionStore,
|
||||
this.name,
|
||||
);
|
||||
}
|
||||
const { state, saveCreds } = this.authNOWEBStore;
|
||||
const agent = this.makeAgent();
|
||||
const socketConfig = this.getSocketConfig(agent, state);
|
||||
const sock = makeWASocket(socketConfig);
|
||||
@@ -404,9 +410,19 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
|
||||
async stop() {
|
||||
this.shouldRestart = false;
|
||||
this.startDelayedJob.cancel();
|
||||
this.autoRestartJob.stop();
|
||||
if (this.authNOWEBStore && this.status == WAHASessionStatus.WORKING) {
|
||||
this.logger.info('Saving creds before stopping...');
|
||||
await this.authNOWEBStore.saveCreds().catch((e) => {
|
||||
this.logger.error('Failed to save creds');
|
||||
this.logger.error(e, e.stack);
|
||||
});
|
||||
this.logger.info('Creds saved');
|
||||
this.authNOWEBStore = null;
|
||||
}
|
||||
this.status = WAHASessionStatus.STOPPED;
|
||||
this.events.removeAllListeners();
|
||||
this.startDelayedJob.cancel();
|
||||
await this.end();
|
||||
await this.store?.close();
|
||||
return;
|
||||
|
||||
+9
-8
@@ -29,6 +29,13 @@ process.on('unhandledRejection', (reason, promise) => {
|
||||
// @ts-ignore
|
||||
logger.error(reason.stack);
|
||||
});
|
||||
process.on('SIGINT', () => {
|
||||
logger.info('SIGINT received');
|
||||
});
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
logger.info('SIGTERM received');
|
||||
});
|
||||
|
||||
async function loadModules(): Promise<
|
||||
[typeof AppModuleCore, typeof SwaggerConfiguratorCore]
|
||||
@@ -51,18 +58,12 @@ async function loadModules(): Promise<
|
||||
return [AppModulePlus, SwaggerConfiguratorPlus];
|
||||
}
|
||||
|
||||
let app = undefined;
|
||||
|
||||
export function getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
const version = getWAHAVersion();
|
||||
logger.info(`WAHA (WhatsApp HTTP API) - Running ${version} version...`);
|
||||
const [AppModule, SwaggerModule] = await loadModules();
|
||||
const httpsOptions = AppModule.getHttpsOptions(logger);
|
||||
app = await NestFactory.create(AppModule, {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
logger: getNestJSLogLevels(),
|
||||
httpsOptions: httpsOptions,
|
||||
bufferLogs: true,
|
||||
@@ -73,7 +74,6 @@ async function bootstrap() {
|
||||
// https://github.com/iamolegga/nestjs-pino?tab=readme-ov-file#expose-stack-trace-and-error-class-in-err-property
|
||||
app.useGlobalInterceptors(new LoggerErrorInterceptor());
|
||||
|
||||
app.enableShutdownHooks();
|
||||
app.useGlobalFilters(new AllExceptionsFilter());
|
||||
app.enableCors();
|
||||
// Ideally, we should apply it globally.
|
||||
@@ -90,6 +90,7 @@ async function bootstrap() {
|
||||
swaggerConfigurator.configure(WAHA_WEBHOOKS);
|
||||
|
||||
AppModule.appReady(app, logger);
|
||||
app.enableShutdownHooks();
|
||||
const config = app.get(WhatsappConfigService);
|
||||
await app.listen(config.port);
|
||||
logger.info(`WhatsApp HTTP API is running on: ${await app.getUrl()}`);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ export function getEngineName(): string {
|
||||
}
|
||||
|
||||
export const VERSION: WAHAEnvironment = {
|
||||
version: '2024.10.3',
|
||||
version: '2024.10.4',
|
||||
engine: getEngineName(),
|
||||
tier: getWAHAVersion(),
|
||||
browser: getBrowserExecutablePath(),
|
||||
|
||||
@@ -5,16 +5,16 @@ __metadata:
|
||||
version: 6
|
||||
cacheKey: 8
|
||||
|
||||
"@adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-channels-2":
|
||||
version: 6.7.7
|
||||
resolution: "@adiwajshing/baileys@https://github.com/devlikeapro/Baileys.git#commit=ffc61c22bea5143051ea6704fcf39d8d4bb52892"
|
||||
"@adiwajshing/baileys@github:devlikeapro/Baileys#fork-master-channels-678":
|
||||
version: 6.7.8
|
||||
resolution: "@adiwajshing/baileys@https://github.com/devlikeapro/Baileys.git#commit=d0323b92eb8365e6f32a61e41dd00010602d07f1"
|
||||
dependencies:
|
||||
"@adiwajshing/keyed-db": ^0.2.4
|
||||
"@hapi/boom": ^9.1.3
|
||||
async-lock: ^1.4.1
|
||||
audio-decode: ^2.1.3
|
||||
axios: ^1.6.0
|
||||
cache-manager: 4.0.1
|
||||
cache-manager: ^5.7.6
|
||||
futoin-hkdf: ^1.5.1
|
||||
libphonenumber-js: ^1.10.20
|
||||
libsignal: "github:WhiskeySockets/libsignal-node"
|
||||
@@ -39,7 +39,7 @@ __metadata:
|
||||
optional: true
|
||||
sharp:
|
||||
optional: true
|
||||
checksum: 7254ddc761ab8235b645ad69ff998240df5636a4cdec97cefb26d7d43721839835d05663d57c95bd013318f9c7378a2a4882721c51a2cc055f9e1a92eaaa696c
|
||||
checksum: a3b461006443713074401a17c3481aef571301e83f1fba193d06e7f9ea4c47359b5c973d0b3804e34d4e48c35bdc1a64d8c3e59a0a744e5bc9bcca591d180901
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4132,13 +4132,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"async@npm:3.2.3":
|
||||
version: 3.2.3
|
||||
resolution: "async@npm:3.2.3"
|
||||
checksum: c4bee57ab2249af3dc83ca3ef9acfa8e822c0d5e5aa41bae3eaf7f673648343cd64ecd7d26091ffd357f3f044428b17b5f00098494b6cf8b6b3e9681f0636ca1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"async@npm:>=0.2.9, async@npm:^3.2.4":
|
||||
version: 3.2.5
|
||||
resolution: "async@npm:3.2.5"
|
||||
@@ -4642,14 +4635,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"cache-manager@npm:4.0.1":
|
||||
version: 4.0.1
|
||||
resolution: "cache-manager@npm:4.0.1"
|
||||
"cache-manager@npm:^5.7.6":
|
||||
version: 5.7.6
|
||||
resolution: "cache-manager@npm:5.7.6"
|
||||
dependencies:
|
||||
async: 3.2.3
|
||||
eventemitter3: ^5.0.1
|
||||
lodash.clonedeep: ^4.5.0
|
||||
lru-cache: ^7.10.1
|
||||
checksum: 8ca25b1e603111f033d1a3f1463b2a9203e9ea61a0706265a4d4f63d54a8be95f9e79efb04fc43103219becb4903a5db747a346e009e7102767a47e5677219b2
|
||||
lru-cache: ^10.2.2
|
||||
promise-coalesce: ^1.1.2
|
||||
checksum: c61d30e2824f99f04af8e14a2e98c2274daa276cce82f64f0ac4c4bd59cf30e1ad9dec4028148206ad729196b242940476602e2f12496366d6f3f4b9da7c24c5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6247,6 +6241,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eventemitter3@npm:^5.0.1":
|
||||
version: 5.0.1
|
||||
resolution: "eventemitter3@npm:5.0.1"
|
||||
checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"events@npm:^3.2.0, events@npm:^3.3.0":
|
||||
version: 3.3.0
|
||||
resolution: "events@npm:3.3.0"
|
||||
@@ -8581,6 +8582,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lru-cache@npm:^10.2.2":
|
||||
version: 10.4.3
|
||||
resolution: "lru-cache@npm:10.4.3"
|
||||
checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lru-cache@npm:^5.1.1":
|
||||
version: 5.1.1
|
||||
resolution: "lru-cache@npm:5.1.1"
|
||||
@@ -8590,7 +8598,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lru-cache@npm:^7.10.1, lru-cache@npm:^7.14.1":
|
||||
"lru-cache@npm:^7.14.1":
|
||||
version: 7.18.3
|
||||
resolution: "lru-cache@npm:7.18.3"
|
||||
checksum: e550d772384709deea3f141af34b6d4fa392e2e418c1498c078de0ee63670f1f46f5eee746e8ef7e69e1c895af0d4224e62ee33e66a543a14763b0f2e74c1356
|
||||
@@ -9955,6 +9963,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"promise-coalesce@npm:^1.1.2":
|
||||
version: 1.1.2
|
||||
resolution: "promise-coalesce@npm:1.1.2"
|
||||
checksum: 6f951b5db40ca78d09ad0f72adea0a2e9c5bdb0fc5b3ef218c611e2191c6ce2e9f752f815630fd07875dd1c9f04cc7327d6bada04b662dce986ce86ab88c2d5e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"promise-retry@npm:^2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "promise-retry@npm:2.0.1"
|
||||
@@ -12141,7 +12156,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "waha@workspace:."
|
||||
dependencies:
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-channels-2"
|
||||
"@adiwajshing/baileys": "github:devlikeapro/Baileys#fork-master-channels-678"
|
||||
"@adiwajshing/keyed-db": ^0.2.4
|
||||
"@aws-sdk/client-s3": ^3.633.0
|
||||
"@aws-sdk/s3-request-presigner": ^3.633.0
|
||||
|
||||
Reference in new issue
Block a user