fix: skip SUB2API proxy when default proxy is empty

This commit is contained in:
Q3CC
2026-04-18 18:40:38 +08:00
parent 82471af931
commit b5f2ecb99c
7 changed files with 94 additions and 33 deletions
+3 -2
View File
@@ -141,7 +141,7 @@ const SUB2API_STEP1_RESPONSE_TIMEOUT_MS = 90000;
const SUB2API_STEP9_RESPONSE_TIMEOUT_MS = 120000;
const DEFAULT_SUB2API_URL = 'https://sub2api.hisence.fun/admin/accounts';
const DEFAULT_SUB2API_GROUP_NAME = 'codex';
const DEFAULT_SUB2API_PROXY_NAME = 'shadowrocket';
const DEFAULT_SUB2API_PROXY_NAME = '';
const DEFAULT_SUB2API_REDIRECT_URI = 'http://localhost:1455/auth/callback';
const AUTO_RUN_TIMER_ALARM_NAME = 'auto-run-timer';
const AUTO_RUN_TIMER_KIND_SCHEDULED_START = 'scheduled_start';
@@ -832,7 +832,7 @@ function normalizePersistentSettingValue(key, value) {
case 'sub2apiGroupName':
return String(value || '').trim();
case 'sub2apiDefaultProxyName':
return String(value || '').trim() || DEFAULT_SUB2API_PROXY_NAME;
return String(value || '').trim();
case 'customPassword':
return String(value || '');
case 'autoRunSkipFailures':
@@ -4619,6 +4619,7 @@ async function handleStepData(step, payload) {
if (payload.sub2apiOAuthState !== undefined) updates.sub2apiOAuthState = payload.sub2apiOAuthState || null;
if (payload.sub2apiGroupId !== undefined) updates.sub2apiGroupId = payload.sub2apiGroupId || null;
if (payload.sub2apiDraftName !== undefined) updates.sub2apiDraftName = payload.sub2apiDraftName || null;
if (payload.sub2apiProxyId !== undefined) updates.sub2apiProxyId = payload.sub2apiProxyId || null;
if (Object.keys(updates).length) {
await setState(updates);
}