add upstream proxy support for creator

This commit is contained in:
kulikov0 committed 2026-05-30 15:39:12 +02:00
1 parent 48dcb04c77
commit 000447b77c
21 files changed
+713 -84

No files matched your search

+9
View File
@@ -85,6 +85,10 @@ function bindSettingsEvents(): void {
tm.botSettings.groupId = (document.getElementById('vkGroupId') as HTMLInputElement).value.trim();
tm.botSettings.userId = (document.getElementById('vkUserId') as HTMLInputElement).value.trim();
tm.saveBotSettings();
tm.upstreamProxy.socks = (document.getElementById('upstreamSocks') as HTMLInputElement).value.trim();
tm.upstreamProxy.user = (document.getElementById('upstreamUser') as HTMLInputElement).value.trim();
tm.upstreamProxy.pass = (document.getElementById('upstreamPass') as HTMLInputElement).value.trim();
tm.saveUpstreamProxy();
closeSettings();
});
}
@@ -154,6 +158,9 @@ function openSettings(): void {
(document.getElementById('vkToken') as HTMLInputElement).value = tm.botSettings.token;
(document.getElementById('vkGroupId') as HTMLInputElement).value = tm.botSettings.groupId;
(document.getElementById('vkUserId') as HTMLInputElement).value = tm.botSettings.userId;
(document.getElementById('upstreamSocks') as HTMLInputElement).value = tm.upstreamProxy.socks;
(document.getElementById('upstreamUser') as HTMLInputElement).value = tm.upstreamProxy.user;
(document.getElementById('upstreamPass') as HTMLInputElement).value = tm.upstreamProxy.pass;
}
function closeSettings(): void {
@@ -169,6 +176,8 @@ function init(): void {
bindLogEvents();
bindHeadlessEvents();
window.bridge.setUpstreamProxy(tm.upstreamProxy);
window.bridge.onRelayLog((tabId: string, msg: string) => {
tm.appendRelayLog(tabId, msg);
});
+11
View File
@@ -2,6 +2,7 @@ import {
RendererTab,
BotTabData,
BotSettings,
UpstreamProxy,
TunnelMode,
Platform,
Bridge,
@@ -18,6 +19,7 @@ export class RendererTabManager {
private nextId = 1;
botRunning = false;
botSettings: BotSettings;
upstreamProxy: UpstreamProxy;
private onRender: () => void;
constructor(onRender: () => void) {
@@ -26,6 +28,10 @@ export class RendererTabManager {
this.botSettings = saved
? JSON.parse(saved)
: { token: '', groupId: '', userId: '' };
const savedProxy = localStorage.getItem('upstreamProxy');
this.upstreamProxy = savedProxy
? JSON.parse(savedProxy)
: { socks: '', user: '', pass: '' };
}
createTab(): string {
@@ -236,6 +242,11 @@ export class RendererTabManager {
localStorage.setItem('botSettings', JSON.stringify(this.botSettings));
}
saveUpstreamProxy(): void {
localStorage.setItem('upstreamProxy', JSON.stringify(this.upstreamProxy));
window.bridge.setUpstreamProxy(this.upstreamProxy);
}
toggleBot(): void {
if (!this.botSettings.token || !this.botSettings.groupId) return;
this.botRunning = !this.botRunning;