feat: 添加贡献内容更新服务,优化侧边栏贡献模式按钮及相关提示功能

This commit is contained in:
QLHazyCoder
2026-04-21 15:57:03 +08:00
parent d6ec25c570
commit 5c75d2e3aa
9 changed files with 676 additions and 61 deletions
@@ -5,10 +5,18 @@ const fs = require('node:fs');
test('sidepanel html keeps a single contribution mode button in header', () => {
const html = fs.readFileSync('sidepanel/sidepanel.html', 'utf8');
const matches = html.match(/id="btn-contribution-mode"/g) || [];
const serviceIndex = html.indexOf('<script src="contribution-content-update-service.js"></script>');
const sidepanelIndex = html.indexOf('<script src="sidepanel.js"></script>');
assert.equal(matches.length, 1);
assert.match(html, /id="btn-contribution-mode"[^>]*title="进入贡献模式并打开上传页"/);
assert.match(html, />贡献\/使用<\/button>/);
assert.match(html, /id="contribution-update-hint"/);
assert.match(html, /id="contribution-update-hint-text"/);
assert.match(html, /id="btn-dismiss-contribution-update-hint"/);
assert.notEqual(serviceIndex, -1);
assert.notEqual(sidepanelIndex, -1);
assert.ok(serviceIndex < sidepanelIndex);
});
test('sidepanel source no longer keeps the legacy upload-page handler on the header contribution button', () => {