add --allow-private-dst support for docker, bot and creator app

This commit is contained in:
kulikov0 committed 2026-09-15 18:04:12 +02:00
1 parent ca0966bc33
commit d171a757aa
16 files changed
+129 -32

No files matched your search

+2
View File
@@ -120,6 +120,8 @@
<input type="password" id="upstreamPass" placeholder="optional">
<h2>Logging</h2>
<label class="popup-check"><input type="checkbox" id="debugLogging"><span>Debug logging</span></label>
<h2>Local network</h2>
<label class="popup-check"><input type="checkbox" id="allowPrivateDst"><span>Let the joiner reach my local network</span></label>
<h2>Clear cookies</h2>
<div class="clear-cookies-row">
<button type="button" class="btn-clear-cookies" data-platform="vk">VK</button>
+1
View File
@@ -70,6 +70,7 @@ export enum IPC {
STOP_BOT = 'stop-bot',
SET_UPSTREAM_PROXY = 'set-upstream-proxy',
SET_DEBUG_LOGGING = 'set-debug-logging',
SET_ALLOW_PRIVATE_DST = 'set-allow-private-dst',
CLEAR_COOKIES = 'clear-cookies',
GET_DION_CREDENTIALS = 'get-dion-credentials',
SET_DION_CREDENTIALS = 'set-dion-credentials',
+10 -4
View File
@@ -40,6 +40,7 @@ export class HeadlessLauncher {
private binaryPaths = new Map<Platform, string>();
private upstreamProxy: UpstreamProxy = { socks: '', user: '', pass: '' };
private debugLogging = false;
private allowPrivateDst = false;
constructor(
private host: LauncherHost,
@@ -76,6 +77,10 @@ export class HeadlessLauncher {
this.debugLogging = enabled;
}
setAllowPrivateDst(enabled: boolean): void {
this.allowPrivateDst = enabled;
}
sendLog(tabId: string, msg: string): void {
const win = this.host.mainWindow;
if (win && !win.isDestroyed()) {
@@ -101,7 +106,7 @@ export class HeadlessLauncher {
: RelayMode.VKVideoCreator;
}
const relayArgs = ['--mode', relayMode, '--ws-port', String(port)];
this.appendUpstreamArgs(relayArgs);
this.appendEgressArgs(relayArgs);
if (this.debugLogging) relayArgs.push('--debug');
const proc = spawn(this.relayPath, relayArgs, {
stdio: ['ignore', 'pipe', 'pipe'],
@@ -174,7 +179,7 @@ export class HeadlessLauncher {
if (joinTarget && config.joinFlag) {
spawnArgs.push(config.joinFlag, joinTarget);
}
this.appendUpstreamArgs(spawnArgs);
this.appendEgressArgs(spawnArgs);
if (this.debugLogging) spawnArgs.push('--debug');
const proc = spawn(this.binaryPaths.get(platform)!, spawnArgs, {
stdio: ['ignore', 'pipe', 'pipe'],
@@ -252,7 +257,7 @@ export class HeadlessLauncher {
if (joinTarget) {
spawnArgs.push('--room', joinTarget);
}
this.appendUpstreamArgs(spawnArgs);
this.appendEgressArgs(spawnArgs);
if (this.debugLogging) spawnArgs.push('--debug');
const proc = spawn(this.bitrixPath, spawnArgs, {
stdio: ['ignore', 'pipe', 'pipe'],
@@ -276,7 +281,8 @@ export class HeadlessLauncher {
});
}
private appendUpstreamArgs(args: string[]): void {
private appendEgressArgs(args: string[]): void {
if (this.allowPrivateDst) args.push('--allow-private-dst');
if (!this.upstreamProxy.socks) return;
args.push('--upstream-socks', this.upstreamProxy.socks);
if (this.upstreamProxy.user) args.push('--upstream-user', this.upstreamProxy.user);
+4
View File
@@ -108,6 +108,10 @@ export function registerIpcHandlers(tabManager: TabManager): void {
tabManager.setDebugLogging(enabled);
});
ipcMain.handle(IPC.SET_ALLOW_PRIVATE_DST, (_e, enabled: boolean) => {
tabManager.setAllowPrivateDst(enabled);
});
ipcMain.handle(IPC.CLEAR_COOKIES, (_e, platform: string) => {
return tabManager.clearPlatformCookies(platform as Platform);
});
+4
View File
@@ -157,6 +157,10 @@ export class TabManager {
this.launcher.setDebugLogging(enabled);
}
setAllowPrivateDst(enabled: boolean): void {
this.launcher.setAllowPrivateDst(enabled);
}
startRelay(tabId: string, tab: TabState): void {
this.launcher.startRelay(tabId, tab);
}
+3
View File
@@ -29,6 +29,9 @@ import { IPC } from '../constants';
setDebugLogging(enabled: boolean) {
return ipcRenderer.invoke(IPC.SET_DEBUG_LOGGING, enabled);
},
setAllowPrivateDst(enabled: boolean) {
return ipcRenderer.invoke(IPC.SET_ALLOW_PRIVATE_DST, enabled);
},
clearCookies(platform: string) {
return ipcRenderer.invoke(IPC.CLEAR_COOKIES, platform);
},
+4
View File
@@ -98,6 +98,8 @@ function bindSettingsEvents(): void {
tm.saveUpstreamProxy();
tm.debugLogging = (document.getElementById('debugLogging') as HTMLInputElement).checked;
tm.saveDebugLogging();
tm.allowPrivateDst = (document.getElementById('allowPrivateDst') as HTMLInputElement).checked;
tm.saveAllowPrivateDst();
closeSettings();
});
document.querySelectorAll('.btn-clear-cookies').forEach((btn) => {
@@ -253,6 +255,7 @@ function openSettings(): void {
(document.getElementById('upstreamUser') as HTMLInputElement).value = tm.upstreamProxy.user;
(document.getElementById('upstreamPass') as HTMLInputElement).value = tm.upstreamProxy.pass;
(document.getElementById('debugLogging') as HTMLInputElement).checked = tm.debugLogging;
(document.getElementById('allowPrivateDst') as HTMLInputElement).checked = tm.allowPrivateDst;
document.getElementById('clearCookiesStatus')!.textContent = '';
}
@@ -285,6 +288,7 @@ function init(): void {
savedCalls.bindEvents();
window.bridge.setUpstreamProxy(tm.upstreamProxy);
window.bridge.setAllowPrivateDst(tm.allowPrivateDst);
window.bridge.onRelayLog((tabId: string, msg: string) => {
tm.appendRelayLog(tabId, msg);
+7
View File
@@ -23,6 +23,7 @@ export class RendererTabManager {
botSettings: BotSettings;
upstreamProxy: UpstreamProxy;
debugLogging: boolean;
allowPrivateDst: boolean;
private onRender: () => void;
constructor(onRender: () => void) {
@@ -36,6 +37,7 @@ export class RendererTabManager {
? JSON.parse(savedProxy)
: { socks: '', user: '', pass: '' };
this.debugLogging = localStorage.getItem('debugLogging') === 'true';
this.allowPrivateDst = localStorage.getItem('allowPrivateDst') === 'true';
}
createTab(): string {
@@ -258,6 +260,11 @@ export class RendererTabManager {
window.bridge.setDebugLogging(this.debugLogging);
}
saveAllowPrivateDst(): void {
localStorage.setItem('allowPrivateDst', String(this.allowPrivateDst));
window.bridge.setAllowPrivateDst(this.allowPrivateDst);
}
startSavedCall(call: SavedCall): void {
this.createTab();
this.switchToHeadless(call.platform);
+1
View File
@@ -184,6 +184,7 @@ export interface Bridge {
stopBot(): Promise<void>;
setUpstreamProxy(proxy: UpstreamProxy): Promise<void>;
setDebugLogging(enabled: boolean): Promise<void>;
setAllowPrivateDst(enabled: boolean): Promise<void>;
clearCookies(platform: string): Promise<number>;
getDionCredentials(): Promise<DionCredentials>;
setDionCredentials(email: string, password: string): Promise<void>;