整体UI修改
This commit is contained in:
@@ -4,7 +4,7 @@ import {readFile} from 'node:fs/promises';
|
||||
import ts from 'typescript';
|
||||
import {seo,structuredData,clientSeo,headDocument} from './helpers/seo.mjs';
|
||||
|
||||
const origin='https://drama.example.net';
|
||||
const origin='https://huangguocg.com';
|
||||
const environment=seo.seoEnvironment({seoInfo:{webSiteName:'91剧场',description:'本站介绍'},config:{foreverUrlAddr:origin,tgGroup:'https://t.me/official',twitterAddr:'https://x.com/official',telegram:'javascript:bad'}});
|
||||
const head=(path,content={},search='')=>seo.buildPageHead(path,search,environment,content);
|
||||
const nodes=(page,type)=>page.jsonLd?.['@graph'].filter(node=>node['@type']===type)||[];
|
||||
@@ -21,7 +21,7 @@ test('home schema uses this site, actual assets, configured official profiles an
|
||||
const organization=nodes(page,'Organization')[0],website=nodes(page,'WebSite')[0];
|
||||
assert.equal(organization.name,'91剧场');assert.equal(organization.url,origin+'/');
|
||||
assert.equal(organization.logo.url,origin+'/apple-touch-icon.png');assert.equal(organization.logo.width,180);
|
||||
assert.deepEqual(organization.sameAs,['https://x.com/official','https://t.me/official']);
|
||||
assert.deepEqual(organization.sameAs,['https://t.me/jbd125']);
|
||||
assert.equal(website.publisher['@id'],organization['@id']);assert.equal(website.description,'本站介绍');
|
||||
assert.equal(nodes(page,'BreadcrumbList').length,0);
|
||||
const items=nodes(page,'ItemList')[0];assert.equal(items.numberOfItems,4);
|
||||
@@ -53,13 +53,13 @@ test('detail describes the series; episode watch pages connect TVEpisode and Vid
|
||||
assert.equal(paged.robots,'noindex,follow');assert.equal(paged.jsonLd,undefined);
|
||||
});
|
||||
|
||||
test('missing media data and invalid dates do not produce fabricated VideoObject fields or leak locked playback URLs',()=>{
|
||||
test('missing media data and invalid dates do not produce fabricated VideoObject fields, and payment flags never hide a supplied source',()=>{
|
||||
for(const patch of [{onlineAt:undefined},{onlineAt:'0001-01-01'},{onlineAt:'not-a-date'},{cover:''},{cover:'javascript:bad'}]){
|
||||
const page=head('/play/9/90/',seo.dramaSeoContent({...drama,...patch},chapter));
|
||||
assert.equal(nodes(page,'VideoObject').length,0);assert.equal(nodes(page,'TVEpisode').length,1);
|
||||
}
|
||||
const locked=head('/play/9/90/',seo.dramaSeoContent(drama,{...chapter,canWatch:false,needUnlock:true}));
|
||||
assert.equal(locked.robots,'noindex,follow');assert.equal(locked.jsonLd,undefined);
|
||||
assert.ok(locked.robots.startsWith('index,'));assert.equal(nodes(locked,'VideoObject').length,1);
|
||||
const earlier=head('/play/9/90/',seo.dramaSeoContent({...drama,mediaUpdatedAt:'2025-10-17 01:00:00'},chapter));
|
||||
assert.equal(nodes(earlier,'VideoObject')[0].dateModified,undefined);
|
||||
const missingName=head('/play/9/90/',seo.dramaSeoContent({...drama,title:''},chapter));assert.equal(nodes(missingName,'VideoObject').length,0);
|
||||
@@ -69,13 +69,12 @@ test('missing media data and invalid dates do not produce fabricated VideoObject
|
||||
assert.equal(structuredData.schemaDate('2024/02/29'),'2024-02-29T00:00:00+08:00');
|
||||
});
|
||||
|
||||
test('paywalled playable chapters identify the restricted region and normalize canonical media IDs',()=>{
|
||||
test('all chapters are marked free and normalize canonical media IDs',()=>{
|
||||
const paid=head('/play/009/090/',seo.dramaSeoContent(drama,{...chapter,payType:1}));
|
||||
const page=nodes(paid,'WebPage')[0],video=nodes(paid,'VideoObject')[0],episode=nodes(paid,'TVEpisode')[0];
|
||||
assert.equal(paid.canonical,origin+'/play/9/90/');
|
||||
assert.equal(page.isAccessibleForFree,false);
|
||||
assert.deepEqual(page.hasPart,{'@type':'WebPageElement',isAccessibleForFree:false,cssSelector:'.play-paywalled-content'});
|
||||
assert.equal(video.isAccessibleForFree,false);assert.equal(episode.isAccessibleForFree,false);
|
||||
assert.equal(page.isAccessibleForFree,undefined);assert.equal(page.hasPart,undefined);
|
||||
assert.equal(video.isAccessibleForFree,true);assert.equal(episode.isAccessibleForFree,true);
|
||||
assert.equal(video['@id'],origin+'/play/9/90/#video');assert.equal(episode.url,paid.canonical);
|
||||
const hashed=head('/play/9/90/',seo.dramaSeoContent(drama,{...chapter,videoUrl:'signed/media.m3u8?token=a%2Fb'}));
|
||||
assert.equal(nodes(hashed,'VideoObject')[0].contentUrl,origin+'/h5/m3u8/signed/media.m3u8?token=a%2Fb');
|
||||
@@ -89,11 +88,11 @@ test('removed standalone video routes have no canonical or structured data',()=>
|
||||
});
|
||||
|
||||
test('about and FAQ use visible local content, while private/search/tools/failed pages output no graph',async()=>{
|
||||
const code=ts.transpileModule(await readFile(new URL('../src/lib/info-pages.ts',import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.ESNext,target:ts.ScriptTarget.ES2022}}).outputText;
|
||||
const code=ts.transpileModule(await readFile(new URL('../src/lib/info-pages.ts',import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.ESNext,target:ts.ScriptTarget.ES2022}}).outputText.replace('"./site"',JSON.stringify('data:text/javascript;base64,'+Buffer.from(ts.transpileModule(await readFile(new URL('../src/lib/site.ts',import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.ESNext,target:ts.ScriptTarget.ES2022}}).outputText).toString('base64')));
|
||||
const info=await import('data:text/javascript;base64,'+Buffer.from(code).toString('base64'));
|
||||
const about=head('/info/about-us/',seo.infoSeoContent(info.getInfoPage('about-us')));assert.equal(nodes(about,'AboutPage').length,1);
|
||||
const faqPage=info.getInfoPage('help-center'),content=seo.infoSeoContent(faqPage),page=head('/info/help-center/',content);
|
||||
assert.equal(nodes(page,'FAQPage')[0].mainEntity.length,6);
|
||||
assert.equal(nodes(page,'FAQPage')[0].mainEntity.length,5);
|
||||
for(const question of nodes(page,'FAQPage')[0].mainEntity){assert.ok(faqPage.html.includes(question.name));assert.ok(question.acceptedAnswer.text);}
|
||||
for(const path of ['/search/爱情/','/navigation/','/home-road/','/apps/','/member/favorites/','/info/deposit/','/unknown/'])assert.equal(head(path,content).jsonLd,undefined,path);
|
||||
assert.equal(head('/shorts/',content,'?sort=2').jsonLd,undefined);assert.equal(head('/detail/9/',{...content,failed:true}).jsonLd,undefined);
|
||||
|
||||
Reference in New Issue
Block a user