join to existing call via bot in creator

This commit is contained in:
kulikov0 committed 2026-05-16 13:15:22 +02:00
1 parent cdfed572f0
commit e94d0b2fb7
12 files changed
+134 -16

No files matched your search

+1
View File
@@ -55,6 +55,7 @@ export function registerIpcHandlers(tabManager: TabManager): void {
mode: tabConfig.mode,
peerId: tabConfig.peerId,
platform: tabConfig.platform || Platform.VK,
joinTarget: tabConfig.joinTarget,
});
console.log('[BOT] Created tab:', tabId, 'mode:', tabConfig.mode, 'platform:', tabConfig.platform);
},
+9 -1
View File
@@ -315,6 +315,14 @@ export class TabManager {
const refreshCookie = platform === Platform.WBStream ? 'wbx-refresh' : config.authCookie;
const needsLogin = !cookies.some((c) => c.name === refreshCookie);
if (needsLogin) {
if (tab.isBot) {
const reply = `Please log into ${config.platformName} in the creator app first, then try again.`;
this.sendLog(tabId, reply);
if (this._botManager && tab.peerId != null) {
await this._botManager.sendMessage(tab.peerId, reply);
}
return;
}
this.sendLog(tabId, `No ${config.platformName} session found, opening login.`);
if (this._mainWindow && !this._mainWindow.isDestroyed()) {
this._mainWindow.webContents.send(IPC.LOGIN_REQUIRED, { tabId, url: config.loginUrl });
@@ -332,10 +340,10 @@ export class TabManager {
cookies = await this.getCookiesForDomains(config.cookieDomains);
}
this.sendLog(tabId, `${config.platformName} cookies (${cookies.length}): ${cookies.map((c) => c.name).join(', ')}`);
this.killRelay(tabId, tab);
const cookiesPath = path.join(app.getPath('userData'), `cookies-${platform}.json`);
await fs.writeFile(cookiesPath, JSON.stringify(cookies));
const spawnArgs = ['--resources', 'default', '--cookies', cookiesPath];
this.killRelay(tabId, tab);
if (joinTarget) {
const flag = this.joinFlagFor(platform);
if (flag) spawnArgs.push(flag, joinTarget);