From 6f7051d30b7a690e2e63ca0975c20dd1d1b04955 Mon Sep 17 00:00:00 2001 From: MoeFurina Date: Sat, 6 Jun 2026 15:56:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/public/index.html | 64 +++++++++++++++++++++++++++++++----- src/server/hook.js | 3 ++ 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/client/public/index.html b/src/client/public/index.html index 02cbe7f..62dc6a1 100644 --- a/src/client/public/index.html +++ b/src/client/public/index.html @@ -412,6 +412,25 @@ .modal-btn:active { transform: scale(0.98); } + + /* === 加密类型标签样式 === */ + .crypto-badge { + display: inline-block; + padding: 2px 8px; + border-radius: 4px; + font-size: 11px; + font-weight: 600; + letter-spacing: 0.3px; + margin-left: 6px; + vertical-align: middle; + line-height: 1.5; + } + .crypto-badge-eapi { background: #fce4e4; color: #C20C0C; border: 1px solid #f5c6c6; } + .crypto-badge-xeapi { background: #fef0db; color: #d35400; border: 1px solid #fde2b6; } + .crypto-badge-linuxapi { background: #dbeafe; color: #1a56db; border: 1px solid #bdd9fc; } + .crypto-badge-weapi { background: #d4edda; color: #1e7e34; border: 1px solid #b8dfc6; } + .crypto-badge-api { background: #e9ecef; color: #495057; border: 1px solid #ced4da; } + .crypto-badge-unknown { background: #f8f9fa; color: #adb5bd; border: 1px solid #dee2e6; } @@ -498,13 +517,16 @@ countEl.textContent = capturedData.length; - container.innerHTML = capturedData.map((item, index) => ` -
-
${escapeHtml(item.path)}
-
${formatTime(item.timestamp)}
-
- `).join(''); + container.innerHTML = capturedData.map((item, index) => { + const cryptoLabel = item.crypto ? getCryptoLabel(item.crypto) : ''; + return ` +
+
${escapeHtml(item.path)} ${cryptoLabel}
+
${formatTime(item.timestamp)}
+
+ `; + }).join(''); } function selectCapture(index) { @@ -524,11 +546,14 @@ } const filteredParam = filterParam(item.param); + const cryptoLabel = item.crypto ? getCryptoLabel(item.crypto) : ''; + const cryptoName = item.crypto ? getCryptoName(item.crypto) : ''; detailPanel.innerHTML = `

${escapeHtml(item.path)}

-
${formatTime(item.timestamp)}
+
${formatTime(item.timestamp)} ${cryptoLabel}
+ ${cryptoName ? `
加密方式: ${cryptoName}
` : ''}
@@ -607,6 +632,29 @@ return div.innerHTML; } + function getCryptoLabel(crypto) { + const names = { + eapi: 'EAPI', + xeapi: 'XEAPI', + linuxapi: 'LinuxAPI', + weapi: 'WEAPI', + api: 'API', + }; + const label = names[crypto] || (crypto ? crypto.toUpperCase() : ''); + return label ? `${label}` : ''; + } + + function getCryptoName(crypto) { + const names = { + eapi: 'EAPI (AES-128-ECB)', + xeapi: 'XEAPI (AES-128-ECB)', + linuxapi: 'LinuxAPI (AES-128-ECB)', + weapi: 'WEAPI (RSA + AES)', + api: 'API (未加密)', + }; + return names[crypto] || crypto || '未知'; + } + function fetchVersion() { fetch('/api/version') .then(response => response.json()) diff --git a/src/server/hook.js b/src/server/hook.js index c575237..b13665b 100644 --- a/src/server/hook.js +++ b/src/server/hook.js @@ -268,6 +268,7 @@ hook.request.before = (ctx) => { ) { req.headers['X-Real-IP'] = '118.88.88.88'; ctx.netease = { + crypto: url.path.startsWith('/weapi/') ? 'weapi' : 'api', web: true, path: url.path .replace(/^\/weapi\//, '/api/') @@ -327,6 +328,7 @@ hook.request.after = (ctx) => { const dataToSend = { timestamp: new Date().toISOString(), path: netease.path, + crypto: netease.crypto || null, param: netease.param, response: netease.jsonBody, statusCode: proxyRes.statusCode @@ -339,6 +341,7 @@ hook.request.after = (ctx) => { const dataToSend = { timestamp: new Date().toISOString(), path: netease.path, + crypto: netease.crypto || null, param: netease.param, response: null, statusCode: proxyRes.statusCode,