feat: 更新贡献上传URL逻辑,优化上传页面打开功能并更新相关测试用例

This commit is contained in:
QLHazyCoder
2026-04-21 12:40:26 +08:00
parent 239120c983
commit d85f7feaef
5 changed files with 25 additions and 7 deletions
+19 -2
View File
@@ -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');
}
+1 -1
View File
@@ -35,7 +35,7 @@
<div class="header-btns">
<div class="run-group">
<button id="btn-contribution-mode" class="btn btn-outline btn-sm btn-contribution-mode" type="button"
aria-pressed="false" title="进入贡献模式">贡献/使用</button>
aria-pressed="false" title="进入贡献模式并打开上传页">贡献/使用</button>
<input type="number" id="input-run-count" class="run-count-input" value="1" min="1" max="50" title="运行次数" />
<button id="btn-auto-run" class="btn btn-success" title="自动执行全部步骤">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
+1 -1
View File
@@ -3271,7 +3271,7 @@ const contributionModeManager = window.SidepanelContributionMode?.createContribu
},
constants: {
contributionOauthUrl: 'https://apikey.qzz.io/oauth/',
contributionUploadUrl: 'https://apikey.qzz.io/',
contributionUploadUrl: 'https://apikey.qzz.io',
},
});
const renderContributionMode = contributionModeManager?.render