diff --git a/src/api/version.controller.ts b/src/api/version.controller.ts index 2d72482a..064d2679 100644 --- a/src/api/version.controller.ts +++ b/src/api/version.controller.ts @@ -1,6 +1,7 @@ import { Controller, Get } from '@nestjs/common'; import { ApiExtraModels, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { WAHAEnvironment } from '../structures/environment.dto'; import { VERSION } from '../version'; @ApiSecurity('api_key') @@ -8,7 +9,7 @@ import { VERSION } from '../version'; @ApiTags('other') export class VersionController { @Get('') - async get() { + get(): WAHAEnvironment { return VERSION; } } diff --git a/src/structures/environment.dto.ts b/src/structures/environment.dto.ts new file mode 100644 index 00000000..8420efee --- /dev/null +++ b/src/structures/environment.dto.ts @@ -0,0 +1,23 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class WAHAEnvironment { + @ApiProperty({ + example: '2029.10.29', + }) + version: string; + + @ApiProperty({ + example: 'WEBJS', + }) + engine: string; + + @ApiProperty({ + example: 'PLUS', + }) + tier: string; + + @ApiProperty({ + example: '/usr/path/to/bin/google-chrome', + }) + browser: string; +} diff --git a/src/structures/webhooks.dto.ts b/src/structures/webhooks.dto.ts index 6f6ff734..1a10d1f0 100644 --- a/src/structures/webhooks.dto.ts +++ b/src/structures/webhooks.dto.ts @@ -6,6 +6,7 @@ import { MessageDestination } from './chatting.dto'; import { ChatIdProperty, MessageIdProperty } from './properties.dto'; import { WAHAChatPresences } from './presence.dto'; import { MeInfo } from './sessions.dto'; +import { WAHAEnvironment } from './environment.dto'; export class WAMessageAckBody { @MessageIdProperty() @@ -94,8 +95,7 @@ export class WAHAWebhook { me: MeInfo | null; - // eslint-disable-next-line @typescript-eslint/ban-types - environment: object; + environment: WAHAEnvironment; event: WAHAEvents; diff --git a/src/version.ts b/src/version.ts index 25fd8251..12f84dea 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,6 +1,7 @@ // 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'); @@ -31,7 +32,7 @@ export function getEngineName(): string { return process.env.WHATSAPP_DEFAULT_ENGINE || WAHAEngine.WEBJS; } -export const VERSION = { +export const VERSION: WAHAEnvironment = { version: '2023.10.12', engine: getEngineName(), tier: getWAHAVersion(),