fix: remove default kiro.rs admin URL

This commit is contained in:
QLHazyCoder
2026-05-19 03:22:14 +08:00
parent 5ddb5ac94d
commit a3c36e6f15
8 changed files with 20 additions and 21 deletions
+2 -6
View File
@@ -913,7 +913,7 @@ const PERSISTED_SETTING_DEFAULTS = {
panelMode: 'cpa', panelMode: 'cpa',
activeFlowId: DEFAULT_ACTIVE_FLOW_ID, activeFlowId: DEFAULT_ACTIVE_FLOW_ID,
kiroTargetId: 'kiro-rs', kiroTargetId: 'kiro-rs',
kiroRsUrl: self.MultiPageFlowRegistry?.DEFAULT_KIRO_RS_URL || 'https://kiro.leftcode.xyz/admin', kiroRsUrl: String(self.MultiPageFlowRegistry?.DEFAULT_KIRO_RS_URL || '').trim(),
kiroRsKey: '', kiroRsKey: '',
vpsUrl: '', vpsUrl: '',
vpsPassword: '', vpsPassword: '',
@@ -2769,11 +2769,7 @@ function normalizePersistentSettingValue(key, value) {
} }
return String(value || '').trim().toLowerCase() === 'kiro-rs' ? 'kiro-rs' : 'kiro-rs'; return String(value || '').trim().toLowerCase() === 'kiro-rs' ? 'kiro-rs' : 'kiro-rs';
case 'kiroRsUrl': case 'kiroRsUrl':
return String( return String(value || '').trim();
value
|| self.MultiPageFlowRegistry?.DEFAULT_KIRO_RS_URL
|| 'https://kiro.leftcode.xyz/admin'
).trim() || 'https://kiro.leftcode.xyz/admin';
case 'kiroRsKey': case 'kiroRsKey':
return String(value || '').trim(); return String(value || '').trim();
case 'vpsUrl': case 'vpsUrl':
+1 -1
View File
@@ -5,7 +5,7 @@
const DEFAULT_OPENAI_TARGET_ID = 'cpa'; const DEFAULT_OPENAI_TARGET_ID = 'cpa';
const DEFAULT_KIRO_TARGET_ID = 'kiro-rs'; const DEFAULT_KIRO_TARGET_ID = 'kiro-rs';
const DEFAULT_KIRO_PUBLICATION_TARGET_ID = 'kiro-rs'; const DEFAULT_KIRO_PUBLICATION_TARGET_ID = 'kiro-rs';
const DEFAULT_KIRO_RS_URL = 'https://kiro.leftcode.xyz/admin'; const DEFAULT_KIRO_RS_URL = '';
const OPENAI_TARGET_IDS = Object.freeze(['cpa', 'sub2api', 'codex2api']); const OPENAI_TARGET_IDS = Object.freeze(['cpa', 'sub2api', 'codex2api']);
const SHARED_SERVICE_IDS = Object.freeze(['account', 'email', 'proxy']); const SHARED_SERVICE_IDS = Object.freeze(['account', 'email', 'proxy']);
+1 -1
View File
@@ -37,7 +37,7 @@
).trim().toLowerCase() || 'openai'; ).trim().toLowerCase() || 'openai';
const defaultOpenAiTargetId = flowRegistry.DEFAULT_OPENAI_TARGET_ID || 'cpa'; const defaultOpenAiTargetId = flowRegistry.DEFAULT_OPENAI_TARGET_ID || 'cpa';
const defaultKiroTargetId = flowRegistry.DEFAULT_KIRO_TARGET_ID || 'kiro-rs'; const defaultKiroTargetId = flowRegistry.DEFAULT_KIRO_TARGET_ID || 'kiro-rs';
const defaultKiroRsUrl = flowRegistry.DEFAULT_KIRO_RS_URL || 'https://kiro.leftcode.xyz/admin'; const defaultKiroRsUrl = String(flowRegistry.DEFAULT_KIRO_RS_URL || '').trim();
const normalizeFlowId = typeof flowRegistry.normalizeFlowId === 'function' const normalizeFlowId = typeof flowRegistry.normalizeFlowId === 'function'
? flowRegistry.normalizeFlowId ? flowRegistry.normalizeFlowId
: ((value = '', fallback = defaultFlowId) => { : ((value = '', fallback = defaultFlowId) => {
+5 -2
View File
@@ -243,8 +243,11 @@
</div> </div>
<div class="data-row" id="row-kiro-rs-url" style="display:none;"> <div class="data-row" id="row-kiro-rs-url" style="display:none;">
<span class="data-label">kiro.rs</span> <span class="data-label">kiro.rs</span>
<input type="text" id="input-kiro-rs-url" class="data-input" <div class="data-inline">
placeholder="https://kiro.leftcode.xyz/admin" /> <input type="text" id="input-kiro-rs-url" class="data-input"
placeholder="请输入 kiro.rs 管理地址" />
<button id="btn-open-kiro-rs-github" class="btn btn-ghost btn-xs data-inline-btn" type="button">GitHub</button>
</div>
</div> </div>
<div class="data-row" id="row-kiro-rs-key" style="display:none;"> <div class="data-row" id="row-kiro-rs-key" style="display:none;">
<span class="data-label">API Key</span> <span class="data-label">API Key</span>
+7 -8
View File
@@ -173,6 +173,7 @@ const rowCodex2ApiAdminKey = document.getElementById('row-codex2api-admin-key');
const inputCodex2ApiAdminKey = document.getElementById('input-codex2api-admin-key'); const inputCodex2ApiAdminKey = document.getElementById('input-codex2api-admin-key');
const rowKiroRsUrl = document.getElementById('row-kiro-rs-url'); const rowKiroRsUrl = document.getElementById('row-kiro-rs-url');
const inputKiroRsUrl = document.getElementById('input-kiro-rs-url'); const inputKiroRsUrl = document.getElementById('input-kiro-rs-url');
const btnOpenKiroRsGithub = document.getElementById('btn-open-kiro-rs-github');
const rowKiroRsKey = document.getElementById('row-kiro-rs-key'); const rowKiroRsKey = document.getElementById('row-kiro-rs-key');
const inputKiroRsKey = document.getElementById('input-kiro-rs-key'); const inputKiroRsKey = document.getElementById('input-kiro-rs-key');
const btnTestKiroRs = document.getElementById('btn-test-kiro-rs'); const btnTestKiroRs = document.getElementById('btn-test-kiro-rs');
@@ -4256,9 +4257,7 @@ function collectSettingsPayload() {
return Number.isSafeInteger(numeric) && numeric >= 1 ? numeric : 1; return Number.isSafeInteger(numeric) && numeric >= 1 ? numeric : 1;
}); });
const flowRegistryApi = typeof getFlowRegistry === 'function' ? getFlowRegistry() : null; const flowRegistryApi = typeof getFlowRegistry === 'function' ? getFlowRegistry() : null;
const defaultKiroRsUrl = String( const defaultKiroRsUrl = String(flowRegistryApi?.DEFAULT_KIRO_RS_URL || '').trim();
flowRegistryApi?.DEFAULT_KIRO_RS_URL || 'https://kiro.leftcode.xyz/admin'
).trim() || 'https://kiro.leftcode.xyz/admin';
const normalizeKiroTargetIdSafe = typeof normalizeTargetIdForFlow === 'function' const normalizeKiroTargetIdSafe = typeof normalizeTargetIdForFlow === 'function'
? normalizeTargetIdForFlow ? normalizeTargetIdForFlow
: ((_flowId, targetId = '', fallback = 'kiro-rs') => { : ((_flowId, targetId = '', fallback = 'kiro-rs') => {
@@ -10034,11 +10033,7 @@ function applySettingsState(state) {
} }
inputSub2ApiDefaultProxy.value = state?.sub2apiDefaultProxyName || ''; inputSub2ApiDefaultProxy.value = state?.sub2apiDefaultProxyName || '';
if (typeof inputKiroRsUrl !== 'undefined' && inputKiroRsUrl) { if (typeof inputKiroRsUrl !== 'undefined' && inputKiroRsUrl) {
inputKiroRsUrl.value = String( inputKiroRsUrl.value = String(state?.kiroRsUrl || '').trim();
state?.kiroRsUrl
|| getFlowRegistry()?.DEFAULT_KIRO_RS_URL
|| 'https://kiro.leftcode.xyz/admin'
).trim();
} }
if (typeof inputKiroRsKey !== 'undefined' && inputKiroRsKey) { if (typeof inputKiroRsKey !== 'undefined' && inputKiroRsKey) {
inputKiroRsKey.value = String(state?.kiroRsKey || ''); inputKiroRsKey.value = String(state?.kiroRsKey || '');
@@ -13893,6 +13888,10 @@ btnGpcHelperConvertApiKey?.addEventListener('click', () => {
openExternalUrl(GPC_HELPER_PORTAL_URL); openExternalUrl(GPC_HELPER_PORTAL_URL);
}); });
btnOpenKiroRsGithub?.addEventListener('click', () => {
openExternalUrl('https://github.com/hank9999/kiro.rs');
});
btnGpcHelperBalance?.addEventListener('click', async () => { btnGpcHelperBalance?.addEventListener('click', async () => {
try { try {
const response = await chrome.runtime.sendMessage({ const response = await chrome.runtime.sendMessage({
@@ -134,7 +134,7 @@ const FIVE_SIM_SUPPORTED_COUNTRY_ID_SET = new Set(['indonesia', 'thailand', 'vie
const HERO_SMS_SUPPORTED_COUNTRY_ID_SET = new Set(['6', '52', '10']); const HERO_SMS_SUPPORTED_COUNTRY_ID_SET = new Set(['6', '52', '10']);
const self = { const self = {
MultiPageFlowRegistry: { MultiPageFlowRegistry: {
DEFAULT_KIRO_RS_URL: 'https://kiro.leftcode.xyz/admin', DEFAULT_KIRO_RS_URL: '',
normalizeFlowId(value, fallback = 'openai') { normalizeFlowId(value, fallback = 'openai') {
const normalized = String(value || '').trim().toLowerCase(); const normalized = String(value || '').trim().toLowerCase();
if (normalized === 'kiro') { if (normalized === 'kiro') {
@@ -277,7 +277,7 @@ return {
assert.equal(api.normalizePersistentSettingValue('activeFlowId', 'codex'), 'openai'); assert.equal(api.normalizePersistentSettingValue('activeFlowId', 'codex'), 'openai');
assert.equal(api.normalizePersistentSettingValue('activeFlowId', 'kiro'), 'kiro'); assert.equal(api.normalizePersistentSettingValue('activeFlowId', 'kiro'), 'kiro');
assert.equal(api.normalizePersistentSettingValue('kiroTargetId', 'unknown'), 'kiro-rs'); assert.equal(api.normalizePersistentSettingValue('kiroTargetId', 'unknown'), 'kiro-rs');
assert.equal(api.normalizePersistentSettingValue('kiroRsUrl', ''), 'https://kiro.leftcode.xyz/admin'); assert.equal(api.normalizePersistentSettingValue('kiroRsUrl', ''), '');
assert.equal(api.normalizePersistentSettingValue('kiroRsKey', ' key-1 '), 'key-1'); assert.equal(api.normalizePersistentSettingValue('kiroRsKey', ' key-1 '), 'key-1');
assert.equal(api.normalizePersistentSettingValue('phoneSmsProvider', '5SIM'), '5sim'); assert.equal(api.normalizePersistentSettingValue('phoneSmsProvider', '5SIM'), '5sim');
assert.equal(api.normalizePersistentSettingValue('phoneSmsProvider', 'NEXSMS'), 'nexsms'); assert.equal(api.normalizePersistentSettingValue('phoneSmsProvider', 'NEXSMS'), 'nexsms');
@@ -101,7 +101,7 @@ const PERSISTED_SETTING_DEFAULTS = {
ipProxyService: '711proxy', ipProxyService: '711proxy',
ipProxyMode: 'account', ipProxyMode: 'account',
kiroTargetId: 'kiro-rs', kiroTargetId: 'kiro-rs',
kiroRsUrl: 'https://kiro.leftcode.xyz/admin', kiroRsUrl: '',
kiroRsKey: '', kiroRsKey: '',
stepExecutionRangeByFlow: {}, stepExecutionRangeByFlow: {},
}; };
@@ -39,6 +39,7 @@ test('sidepanel html exposes flow selector and kiro source fields', () => {
'id="label-source-selector"', 'id="label-source-selector"',
'id="row-step6-cookie-settings"', 'id="row-step6-cookie-settings"',
'id="row-kiro-rs-url"', 'id="row-kiro-rs-url"',
'id="btn-open-kiro-rs-github"',
'id="row-kiro-rs-key"', 'id="row-kiro-rs-key"',
'id="btn-test-kiro-rs"', 'id="btn-test-kiro-rs"',
'id="row-kiro-rs-test-status"', 'id="row-kiro-rs-test-status"',