完善脚本
This commit is contained in:
1 parent
9d9509a26b
commit
0c740f5a53
9 files changed
+1176
-212
No files matched your search
@@ -126,6 +126,7 @@
|
||||
<div class="panel">
|
||||
<h3>手动巡检</h3>
|
||||
<button class="primary" type="button" id="btnInspectNow" style="width:100%;margin-bottom:14px">立即巡检(探测删失效 → 不足则批量注册)</button>
|
||||
<button class="ghost" type="button" id="btnSweepFailedNow" style="width:100%;margin-bottom:14px">立即按失败阈值清理(/usage → /auth-files)</button>
|
||||
<label>单次批量注册数量</label>
|
||||
<input type="number" id="manualCount" min="1" max="500" value="20" />
|
||||
<div id="manualCpaWrap">
|
||||
@@ -196,6 +197,14 @@
|
||||
<input type="password" id="cfgClipKey" autocomplete="new-password" placeholder="留空表示不修改已保存的密钥" />
|
||||
<label>探测超时(秒)</label>
|
||||
<input type="number" id="cfgClipTimeout" min="5" max="120" value="30" />
|
||||
<label>失效清理阈值(连续失败次数)</label>
|
||||
<input type="number" id="cfgSweepThreshold" min="1" max="20" value="3" />
|
||||
<label>失效清理模式</label>
|
||||
<select id="cfgSweepMode">
|
||||
<option value="delete">delete(实际删除)</option>
|
||||
<option value="observe">observe(仅观察)</option>
|
||||
</select>
|
||||
<div class="row"><input type="checkbox" id="cfgSweepNameFallback" checked /><label for="cfgSweepNameFallback" style="margin:0">启用 name 回退匹配</label></div>
|
||||
<button class="primary" type="button" id="saveCliproxy">保存 Cliproxy 设置</button>
|
||||
</div>
|
||||
<div class="panel">
|
||||
@@ -297,6 +306,9 @@
|
||||
$('cfgStatsOauthDir').value = st.codex_stats_oauth_dir || '';
|
||||
$('cfgClipBase').value = st.cliproxy_management_base || '';
|
||||
$('cfgClipTimeout').value = st.cliproxy_probe_timeout_sec || '30';
|
||||
$('cfgSweepThreshold').value = st.cliproxy_sweeper_threshold || '3';
|
||||
$('cfgSweepMode').value = st.cliproxy_sweeper_run_mode || 'delete';
|
||||
$('cfgSweepNameFallback').checked = (st.cliproxy_sweeper_allow_name_fallback || '1') === '1';
|
||||
$('cfgClipKey').value = '';
|
||||
$('cfgClipKey').placeholder = st.cliproxy_management_key_set ? '已保存密钥(留空不改)' : '必填';
|
||||
}
|
||||
@@ -472,6 +484,9 @@
|
||||
codex_stats_oauth_dir: $('cfgStatsOauthDir').value.trim(),
|
||||
cliproxy_management_base: $('cfgClipBase').value.trim(),
|
||||
cliproxy_probe_timeout_sec: $('cfgClipTimeout').value,
|
||||
cliproxy_sweeper_threshold: $('cfgSweepThreshold').value,
|
||||
cliproxy_sweeper_run_mode: $('cfgSweepMode').value,
|
||||
cliproxy_sweeper_allow_name_fallback: $('cfgSweepNameFallback').checked ? '1' : '0',
|
||||
};
|
||||
const k = $('cfgClipKey').value;
|
||||
if (k) body.cliproxy_management_key = k;
|
||||
@@ -489,6 +504,16 @@
|
||||
toast(j.message || '已排队');
|
||||
refreshData();
|
||||
};
|
||||
$('btnSweepFailedNow').onclick = async () => {
|
||||
const r = await api('/api/tasks/sweep-failed-now', { method: 'POST', body: '{}' });
|
||||
if (!r) return;
|
||||
const j = await r.json().catch(() => ({}));
|
||||
if (r.status === 400) { toast(j.error || '配置不全'); return; }
|
||||
if (r.status === 409) { toast(j.error || '忙'); return; }
|
||||
if (!r.ok) { toast(j.error || '失败'); return; }
|
||||
toast(j.message || '清理任务已排队');
|
||||
refreshData();
|
||||
};
|
||||
$('btnManual').onclick = async () => {
|
||||
const r = await api('/api/tasks/manual', { method: 'POST', body: JSON.stringify({
|
||||
cpa_id: parseInt($('manualCpa').value, 10),
|
||||
|
||||
Reference in new issue
Block a user