join to existing call via bot in creator
This commit is contained in:
1 parent
cdfed572f0
commit
e94d0b2fb7
12 files changed
+133
-15
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,7 @@ import { VK_API_VERSION, VK_API_BASE_URL, BOT_POLL_RETRY_DELAY_MS, BOT_POLL_WAIT
|
|||||||
import {
|
import {
|
||||||
createMainKeyboard,
|
createMainKeyboard,
|
||||||
createListKeyboard,
|
createListKeyboard,
|
||||||
|
createWaitingKeyboard,
|
||||||
findTabByShortId,
|
findTabByShortId,
|
||||||
generateShortId,
|
generateShortId,
|
||||||
padShortId,
|
padShortId,
|
||||||
@@ -52,6 +53,7 @@ export class BotManager {
|
|||||||
private key: string | null = null;
|
private key: string | null = null;
|
||||||
private server: string | null = null;
|
private server: string | null = null;
|
||||||
private running = false;
|
private running = false;
|
||||||
|
private awaitingJoinLink = new Set<number>();
|
||||||
onError: ((msg: string) => void) | null = null;
|
onError: ((msg: string) => void) | null = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -171,15 +173,86 @@ export class BotManager {
|
|||||||
if (payload.cmd === BotCommand.VK) cmdPrefix = '/vk';
|
if (payload.cmd === BotCommand.VK) cmdPrefix = '/vk';
|
||||||
else if (payload.cmd === BotCommand.TM) cmdPrefix = '/tm';
|
else if (payload.cmd === BotCommand.TM) cmdPrefix = '/tm';
|
||||||
else if (payload.cmd === BotCommand.WB) cmdPrefix = '/wb';
|
else if (payload.cmd === BotCommand.WB) cmdPrefix = '/wb';
|
||||||
|
else if (payload.cmd === BotCommand.Dion) cmdPrefix = '/dion';
|
||||||
if (cmdPrefix && payload.mode) {
|
if (cmdPrefix && payload.mode) {
|
||||||
text = `${cmdPrefix} ${payload.mode}`;
|
text = `${cmdPrefix} ${payload.mode}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wasAwaiting = this.awaitingJoinLink.has(peerId);
|
||||||
|
const joinLink = this.detectJoinLink(text);
|
||||||
|
if (joinLink) {
|
||||||
|
this.awaitingJoinLink.delete(peerId);
|
||||||
|
console.log('[BOT] Detected join link for', joinLink.platform, ':', joinLink.target);
|
||||||
|
this.onCreateTab({
|
||||||
|
mode: this.headlessModeFor(joinLink.platform),
|
||||||
|
peerId,
|
||||||
|
platform: joinLink.platform,
|
||||||
|
joinTarget: joinLink.target,
|
||||||
|
});
|
||||||
|
await this.sendMessage(peerId, `Joining ${this.platformLabel(joinLink.platform)} call`, createMainKeyboard());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wasAwaiting) {
|
||||||
|
await this.sendMessage(
|
||||||
|
peerId,
|
||||||
|
"Couldn't detect a VK / Telemost / WBStream / DION link in that message. Paste a join link or press Back.",
|
||||||
|
createWaitingKeyboard(),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await this.handleTextCommand(text, peerId);
|
await this.handleTextCommand(text, peerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private detectJoinLink(text: string): { platform: Platform; target: string } | null {
|
||||||
|
const trimmed = text.trim();
|
||||||
|
if (!trimmed) return null;
|
||||||
|
const lower = trimmed.toLowerCase();
|
||||||
|
if (lower.startsWith('wbstream://') || lower.includes('stream.wb.ru')) {
|
||||||
|
return { platform: Platform.WBStream, target: trimmed };
|
||||||
|
}
|
||||||
|
if (lower.includes('telemost.yandex')) {
|
||||||
|
return { platform: Platform.Telemost, target: trimmed };
|
||||||
|
}
|
||||||
|
if (lower.startsWith('dion://') || lower.includes('dion.vc')) {
|
||||||
|
return { platform: Platform.Dion, target: trimmed };
|
||||||
|
}
|
||||||
|
if (lower.includes('vk.com/call/join')) {
|
||||||
|
return { platform: Platform.VK, target: trimmed };
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private headlessModeFor(platform: Platform): TunnelMode {
|
||||||
|
switch (platform) {
|
||||||
|
case Platform.Telemost: return TunnelMode.HeadlessTelemost;
|
||||||
|
case Platform.WBStream: return TunnelMode.HeadlessWBStream;
|
||||||
|
case Platform.Dion: return TunnelMode.HeadlessDion;
|
||||||
|
default: return TunnelMode.HeadlessVK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private platformLabel(platform: Platform): string {
|
||||||
|
switch (platform) {
|
||||||
|
case Platform.Telemost: return 'Telemost';
|
||||||
|
case Platform.WBStream: return 'WB Stream';
|
||||||
|
case Platform.Dion: return 'DION';
|
||||||
|
default: return 'VK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async handlePayloadCommand(payload: ButtonPayload, peerId: number): Promise<boolean> {
|
private async handlePayloadCommand(payload: ButtonPayload, peerId: number): Promise<boolean> {
|
||||||
|
if (payload.cmd === BotCommand.Noop) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (payload.cmd === BotCommand.JoinPrompt) {
|
||||||
|
this.awaitingJoinLink.add(peerId);
|
||||||
|
await this.sendMessage(peerId, 'Paste a join link', createWaitingKeyboard());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
this.awaitingJoinLink.delete(peerId);
|
||||||
if (payload.cmd === BotCommand.List) {
|
if (payload.cmd === BotCommand.List) {
|
||||||
await this.showList(peerId);
|
await this.showList(peerId);
|
||||||
return true;
|
return true;
|
||||||
@@ -203,6 +276,7 @@ export class BotManager {
|
|||||||
|
|
||||||
private parseTunnelMode(text: string, platform: Platform): TunnelMode {
|
private parseTunnelMode(text: string, platform: Platform): TunnelMode {
|
||||||
if (platform === Platform.WBStream) return TunnelMode.HeadlessWBStream;
|
if (platform === Platform.WBStream) return TunnelMode.HeadlessWBStream;
|
||||||
|
if (platform === Platform.Dion) return TunnelMode.HeadlessDion;
|
||||||
if (text.includes('headless')) {
|
if (text.includes('headless')) {
|
||||||
return platform === Platform.VK ? TunnelMode.HeadlessVK : TunnelMode.HeadlessTelemost;
|
return platform === Platform.VK ? TunnelMode.HeadlessVK : TunnelMode.HeadlessTelemost;
|
||||||
}
|
}
|
||||||
@@ -215,6 +289,7 @@ export class BotManager {
|
|||||||
case TunnelMode.HeadlessVK:
|
case TunnelMode.HeadlessVK:
|
||||||
case TunnelMode.HeadlessTelemost:
|
case TunnelMode.HeadlessTelemost:
|
||||||
case TunnelMode.HeadlessWBStream:
|
case TunnelMode.HeadlessWBStream:
|
||||||
|
case TunnelMode.HeadlessDion:
|
||||||
return 'Headless';
|
return 'Headless';
|
||||||
case TunnelMode.PionVideo:
|
case TunnelMode.PionVideo:
|
||||||
return 'Video';
|
return 'Video';
|
||||||
@@ -239,6 +314,11 @@ export class BotManager {
|
|||||||
console.log('[BOT] Creating WB Stream tab with mode:', mode);
|
console.log('[BOT] Creating WB Stream tab with mode:', mode);
|
||||||
this.onCreateTab({ mode, peerId, platform: Platform.WBStream });
|
this.onCreateTab({ mode, peerId, platform: Platform.WBStream });
|
||||||
await this.sendMessage(peerId, `Creating WB Stream room (${this.tunnelModeLabel(mode)})`, createMainKeyboard());
|
await this.sendMessage(peerId, `Creating WB Stream room (${this.tunnelModeLabel(mode)})`, createMainKeyboard());
|
||||||
|
} else if (text.startsWith('/dion')) {
|
||||||
|
const mode = this.parseTunnelMode(text, Platform.Dion);
|
||||||
|
console.log('[BOT] Creating DION tab with mode:', mode);
|
||||||
|
this.onCreateTab({ mode, peerId, platform: Platform.Dion });
|
||||||
|
await this.sendMessage(peerId, `Creating DION room (${this.tunnelModeLabel(mode)})`, createMainKeyboard());
|
||||||
} else if (text === '/list') {
|
} else if (text === '/list') {
|
||||||
await this.showList(peerId);
|
await this.showList(peerId);
|
||||||
} else if (text.startsWith('/close ')) {
|
} else if (text.startsWith('/close ')) {
|
||||||
|
|||||||
@@ -27,19 +27,37 @@ export function createMainKeyboard() {
|
|||||||
buttons: [
|
buttons: [
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '🟦 VK', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'headless' }) } },
|
{ action: { type: 'text', label: '🟦 VK', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'headless' }) } },
|
||||||
{ action: { type: 'text', label: 'DC (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
|
|
||||||
{ action: { type: 'text', label: 'Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{ action: { type: 'text', label: '🟥 Telemost', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'headless' }) } },
|
{ action: { type: 'text', label: '🟥 Telemost', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'headless' }) } },
|
||||||
{ action: { type: 'text', label: 'Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '🟪 WBStream', payload: JSON.stringify({ cmd: BotCommand.WB, mode: 'headless' }) } },
|
{ action: { type: 'text', label: '🟪 WBStream', payload: JSON.stringify({ cmd: BotCommand.WB, mode: 'headless' }) } },
|
||||||
|
{ action: { type: 'text', label: '🟩 DION', payload: JSON.stringify({ cmd: BotCommand.Dion, mode: 'headless' }) } },
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ action: { type: 'text', label: '🔗 Join by link', payload: JSON.stringify({ cmd: BotCommand.JoinPrompt }) } },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ action: { type: 'text', label: '📋 Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
|
{ action: { type: 'text', label: '📋 Active Tabs', payload: JSON.stringify({ cmd: BotCommand.List }) } },
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
{ action: { type: 'text', label: 'ℹ️ Buttons below: old webview mode', payload: JSON.stringify({ cmd: BotCommand.Noop }) } },
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ action: { type: 'text', label: '🟦 DC (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'dc' }) } },
|
||||||
|
{ action: { type: 'text', label: '🟦 Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.VK, mode: 'video' }) } },
|
||||||
|
{ action: { type: 'text', label: '🟥 Video (legacy)', payload: JSON.stringify({ cmd: BotCommand.TM, mode: 'video' }) } },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createWaitingKeyboard() {
|
||||||
|
return {
|
||||||
|
one_time: false,
|
||||||
|
buttons: [
|
||||||
|
[
|
||||||
|
{ action: { type: 'text', label: '◀️ Back', payload: JSON.stringify({ cmd: BotCommand.Menu }) } },
|
||||||
|
],
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export function registerIpcHandlers(tabManager: TabManager): void {
|
|||||||
mode: tabConfig.mode,
|
mode: tabConfig.mode,
|
||||||
peerId: tabConfig.peerId,
|
peerId: tabConfig.peerId,
|
||||||
platform: tabConfig.platform || Platform.VK,
|
platform: tabConfig.platform || Platform.VK,
|
||||||
|
joinTarget: tabConfig.joinTarget,
|
||||||
});
|
});
|
||||||
console.log('[BOT] Created tab:', tabId, 'mode:', tabConfig.mode, 'platform:', tabConfig.platform);
|
console.log('[BOT] Created tab:', tabId, 'mode:', tabConfig.mode, 'platform:', tabConfig.platform);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -315,6 +315,14 @@ export class TabManager {
|
|||||||
const refreshCookie = platform === Platform.WBStream ? 'wbx-refresh' : config.authCookie;
|
const refreshCookie = platform === Platform.WBStream ? 'wbx-refresh' : config.authCookie;
|
||||||
const needsLogin = !cookies.some((c) => c.name === refreshCookie);
|
const needsLogin = !cookies.some((c) => c.name === refreshCookie);
|
||||||
if (needsLogin) {
|
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.`);
|
this.sendLog(tabId, `No ${config.platformName} session found, opening login.`);
|
||||||
if (this._mainWindow && !this._mainWindow.isDestroyed()) {
|
if (this._mainWindow && !this._mainWindow.isDestroyed()) {
|
||||||
this._mainWindow.webContents.send(IPC.LOGIN_REQUIRED, { tabId, url: config.loginUrl });
|
this._mainWindow.webContents.send(IPC.LOGIN_REQUIRED, { tabId, url: config.loginUrl });
|
||||||
@@ -332,10 +340,10 @@ export class TabManager {
|
|||||||
cookies = await this.getCookiesForDomains(config.cookieDomains);
|
cookies = await this.getCookiesForDomains(config.cookieDomains);
|
||||||
}
|
}
|
||||||
this.sendLog(tabId, `${config.platformName} cookies (${cookies.length}): ${cookies.map((c) => c.name).join(', ')}`);
|
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`);
|
const cookiesPath = path.join(app.getPath('userData'), `cookies-${platform}.json`);
|
||||||
await fs.writeFile(cookiesPath, JSON.stringify(cookies));
|
await fs.writeFile(cookiesPath, JSON.stringify(cookies));
|
||||||
const spawnArgs = ['--resources', 'default', '--cookies', cookiesPath];
|
const spawnArgs = ['--resources', 'default', '--cookies', cookiesPath];
|
||||||
|
this.killRelay(tabId, tab);
|
||||||
if (joinTarget) {
|
if (joinTarget) {
|
||||||
const flag = this.joinFlagFor(platform);
|
const flag = this.joinFlagFor(platform);
|
||||||
if (flag) spawnArgs.push(flag, joinTarget);
|
if (flag) spawnArgs.push(flag, joinTarget);
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ export function renderContent(tm: RendererTabManager): void {
|
|||||||
document.getElementById('relayLog')!.textContent = activeTab.relayLogs || '';
|
document.getElementById('relayLog')!.textContent = activeTab.relayLogs || '';
|
||||||
document.getElementById('hookLog')!.textContent = activeTab.hookLogs || '';
|
document.getElementById('hookLog')!.textContent = activeTab.hookLogs || '';
|
||||||
scrollLogs();
|
scrollLogs();
|
||||||
|
|
||||||
renderBotButton(tm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderBotButton(tm: RendererTabManager): void {
|
export function renderBotButton(tm: RendererTabManager): void {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ declare const window: Window & { bridge: Bridge };
|
|||||||
const tm = new RendererTabManager(() => {
|
const tm = new RendererTabManager(() => {
|
||||||
renderTabs(tm);
|
renderTabs(tm);
|
||||||
renderContent(tm);
|
renderContent(tm);
|
||||||
|
renderBotButton(tm);
|
||||||
});
|
});
|
||||||
|
|
||||||
function bindTabBarEvents(): void {
|
function bindTabBarEvents(): void {
|
||||||
@@ -183,13 +184,13 @@ function init(): void {
|
|||||||
tm.createBotTab(data);
|
tm.createBotTab(data);
|
||||||
(document.getElementById('modeSelect') as HTMLSelectElement).value = data.mode;
|
(document.getElementById('modeSelect') as HTMLSelectElement).value = data.mode;
|
||||||
if (data.mode === TunnelMode.HeadlessVK) {
|
if (data.mode === TunnelMode.HeadlessVK) {
|
||||||
tm.switchToHeadless(Platform.VK);
|
tm.switchToHeadless(Platform.VK, data.joinTarget);
|
||||||
} else if (data.mode === TunnelMode.HeadlessTelemost) {
|
} else if (data.mode === TunnelMode.HeadlessTelemost) {
|
||||||
tm.switchToHeadless(Platform.Telemost);
|
tm.switchToHeadless(Platform.Telemost, data.joinTarget);
|
||||||
} else if (data.mode === TunnelMode.HeadlessWBStream) {
|
} else if (data.mode === TunnelMode.HeadlessWBStream) {
|
||||||
tm.switchToHeadless(Platform.WBStream);
|
tm.switchToHeadless(Platform.WBStream, data.joinTarget);
|
||||||
} else if (data.mode === TunnelMode.HeadlessDion) {
|
} else if (data.mode === TunnelMode.HeadlessDion) {
|
||||||
tm.switchToHeadless(Platform.Dion);
|
tm.switchToHeadless(Platform.Dion, data.joinTarget);
|
||||||
} else {
|
} else {
|
||||||
const url = data.platform === Platform.Telemost ? TELEMOST_URL : VK_IM_URL;
|
const url = data.platform === Platform.Telemost ? TELEMOST_URL : VK_IM_URL;
|
||||||
loadURL(tm, url);
|
loadURL(tm, url);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class RendererTabManager {
|
|||||||
return tabId;
|
return tabId;
|
||||||
}
|
}
|
||||||
|
|
||||||
switchToHeadless(platform: Platform): void {
|
switchToHeadless(platform: Platform, joinTarget?: string): void {
|
||||||
if (!this.activeTabId) return;
|
if (!this.activeTabId) return;
|
||||||
const tab = this.tabs[this.activeTabId];
|
const tab = this.tabs[this.activeTabId];
|
||||||
if (tab.wv) tab.wv.remove();
|
if (tab.wv) tab.wv.remove();
|
||||||
@@ -75,8 +75,12 @@ export class RendererTabManager {
|
|||||||
tab.relayLogs = '';
|
tab.relayLogs = '';
|
||||||
tab.hookLogs = '';
|
tab.hookLogs = '';
|
||||||
if (tab.isBot) {
|
if (tab.isBot) {
|
||||||
|
if (joinTarget) {
|
||||||
|
this.startHeadlessCall({ mode: HeadlessMode.Join, target: joinTarget });
|
||||||
|
} else {
|
||||||
this.startHeadlessCall({ mode: HeadlessMode.Create });
|
this.startHeadlessCall({ mode: HeadlessMode.Create });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.onRender();
|
this.onRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +117,7 @@ export class RendererTabManager {
|
|||||||
isBot: true,
|
isBot: true,
|
||||||
peerId: data.peerId,
|
peerId: data.peerId,
|
||||||
platform: data.platform,
|
platform: data.platform,
|
||||||
|
joinedByLink: !!data.joinTarget,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.selectTab(data.tabId);
|
this.selectTab(data.tabId);
|
||||||
@@ -191,7 +196,8 @@ export class RendererTabManager {
|
|||||||
if (trimmed.includes(HeadlessLogMarker.JOIN_LINK) && tab.callInfo) {
|
if (trimmed.includes(HeadlessLogMarker.JOIN_LINK) && tab.callInfo) {
|
||||||
tab.callInfo.joinLink = trimmed.split(HeadlessLogMarker.JOIN_LINK)[1].trim();
|
tab.callInfo.joinLink = trimmed.split(HeadlessLogMarker.JOIN_LINK)[1].trim();
|
||||||
if (tab.isBot) {
|
if (tab.isBot) {
|
||||||
window.bridge.sendBotCallLink(tabId, tab.callInfo.joinLink);
|
const reply = tab.joinedByLink ? 'Joined successfully' : tab.callInfo.joinLink;
|
||||||
|
window.bridge.sendBotCallLink(tabId, reply);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,12 @@ export enum BotCommand {
|
|||||||
VK = 'vk',
|
VK = 'vk',
|
||||||
TM = 'tm',
|
TM = 'tm',
|
||||||
WB = 'wb',
|
WB = 'wb',
|
||||||
|
Dion = 'dion',
|
||||||
|
JoinPrompt = 'join-prompt',
|
||||||
List = 'list',
|
List = 'list',
|
||||||
Menu = 'menu',
|
Menu = 'menu',
|
||||||
Close = 'close',
|
Close = 'close',
|
||||||
|
Noop = 'noop',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum LogPanel {
|
export enum LogPanel {
|
||||||
@@ -66,6 +69,7 @@ export interface TabConfig {
|
|||||||
mode: TunnelMode;
|
mode: TunnelMode;
|
||||||
peerId: number;
|
peerId: number;
|
||||||
platform: Platform;
|
platform: Platform;
|
||||||
|
joinTarget?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TabListEntry {
|
export interface TabListEntry {
|
||||||
@@ -116,6 +120,7 @@ export interface RendererTab {
|
|||||||
callInfo?: CallInfo;
|
callInfo?: CallInfo;
|
||||||
tunnelConnected?: boolean;
|
tunnelConnected?: boolean;
|
||||||
loginWebview?: Webview;
|
loginWebview?: Webview;
|
||||||
|
joinedByLink?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BotTabData {
|
export interface BotTabData {
|
||||||
@@ -123,6 +128,7 @@ export interface BotTabData {
|
|||||||
mode: TunnelMode;
|
mode: TunnelMode;
|
||||||
peerId: number;
|
peerId: number;
|
||||||
platform: Platform;
|
platform: Platform;
|
||||||
|
joinTarget?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RelayLogData {
|
export interface RelayLogData {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func main() {
|
|||||||
rawCookies := common.LoadCookies(*cookiesPath)
|
rawCookies := common.LoadCookies(*cookiesPath)
|
||||||
deviceID := common.CookieValue(rawCookies, "__wb_device_id")
|
deviceID := common.CookieValue(rawCookies, "__wb_device_id")
|
||||||
if deviceID == "" {
|
if deviceID == "" {
|
||||||
log.Fatalf("[auth] cookies file is missing __wb_device_id; re-export via creator-app's 'WB Cookies' button")
|
log.Fatalf("[auth] cookies file is missing __wb_device_id; re-export via creator-app's 'Export Cookies' button")
|
||||||
}
|
}
|
||||||
cookieHeader := common.FilterCookies(rawCookies, wbstream.WBStreamCookieAllowlist)
|
cookieHeader := common.FilterCookies(rawCookies, wbstream.WBStreamCookieAllowlist)
|
||||||
bearer, err := wbstream.RefreshAccessToken(nil, cookieHeader, deviceID)
|
bearer, err := wbstream.RefreshAccessToken(nil, cookieHeader, deviceID)
|
||||||
|
|||||||
Reference in new issue
Block a user