From edbf3623e1b0e2a7102a79aecf98574eed846e0b Mon Sep 17 00:00:00 2001 From: nyoung Date: Thu, 8 Oct 2026 15:13:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E6=8E=A7=E5=88=B6=E5=8F=B0=20Tu?= =?UTF-8?q?rnstile=20=E4=B8=8E=E4=BB=A3=E7=90=86=E7=BA=BF=E8=B7=AF?= =?UTF-8?q?=E9=A1=B5=E9=87=8D=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turnstile 页: - 三种 Token 获取方式收进「Token 获取方式」一张卡,分段按钮切换字段区, Sitekey / Action 归入方式 1 字段区(全局兜底,浏览器求解共用) - 「Cookie 池预热」与「Cookie 池」合并为一张卡;「求解参数」瘦身为 「求解超时与重试」,只在方式 1/2 显示 - 求解恒开启,不再提供关闭开关(保存固定 enabled=true),manual 方式下 停掉 Cookie 池 5s 轮询 代理线路页: - 顶部加「基础线路 / 代理池」页签分组,页签状态跨重渲染保留 - 「降级策略」改名「限流与故障切换」;原「代理池 · Xray 核心」大杂烩卡 拆为「代理池 · 基础」与「Xray 核心」两张,各带同一提交逻辑的保存按钮 --- internal/admin/web/app.js | 319 ++++++++++++++++++++--------------- internal/admin/web/style.css | 8 +- 2 files changed, 187 insertions(+), 140 deletions(-) diff --git a/internal/admin/web/app.js b/internal/admin/web/app.js index 2524a4e..83628de 100644 --- a/internal/admin/web/app.js +++ b/internal/admin/web/app.js @@ -13,6 +13,7 @@ const TITLES = { let overviewTimer = null; let logStop = null; let lastOverview = null; +let pxMode = "basic"; // 代理线路页签:basic=基础线路 pool=代理池,重渲染后保留 /* ── helpers ─────────────────────────────────────────────── */ function toast(msg, kind) { @@ -56,7 +57,9 @@ const fmtBytes = n => n > 1048576 ? (n / 1048576).toFixed(1) + "MB" : n > 1024 ? const timeStr = t => new Date(t).toLocaleTimeString("zh-CN", { hour12: false }); function switchHTML(id, checked) { - return ``; + // id 可能含模型名/站点码等配置里的任意字符,必须转义,否则闭合属性后 + // 会把后面的 checked/span 拆成攻击者可控的标记。 + return ``; } /* ── auth ────────────────────────────────────────────────── */ @@ -330,75 +333,92 @@ PAGES.proxy = async () => { const p = ov.proxy; const pool = ov.proxypool || { xray: {}, entries: [], subscriptions: [], sticky: {} }; view.innerHTML = ` -
-

主线路

-
-
- - -
-
支持 http:// · https:// · socks5://
-
-

降级策略

-
-
-
-
-
-
-
${switchHTML("px-cross", p.cross_site_failover)}
- -
-
主线路在 slow-start 内无首事件,或输出内容前失败时,自动切换到备用线路。
+
+

出站线路

+
+ +
-

备用线路

-
-
#地址
-
当前生效顺序:${ov.cache.routes.map(r => `${esc(r.name)} → ${esc(r.proxy)}`).join(" ")}
+
+ +
+
+

主线路

+
+
+ + +
+
支持 http:// · https:// · socks5://
+
+

限流与故障切换

+
+
+
+
+
+
+
${switchHTML("px-cross", p.cross_site_failover)}
+ +
+
主线路在 slow-start 内无首事件,或输出内容前失败时,自动切换到备用线路。
+
+
+

备用线路

+
+
#地址
+
当前生效顺序:${ov.cache.routes.map(r => `${esc(r.name)} → ${esc(r.proxy)}`).join(" ")}
+
-
-

代理池 · Xray 核心

-
-
${switchHTML("pool-en", pool.enabled)}
-
-
+ +