diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f4d639..e246c383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * New instance manager in /manager route * Added extra files for chatwoot and appsmith * Added Get Last Message and Archive for Chat +* Added env var QRCODE_COLOR ### Fixed diff --git a/Docker/.env.example b/Docker/.env.example index f4e8291d..6c62b8bc 100644 --- a/Docker/.env.example +++ b/Docker/.env.example @@ -84,6 +84,7 @@ CONFIG_SESSION_PHONE_NAME=chrome # Set qrcode display limit QRCODE_LIMIT=30 +QRCODE_COLOR=#198754 # Defines an authentication type for the api # We recommend using the apikey because it will allow you to use a custom token, diff --git a/Dockerfile b/Dockerfile index 55af604b..24497be6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,7 @@ ENV CONFIG_SESSION_PHONE_CLIENT=EvolutionAPI ENV CONFIG_SESSION_PHONE_NAME=chrome ENV QRCODE_LIMIT=30 +ENV QRCODE_COLOR=#198754 ENV AUTHENTICATION_TYPE=apikey diff --git a/src/config/env.config.ts b/src/config/env.config.ts index b90141ff..a7638435 100644 --- a/src/config/env.config.ts +++ b/src/config/env.config.ts @@ -105,7 +105,7 @@ export type GlobalWebhook = { export type SslConf = { PRIVKEY: string; FULLCHAIN: string }; export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook }; export type ConfigSessionPhone = { CLIENT: string; NAME: string }; -export type QrCode = { LIMIT: number }; +export type QrCode = { LIMIT: number; COLOR: string }; export type Production = boolean; export interface Env { @@ -245,6 +245,7 @@ export class ConfigService { }, QRCODE: { LIMIT: Number.parseInt(process.env.QRCODE_LIMIT) || 30, + COLOR: process.env.QRCODE_COLOR || '#198754', }, AUTHENTICATION: { TYPE: process.env.AUTHENTICATION_TYPE as 'jwt', diff --git a/src/dev-env.yml b/src/dev-env.yml index b45d3201..ed2df448 100644 --- a/src/dev-env.yml +++ b/src/dev-env.yml @@ -122,6 +122,7 @@ CONFIG_SESSION_PHONE: # Set qrcode display limit QRCODE: LIMIT: 30 + COLOR: '#198754' # Defines an authentication type for the api # We recommend using the apikey because it will allow you to use a custom token, diff --git a/src/whatsapp/services/whatsapp.service.ts b/src/whatsapp/services/whatsapp.service.ts index fbe91f54..1116a835 100644 --- a/src/whatsapp/services/whatsapp.service.ts +++ b/src/whatsapp/services/whatsapp.service.ts @@ -597,11 +597,13 @@ export class WAStartupService { this.logger.verbose('Incrementing QR code count'); this.instance.qrcode.count++; + const color = this.configService.get('QRCODE').COLOR; + const optsQrcode: QRCodeToDataURLOptions = { margin: 3, scale: 4, errorCorrectionLevel: 'H', - color: { light: '#ffffff', dark: '#198754' }, + color: { light: '#ffffff', dark: color }, }; if (this.phoneNumber) {