Skip to content

Commit

Permalink
set name connected device
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Oct 17, 2024
1 parent df81d84 commit 121d83f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions backend/src/libs/wbot.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as Sentry from "@sentry/node";
import makeWASocket, {
WASocket,
Browsers,
DisconnectReason,
fetchLatestBaileysVersion,
makeCacheableSignalKeyStore,
Expand All @@ -27,6 +26,8 @@ import { StartWhatsAppSession } from "../services/WbotServices/StartWhatsAppSess
import DeleteBaileysService from "../services/BaileysServices/DeleteBaileysService";
import Contact from "../models/Contact";
import Ticket from "../models/Ticket";
import { GitInfo } from "../gitinfo";
import GetPublicSettingService from "../services/SettingServices/GetPublicSettingService";

const loggerBaileys = MAIN_LOGGER.child({});
loggerBaileys.level = "error";
Expand Down Expand Up @@ -135,10 +136,18 @@ export const initWASocket = async (whatsapp: Whatsapp): Promise<Session> => {
const msgRetryCounterCache = new NodeCache();
const userDevicesCache: CacheStore = new NodeCache();

const appName =
(await GetPublicSettingService({ key: "appName" })) || "Ticketz";
const hostName = process.env.BACKEND_URL?.split("/")[2];
const appVersion = GitInfo.tagName || GitInfo.commitHash;
const clientName = `${appName} ${appVersion}${
hostName ? ` - ${hostName}` : ""
}`;

wsocket = makeWASocket({
logger: loggerBaileys,
printQRInTerminal: false,
browser: Browsers.appropriate("Desktop"),
browser: [clientName, "Desktop", appVersion],
auth: {
creds: state.creds,
keys: makeCacheableSignalKeyStore(state.keys, loggerBaileys)
Expand Down

0 comments on commit 121d83f

Please sign in to comment.