add --allow-loopback for docker, bot and creator app
This commit is contained in:
1 parent
94feaa4a53
commit
2f366b1128
18 files changed
+77
-21
No files matched your search
@@ -71,6 +71,7 @@ export enum IPC {
|
||||
SET_UPSTREAM_PROXY = 'set-upstream-proxy',
|
||||
SET_DEBUG_LOGGING = 'set-debug-logging',
|
||||
SET_ALLOW_PRIVATE_DST = 'set-allow-private-dst',
|
||||
SET_ALLOW_LOOPBACK_DST = 'set-allow-loopback-dst',
|
||||
CLEAR_COOKIES = 'clear-cookies',
|
||||
GET_DION_CREDENTIALS = 'get-dion-credentials',
|
||||
SET_DION_CREDENTIALS = 'set-dion-credentials',
|
||||
|
||||
@@ -52,6 +52,7 @@ export class HeadlessLauncher {
|
||||
private upstreamProxy: UpstreamProxy = { socks: '', user: '', pass: '' };
|
||||
private debugLogging = false;
|
||||
private allowPrivateDst = false;
|
||||
private allowLoopbackDst = false;
|
||||
|
||||
constructor(
|
||||
private host: LauncherHost,
|
||||
@@ -92,6 +93,10 @@ export class HeadlessLauncher {
|
||||
this.allowPrivateDst = enabled;
|
||||
}
|
||||
|
||||
setAllowLoopbackDst(enabled: boolean): void {
|
||||
this.allowLoopbackDst = enabled;
|
||||
}
|
||||
|
||||
sendLog(tabId: string, msg: string): void {
|
||||
const win = this.host.mainWindow;
|
||||
if (win && !win.isDestroyed()) {
|
||||
@@ -299,6 +304,7 @@ export class HeadlessLauncher {
|
||||
|
||||
private appendEgressArgs(args: string[]): void {
|
||||
if (this.allowPrivateDst) args.push('--allow-private-dst');
|
||||
if (this.allowLoopbackDst) args.push('--allow-loopback');
|
||||
if (!this.upstreamProxy.socks) return;
|
||||
args.push('--upstream-socks', this.upstreamProxy.socks);
|
||||
if (this.upstreamProxy.user) args.push('--upstream-user', this.upstreamProxy.user);
|
||||
|
||||
@@ -112,6 +112,10 @@ export function registerIpcHandlers(tabManager: TabManager): void {
|
||||
tabManager.setAllowPrivateDst(enabled);
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC.SET_ALLOW_LOOPBACK_DST, (_e, enabled: boolean) => {
|
||||
tabManager.setAllowLoopbackDst(enabled);
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC.CLEAR_COOKIES, (_e, platform: string) => {
|
||||
return tabManager.clearPlatformCookies(platform as Platform);
|
||||
});
|
||||
|
||||
@@ -161,6 +161,10 @@ export class TabManager {
|
||||
this.launcher.setAllowPrivateDst(enabled);
|
||||
}
|
||||
|
||||
setAllowLoopbackDst(enabled: boolean): void {
|
||||
this.launcher.setAllowLoopbackDst(enabled);
|
||||
}
|
||||
|
||||
startRelay(tabId: string, tab: TabState): void {
|
||||
this.launcher.startRelay(tabId, tab);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import { IPC } from '../constants';
|
||||
setAllowPrivateDst(enabled: boolean) {
|
||||
return ipcRenderer.invoke(IPC.SET_ALLOW_PRIVATE_DST, enabled);
|
||||
},
|
||||
setAllowLoopbackDst(enabled: boolean) {
|
||||
return ipcRenderer.invoke(IPC.SET_ALLOW_LOOPBACK_DST, enabled);
|
||||
},
|
||||
clearCookies(platform: string) {
|
||||
return ipcRenderer.invoke(IPC.CLEAR_COOKIES, platform);
|
||||
},
|
||||
|
||||
@@ -100,6 +100,8 @@ function bindSettingsEvents(): void {
|
||||
tm.saveDebugLogging();
|
||||
tm.allowPrivateDst = (document.getElementById('allowPrivateDst') as HTMLInputElement).checked;
|
||||
tm.saveAllowPrivateDst();
|
||||
tm.allowLoopbackDst = (document.getElementById('allowLoopbackDst') as HTMLInputElement).checked;
|
||||
tm.saveAllowLoopbackDst();
|
||||
closeSettings();
|
||||
});
|
||||
document.querySelectorAll('.btn-clear-cookies').forEach((btn) => {
|
||||
@@ -256,6 +258,7 @@ function openSettings(): void {
|
||||
(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('allowLoopbackDst') as HTMLInputElement).checked = tm.allowLoopbackDst;
|
||||
document.getElementById('clearCookiesStatus')!.textContent = '';
|
||||
}
|
||||
|
||||
@@ -289,6 +292,7 @@ function init(): void {
|
||||
|
||||
window.bridge.setUpstreamProxy(tm.upstreamProxy);
|
||||
window.bridge.setAllowPrivateDst(tm.allowPrivateDst);
|
||||
window.bridge.setAllowLoopbackDst(tm.allowLoopbackDst);
|
||||
|
||||
window.bridge.onRelayLog((tabId: string, msg: string) => {
|
||||
tm.appendRelayLog(tabId, msg);
|
||||
|
||||
@@ -24,6 +24,7 @@ export class RendererTabManager {
|
||||
upstreamProxy: UpstreamProxy;
|
||||
debugLogging: boolean;
|
||||
allowPrivateDst: boolean;
|
||||
allowLoopbackDst: boolean;
|
||||
private onRender: () => void;
|
||||
|
||||
constructor(onRender: () => void) {
|
||||
@@ -38,6 +39,7 @@ export class RendererTabManager {
|
||||
: { socks: '', user: '', pass: '' };
|
||||
this.debugLogging = localStorage.getItem('debugLogging') === 'true';
|
||||
this.allowPrivateDst = localStorage.getItem('allowPrivateDst') === 'true';
|
||||
this.allowLoopbackDst = localStorage.getItem('allowLoopbackDst') === 'true';
|
||||
}
|
||||
|
||||
createTab(): string {
|
||||
@@ -265,6 +267,11 @@ export class RendererTabManager {
|
||||
window.bridge.setAllowPrivateDst(this.allowPrivateDst);
|
||||
}
|
||||
|
||||
saveAllowLoopbackDst(): void {
|
||||
localStorage.setItem('allowLoopbackDst', String(this.allowLoopbackDst));
|
||||
window.bridge.setAllowLoopbackDst(this.allowLoopbackDst);
|
||||
}
|
||||
|
||||
startSavedCall(call: SavedCall): void {
|
||||
this.createTab();
|
||||
this.switchToHeadless(call.platform);
|
||||
|
||||
@@ -185,6 +185,7 @@ export interface Bridge {
|
||||
setUpstreamProxy(proxy: UpstreamProxy): Promise<void>;
|
||||
setDebugLogging(enabled: boolean): Promise<void>;
|
||||
setAllowPrivateDst(enabled: boolean): Promise<void>;
|
||||
setAllowLoopbackDst(enabled: boolean): Promise<void>;
|
||||
clearCookies(platform: string): Promise<number>;
|
||||
getDionCredentials(): Promise<DionCredentials>;
|
||||
setDionCredentials(email: string, password: string): Promise<void>;
|
||||
|
||||
Reference in new issue
Block a user