From d85f7feaef7d9f386a88a2d81646867d6702b9f7 Mon Sep 17 00:00:00 2001 From: QLHazyCoder <2825305047@qq.com> Date: Tue, 21 Apr 2026 12:40:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0URL=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=B8=8A=E4=BC=A0=E9=A1=B5=E9=9D=A2=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sidepanel/contribution-mode.js | 21 +++++++++++++++++++-- sidepanel/sidepanel.html | 2 +- sidepanel/sidepanel.js | 2 +- tests/sidepanel-contribution-button.test.js | 2 +- tests/sidepanel-contribution-mode.test.js | 5 +++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sidepanel/contribution-mode.js b/sidepanel/contribution-mode.js index 0a9d6b0..50aedf7 100644 --- a/sidepanel/contribution-mode.js +++ b/sidepanel/contribution-mode.js @@ -12,7 +12,7 @@ constants = {}, } = context; - const contributionUploadUrl = constants.contributionUploadUrl || 'https://apikey.qzz.io/'; + const contributionUploadUrl = constants.contributionUploadUrl || 'https://apikey.qzz.io'; const pollIntervalMs = Math.max(1500, Math.floor(Number(constants.pollIntervalMs) || 2500)); const hiddenRows = [ @@ -173,6 +173,18 @@ return normalizeString(currentState.contributionStatusMessage) || DEFAULT_COPY; } + function getContributionUploadPageUrl() { + return normalizeString(contributionUploadUrl); + } + + function openContributionUploadPage() { + const targetUrl = getContributionUploadPageUrl(); + if (!targetUrl) { + return; + } + helpers.openExternalUrl?.(targetUrl); + } + async function syncContributionProfile(partial = {}) { const payload = { nickname: normalizeString(partial.nickname), @@ -360,6 +372,11 @@ return; } actionInFlight = true; + try { + openContributionUploadPage(); + } catch (error) { + helpers.showToast?.(`打开上传页面失败:${error.message}`, 'error'); + } render(); try { await enterContributionMode(); @@ -415,7 +432,7 @@ dom.btnOpenContributionUpload?.addEventListener('click', () => { try { - helpers.openExternalUrl?.(contributionUploadUrl); + openContributionUploadPage(); } catch (error) { helpers.showToast?.(`打开上传页面失败:${error.message}`, 'error'); } diff --git a/sidepanel/sidepanel.html b/sidepanel/sidepanel.html index a4dd03f..1d75231 100644 --- a/sidepanel/sidepanel.html +++ b/sidepanel/sidepanel.html @@ -35,7 +35,7 @@