Files
waha/src/version.ts
T
devlikepro 0c108f5232
Release / amd64 - chrome - chrome (push) Waiting to run
Release / amd64 - chromium - latest (push) Waiting to run
Release / linux/arm64 - chromium - arm (push) Waiting to run
Release / amd64 - none - noweb (push) Waiting to run
Release / linux/arm64 - none - noweb-arm (push) Waiting to run
[core] 2024.11.10
2024-12-01 15:37:21 +07:00

41 lines
1.2 KiB
TypeScript

// eslint-disable-next-line @typescript-eslint/no-var-requires
import { getBrowserExecutablePath } from './core/abc/session.abc';
import { WAHAEngine } from './structures/enums.dto';
import { WAHAEnvironment } from './structures/environment.dto';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs');
export enum WAHAVersion {
PLUS = 'PLUS',
CORE = 'CORE',
}
export function getWAHAVersion(): WAHAVersion {
// force core version if env variables set
const waha_version = process.env.WAHA_VERSION;
if (waha_version && waha_version === WAHAVersion.CORE) {
return WAHAVersion.CORE;
}
// Check the plus directory exists
const plusExists = fs.existsSync(`${__dirname}/plus`);
if (plusExists) {
return WAHAVersion.PLUS;
}
return WAHAVersion.CORE;
}
export function getEngineName(): string {
// Load engine name from WHATSAPP_DEFAULT_ENGINE environment variable
// If not set - use WEBJS
return process.env.WHATSAPP_DEFAULT_ENGINE || WAHAEngine.WEBJS;
}
export const VERSION: WAHAEnvironment = {
version: '2024.11.10',
engine: getEngineName(),
tier: getWAHAVersion(),
browser: getBrowserExecutablePath(),
};