* ios proxy app, tune vp8 tunnel

* refactor go modules, move headless joiner android to a go captcha

* restore emojis in vk bot keyboard

* headless support in vk bot

* remove telemost dc hooks, update cretor-app ui and bot

* remove telemost support from go code, add fallback to video if mode == dc in joiners

* fix headless creators in windows

* update vk call creation autoclick

* force desktop useragent for creator app

* kick disconnected user in headless vk creator immediately when connection is lost

* update README.md

* update SETUP.md

* update release version

* add fallback for link creation in vk bot
This commit is contained in:
kulikov0 authored and GitHub committed 2026-04-19 17:47:36 +02:00
1 parent 9e1f2a98d9
commit 1b2d6bc5d3
89 files changed
+3503 -2158

No files matched your search

+27 -10
View File
@@ -163,10 +163,9 @@ export class BotManager {
if (payload?.cmd) {
const handled = await this.handlePayloadCommand(payload, peerId);
if (handled) return;
if (payload.cmd === BotCommand.VK) {
text = '/vk' + (payload.mode === 'video' ? ' video' : '');
} else if (payload.cmd === BotCommand.TM) {
text = '/tm' + (payload.mode === 'video' ? ' video' : '');
const cmdPrefix = payload.cmd === BotCommand.VK ? '/vk' : payload.cmd === BotCommand.TM ? '/tm' : null;
if (cmdPrefix && payload.mode) {
text = `${cmdPrefix} ${payload.mode}`;
}
}
@@ -195,19 +194,37 @@ export class BotManager {
return false;
}
private parseTunnelMode(text: string, platform: Platform): TunnelMode {
if (text.includes('headless')) {
return platform === Platform.VK ? TunnelMode.HeadlessVK : TunnelMode.HeadlessTelemost;
}
if (text.includes('video')) return TunnelMode.PionVideo;
return TunnelMode.DC;
}
private tunnelModeLabel(mode: TunnelMode): string {
switch (mode) {
case TunnelMode.HeadlessVK:
case TunnelMode.HeadlessTelemost:
return 'Headless';
case TunnelMode.PionVideo:
return 'Video';
default:
return 'DC';
}
}
private async handleTextCommand(text: string, peerId: number): Promise<void> {
if (text.startsWith('/vk')) {
const mode = text.includes('video') ? TunnelMode.PionVideo : TunnelMode.DC;
const mode = this.parseTunnelMode(text, Platform.VK);
console.log('[BOT] Creating VK tab with mode:', mode);
this.onCreateTab({ mode, peerId, platform: Platform.VK });
const label = mode === TunnelMode.DC ? 'DC' : 'Video';
await this.sendMessage(peerId, `Creating VK call (${label})`, createMainKeyboard());
await this.sendMessage(peerId, `Creating VK call (${this.tunnelModeLabel(mode)})`, createMainKeyboard());
} else if (text.startsWith('/tm')) {
const mode = text.includes('video') ? TunnelMode.PionVideo : TunnelMode.DC;
const mode = this.parseTunnelMode(text, Platform.Telemost);
console.log('[BOT] Creating Telemost tab with mode:', mode);
this.onCreateTab({ mode, peerId, platform: Platform.Telemost });
const label = mode === TunnelMode.DC ? 'DC' : 'Video';
await this.sendMessage(peerId, `Creating Telemost call (${label})`, createMainKeyboard());
await this.sendMessage(peerId, `Creating Telemost call (${this.tunnelModeLabel(mode)})`, createMainKeyboard());
} else if (text === '/list') {
await this.showList(peerId);
} else if (text.startsWith('/close ')) {
+8 -7
View File
@@ -26,15 +26,16 @@ export function createMainKeyboard() {
one_time: false,
buttons: [
[
{ action: { type: 'text', label: 'VK DC', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
{ action: { type: 'text', label: 'VK Video', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
{ action: { type: 'text', label: '📞 VK DC', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
{ action: { type: 'text', label: '📹 VK Video', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
{ action: { type: 'text', label: '👻 VK Headless', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'headless' }) } },
],
[
{ action: { type: 'text', label: 'TM DC', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'dc' }) } },
{ action: { type: 'text', label: 'TM Video', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
{ action: { type: 'text', label: '📹 TM Video', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
{ action: { type: 'text', label: '👻 TM Headless', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'headless' }) } },
],
[
{ action: { type: 'text', label: 'Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
{ action: { type: 'text', label: '📋 Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
],
],
};
@@ -44,7 +45,7 @@ export function createListKeyboard(tabsList: TabListEntry[]) {
const buttons = tabsList.map((entry) => {
const shortId = padShortId(generateShortId(entry.id));
const prefix = entry.isBot ? 'bot' : 'user';
const status = entry.callStatus === CallStatus.Active ? '+' : '-';
const status = entry.callStatus === CallStatus.Active ? '🟢' : '⚪';
return [
{
action: {
@@ -56,7 +57,7 @@ export function createListKeyboard(tabsList: TabListEntry[]) {
];
});
buttons.push([
{ action: { type: 'text', label: 'Back', payload: JSON.stringify({ cmd: BotCommand.Menu }) } },
{ action: { type: 'text', label: '◀️ Back', payload: JSON.stringify({ cmd: BotCommand.Menu }) } },
]);
return { one_time: false, buttons };
}
+1
View File
@@ -51,6 +51,7 @@ export enum IPC {
CREATE_BOT_TAB = 'create-bot-tab',
CLOSE_BOT_TAB = 'close-bot-tab',
BOT_ERROR = 'bot-error',
SEND_BOT_CALL_LINK = 'send-bot-call-link',
}
export const LOG_CAPTURE_SNIPPET = [
+6 -2
View File
@@ -22,9 +22,9 @@ export function registerIpcHandlers(tabManager: TabManager): void {
return fs.readFile(filePath, 'utf8');
});
ipcMain.handle(IPC.SET_TUNNEL_MODE, (_e, tabId: string, mode: string) => {
ipcMain.handle(IPC.SET_TUNNEL_MODE, (_e, tabId: string, mode: string, platform?: string) => {
if (!Object.values(TunnelMode).includes(mode as TunnelMode)) return;
tabManager.setTunnelMode(tabId, mode as TunnelMode);
tabManager.setTunnelMode(tabId, mode as TunnelMode, platform as Platform | undefined);
});
ipcMain.handle(IPC.START_RELAY, async (_e, tabId: string) => {
@@ -90,6 +90,10 @@ export function registerIpcHandlers(tabManager: TabManager): void {
return { success: true };
});
ipcMain.handle(IPC.SEND_BOT_CALL_LINK, (_e, tabId: string, link: string) => {
tabManager.sendBotCallLink(tabId, link);
});
ipcMain.handle(IPC.GET_COOKIES, async (_e, domain: string) => {
const ses = session.fromPartition(SESSION_PARTITION);
const all = await ses.cookies.get({});
+18 -17
View File
@@ -188,6 +188,14 @@ export class TabManager {
proc.stderr?.on('data', onData);
}
sendBotCallLink(tabId: string, link: string): void {
if (!this.botTabIds.has(tabId) || !this._botManager) return;
const tab = this.tabs.get(tabId);
if (!tab || tab.peerId == null) return;
console.log(`[MAIN] Headless call link for bot tab ${tabId}:`, link);
this._botManager.sendMessage(tab.peerId, `Call created!\n${link}`);
}
startRelay(tabId: string, tab: TabState): void {
this.killRelay(tabId, tab);
const port = tab.tunnelMode === TunnelMode.PionVideo ? tab.pionPort : tab.dcPort;
@@ -222,11 +230,12 @@ export class TabManager {
}
this.killRelay(tabId, tab);
const binaryPath = isTelemost ? this.headlessTelemostPath : this.headlessVKPath;
const proc = spawn(binaryPath, ['--cookie-string', cookieStr, '--resources', 'default'], {
stdio: ['ignore', 'pipe', 'pipe'],
const proc = spawn(binaryPath, ['--resources', 'default'], {
stdio: ['pipe', 'pipe', 'pipe'],
});
tab.relay = proc;
this.attachProcessOutput(proc, tabId);
proc.stdin?.write(cookieStr + '\n');
proc.on('close', (code) => {
this.sendLog(tabId, `Headless exited with code ${code}`);
});
@@ -246,31 +255,23 @@ export class TabManager {
async loadHook(tabId: string, url: string, tab: TabState): Promise<string> {
const isTelemost = url.includes('telemost.yandex');
const newPlatform = isTelemost ? Platform.Telemost : Platform.VK;
tab.platform = isTelemost ? Platform.Telemost : Platform.VK;
if (newPlatform !== tab.platform && tab.tunnelMode === TunnelMode.PionVideo) {
tab.platform = newPlatform;
this.killRelay(tabId, tab);
setTimeout(() => this.startRelay(tabId, tab), RELAY_RESTART_DELAY_MS);
} else {
tab.platform = newPlatform;
}
if (tab.tunnelMode === TunnelMode.PionVideo) {
if (isTelemost || tab.tunnelMode === TunnelMode.PionVideo) {
const hookFile = isTelemost ? 'video-telemost.js' : 'video-vk.js';
const hook = await fs.readFile(path.join(this.hooksDir, hookFile), 'utf8');
return LOG_CAPTURE_SNIPPET + `window.PION_PORT=${tab.pionPort};window.IS_CREATOR=true;` + hook;
}
const hookFile = isTelemost ? 'dc-creator-telemost.js' : 'dc-creator-vk.js';
const hook = await fs.readFile(path.join(this.hooksDir, hookFile), 'utf8');
const hook = await fs.readFile(path.join(this.hooksDir, 'dc-creator-vk.js'), 'utf8');
return LOG_CAPTURE_SNIPPET + `window.WS_PORT=${tab.dcPort};` + hook;
}
setTunnelMode(tabId: string, mode: TunnelMode): void {
const tab = this.tabs.get(tabId);
if (!tab) return;
async setTunnelMode(tabId: string, mode: TunnelMode, platform?: Platform): Promise<void> {
const tab = await this.getOrCreateTab(tabId);
tab.tunnelMode = mode;
if (platform) tab.platform = platform;
if (mode === TunnelMode.HeadlessVK || mode === TunnelMode.HeadlessTelemost) return;
this.killRelay(tabId, tab);
setTimeout(() => this.startRelay(tabId, tab), RELAY_RESTART_DELAY_MS);
}
+5 -2
View File
@@ -8,8 +8,8 @@ import { IPC } from '../constants';
getHookCode(tabId: string, url: string) {
return ipcRenderer.invoke(IPC.GET_HOOK_CODE, tabId, url);
},
setTunnelMode(tabId: string, mode: string) {
return ipcRenderer.invoke(IPC.SET_TUNNEL_MODE, tabId, mode);
setTunnelMode(tabId: string, mode: string, platform?: string) {
return ipcRenderer.invoke(IPC.SET_TUNNEL_MODE, tabId, mode, platform);
},
startRelay(tabId: string) {
return ipcRenderer.invoke(IPC.START_RELAY, tabId);
@@ -38,6 +38,9 @@ import { IPC } from '../constants';
startHeadless(tabId: string, platform: string) {
return ipcRenderer.invoke(IPC.START_HEADLESS, tabId, platform);
},
sendBotCallLink(tabId: string, link: string) {
return ipcRenderer.invoke(IPC.SEND_BOT_CALL_LINK, tabId, link);
},
onCloseBotTab(cb: (data: any) => void) {
ipcRenderer.on(IPC.CLOSE_BOT_TAB, (_e, data) => cb(data));
},
+16 -2
View File
@@ -1,4 +1,4 @@
import { Platform, Bridge, LogPanel, Webview } from '../types';
import { Platform, Bridge, LogPanel, TunnelMode, Webview } from '../types';
import { SESSION_PARTITION, HOOK_POLL_INTERVAL_MS, CALL_CREATOR_INJECT_DELAY_MS } from '../constants';
import { RendererTabManager } from './tab-manager';
@@ -71,7 +71,12 @@ export function renderContent(tm: RendererTabManager): void {
} else {
toolbar.style.display = 'flex';
headlessInfo.style.display = 'none';
(document.getElementById('modeSelect') as HTMLSelectElement).value = activeTab.mode;
const isVK = activeTab.platform === Platform.VK && activeTab.url.includes('vk.com');
const modeSelect = document.getElementById('modeSelect') as HTMLSelectElement;
const tunnelLabel = document.getElementById('tunnelLabel') as HTMLElement;
modeSelect.style.display = isVK ? '' : 'none';
tunnelLabel.style.display = isVK ? '' : 'none';
modeSelect.value = activeTab.mode;
if (activeTab.wv) activeTab.wv.classList.remove('hidden');
}
@@ -98,6 +103,13 @@ export function scrollLogs(): void {
export function loadURL(tm: RendererTabManager, url: string): void {
if (!tm.activeTabId) return;
const activeTab = tm.tabs[tm.activeTabId];
if (url.includes('telemost.yandex')) {
activeTab.platform = Platform.Telemost;
activeTab.mode = TunnelMode.PionVideo;
} else if (url.includes('vk.com')) {
activeTab.platform = Platform.VK;
}
window.bridge.setTunnelMode(tm.activeTabId, activeTab.mode, activeTab.platform);
if (activeTab.wv) activeTab.wv.remove();
const webview = document.createElement('webview') as unknown as Webview;
@@ -105,6 +117,7 @@ export function loadURL(tm: RendererTabManager, url: string): void {
webview.setAttribute('partition', SESSION_PARTITION);
webview.setAttribute('nodeintegration', '');
webview.setAttribute('nodeintegrationinsubframes', '');
webview.setAttribute('useragent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36');
webview.classList.add('webview-full');
webview.dataset.tabId = tm.activeTabId;
document.getElementById('content')!.appendChild(webview);
@@ -150,6 +163,7 @@ export function loadURL(tm: RendererTabManager, url: string): void {
activeTab.wv = webview;
activeTab.url = url;
renderTabs(tm);
renderContent(tm);
}
export function startHookLogPoller(tm: RendererTabManager): void {
+8 -3
View File
@@ -155,9 +155,14 @@ function init(): void {
window.bridge.onCreateBotTab((data: BotTabData) => {
tm.createBotTab(data);
(document.getElementById('modeSelect') as HTMLSelectElement).value = data.mode;
window.bridge.setTunnelMode(data.tabId, data.mode);
const url = data.platform === Platform.Telemost ? TELEMOST_URL : VK_IM_URL;
loadURL(tm, url);
if (data.mode === TunnelMode.HeadlessVK) {
tm.switchToHeadless(Platform.VK);
} else if (data.mode === TunnelMode.HeadlessTelemost) {
tm.switchToHeadless(Platform.Telemost);
} else {
const url = data.platform === Platform.Telemost ? TELEMOST_URL : VK_IM_URL;
loadURL(tm, url);
}
});
window.bridge.onCloseBotTab((data: { tabId: string }) => {
+10 -10
View File
@@ -30,7 +30,6 @@ export class RendererTabManager {
name: '',
isBot: false,
};
window.bridge.startRelay(tabId);
this.selectTab(tabId);
return tabId;
}
@@ -57,7 +56,9 @@ export class RendererTabManager {
createBotTab(data: BotTabData): void {
if (!this.tabs[data.tabId]) {
const botName = data.platform === Platform.Telemost ? 'Bot-Telemost' : 'Bot-VK';
const isHeadless = data.mode === TunnelMode.HeadlessVK || data.mode === TunnelMode.HeadlessTelemost;
const platformLabel = data.platform === Platform.Telemost ? 'TM' : 'VK';
const botName = isHeadless ? `Bot-Headless-${platformLabel}` : `Bot-${data.platform === Platform.Telemost ? 'Telemost' : 'VK'}`;
this.tabs[data.tabId] = {
wv: null,
url: '',
@@ -141,23 +142,22 @@ export class RendererTabManager {
tab.headlessStatus = 'Call created';
changed = true;
}
if (trimmed.includes(HeadlessLogMarker.JOIN_LINK)) {
if (!tab.callInfo) tab.callInfo = {};
if (trimmed.includes(HeadlessLogMarker.JOIN_LINK) && tab.callInfo) {
tab.callInfo.joinLink = trimmed.split(HeadlessLogMarker.JOIN_LINK)[1].trim();
if (tab.isBot) {
window.bridge.sendBotCallLink(tabId, tab.callInfo.joinLink);
}
changed = true;
}
if (trimmed.includes(HeadlessLogMarker.SHORT_LINK)) {
if (!tab.callInfo) tab.callInfo = {};
if (trimmed.includes(HeadlessLogMarker.SHORT_LINK) && tab.callInfo) {
tab.callInfo.shortLink = trimmed.split(HeadlessLogMarker.SHORT_LINK)[1].trim();
changed = true;
}
if (trimmed.includes(HeadlessLogMarker.TURN)) {
if (!tab.callInfo) tab.callInfo = {};
if (trimmed.includes(HeadlessLogMarker.TURN) && tab.callInfo) {
tab.callInfo.turn = trimmed.split(HeadlessLogMarker.TURN)[1].trim();
changed = true;
}
if (trimmed.includes(HeadlessLogMarker.PROTOCOL)) {
if (!tab.callInfo) tab.callInfo = {};
if (trimmed.includes(HeadlessLogMarker.PROTOCOL) && tab.callInfo) {
tab.callInfo.protocol = trimmed.split(HeadlessLogMarker.PROTOCOL)[1].trim();
changed = true;
}
+2 -1
View File
@@ -116,7 +116,7 @@ export interface RelayLogData {
export interface Bridge {
onRelayLog(cb: (tabId: string, msg: string) => void): void;
getHookCode(tabId: string, url: string): Promise<string>;
setTunnelMode(tabId: string, mode: string): Promise<void>;
setTunnelMode(tabId: string, mode: string, platform?: string): Promise<void>;
startRelay(tabId: string): Promise<void>;
closeTab(tabId: string): Promise<void>;
startBot(settings: BotSettings): Promise<void>;
@@ -126,5 +126,6 @@ export interface Bridge {
onBotError(cb: (msg: string) => void): void;
getCookies(domain: string): Promise<Electron.Cookie[]>;
startHeadless(tabId: string, platform: string): Promise<void>;
sendBotCallLink(tabId: string, link: string): Promise<void>;
onCloseBotTab(cb: (data: { tabId: string }) => void): void;
}