整体UI修改

This commit is contained in:
谢宇宁
2026-10-27 17:39:27 +07:00
parent 8cdbfee08f
commit e289658a28
99 changed files with 1227 additions and 4118 deletions
+11 -12
View File
@@ -10,31 +10,30 @@ async function moduleUrl(file,replace=code=>code){
return 'data:text/javascript;base64,'+Buffer.from(replace(outputText).replace(/(['"])\.\.\/routing\1/g,JSON.stringify(routingModuleUrl))+'\n//# sourceURL='+filename.pathname).toString('base64');
}
const protocolUrl=await moduleUrl('../src/lib/api/protocol.ts');
const siteUrl=await moduleUrl('../src/lib/site.ts');
const renderUrl=await moduleUrl('../src/lib/client/render.ts',code=>code.replace('"../api/protocol"',JSON.stringify(protocolUrl)));
const detailUrl=await moduleUrl('../src/lib/client/detail.ts',code=>code.replace('"../api/protocol"',JSON.stringify(protocolUrl)).replace('"./render"',JSON.stringify(renderUrl)));
const detailUrl=await moduleUrl('../src/lib/client/detail.ts',code=>code.replace('"../api/protocol"',JSON.stringify(protocolUrl)).replace('"./render"',JSON.stringify(renderUrl)).replace("'../site'",JSON.stringify(siteUrl)));
const {overviewMarkup,officialLinks,bindSeriesDescription,detailActionIcon}=await import(detailUrl);
test('overview retains API data, encrypted image loading and real chapter links in the original layout',()=>{
test('overview exposes H1, labelled facts, linked genres, synopsis heading and real chapter links',()=>{
const html=overviewMarkup({id:23456,title:'剧名 <script>',coverImg:'https://cdn.example/encrypted.webp',description:'真实简介 <img onerror=alert(1)>',themeNames:['古装','爱情'],isNew:true,countCollect:23000,countLike:100,heatValue:999},{id:90042,currentEpisode:1},'<div class="play-detail-actions">actions</div>');
assert.ok(html.includes('剧名 &lt;script&gt;'));assert.ok(!html.includes('<script>'));
assert.ok(html.includes('真实简介 &lt;img onerror=alert(1)&gt;'));assert.ok(html.includes('古装 · 爱情'));
assert.ok(html.includes('真实简介 &lt;img onerror=alert(1)&gt;'));assert.ok(html.includes('<dt>类型</dt>'));assert.ok(html.includes('<span>古装</span><span>爱情</span>'));assert.ok(html.includes('<dt>集数</dt>'));
assert.ok(html.includes('data-src="https://cdn.example/encrypted.webp"'));assert.ok(!/\ssrc="https:\/\/cdn\.example/.test(html));
assert.ok(html.includes('href="/play/23456/90042/"'));assert.ok(html.includes('series-badge--new'));
assert.ok(html.includes('<div class="series-action-bar"><div class="series-actions">'));
assert.ok(html.includes('href="/play/23456/90042/"'));assert.ok(html.includes('hg-detail-badge--new'));assert.ok(html.includes('<h1 id="play-detail-title">剧名 &lt;script&gt;</h1>'));assert.ok(html.includes('《剧名 &lt;script&gt;》剧情简介</h2>'));assert.ok(html.includes('alt="《剧名 &lt;script&gt;》海报"'));
assert.ok(html.includes('<div class="play-detail-actions">actions</div>'));
assert.ok(html.includes('aria-controls="series-description-text"'));assert.ok(html.includes('data-app-download-entry'));
assert.ok(!overviewMarkup({id:7,title:'无章节'},undefined,'').includes('href="/play/'));
});
test('official links use configured safe URLs and retain the original feedback entrance',()=>{
const html=officialLinks({config:{newUrlAddr:'https://entry.example',foreverUrlAddr:'https://permanent.example',tgGroup:'https://t.me/example',telegram:'https://contact.example'}});
for(const url of ['https://entry.example/','https://permanent.example/','https://t.me/example','https://contact.example/'])assert.ok(html.includes(`href="${url}"`));
const fallback=officialLinks({config:{newUrlAddr:'javascript:alert(1)',tgGroup:'javascript:alert(1)'},navPageList:[{line:1,url:'https://backup.example'}]});
assert.ok(fallback.includes('href="https://backup.example/"'));assert.ok(fallback.includes('href="/info/feedback/"'));assert.ok(!fallback.includes('javascript:'));
assert.ok(!fallback.includes('huangguo.me'));assert.ok(!fallback.includes('huangguo.tv'));
test('official links show only the site domain and the official TG, ignoring configured mirrors and contacts',()=>{
const html=officialLinks();
assert.ok(html.includes('href="https://huangguocg.com/"'));assert.ok(html.includes('官方TG:'));assert.ok(html.includes('href="https://t.me/jbd125"'));assert.ok(html.includes('>@jbd125</a>'));
for(const text of ['官方客服','Telegram 群','javascript:'])assert.ok(!html.includes(text),text);
});
test('original action SVGs remain accessible and inherit the active colors',()=>{
for(const kind of ['like','save','share','feedback']){
for(const kind of ['like','save','share']){
const html=detailActionIcon(kind);assert.match(html,/<svg class="play-action-icon"/);assert.match(html,/aria-hidden="true"/);assert.ok(html.includes('<path d="'));
}
});