整体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
+16 -57
View File
@@ -1,15 +1,13 @@
import type { Config, FooterContact } from "./api/types";
import { OFFICIAL_TG_HANDLE, OFFICIAL_TG_URL } from "./site";
/** Original HTML copy and markup; the about page's contacts use site configuration. */
/** Original HTML copy and markup; the only contact is the official Telegram account. */
export interface InfoPageDefinition {key:string;title:string;html:string}
const EMPTY_CONTACT_SECTION='<section class="about-section" data-site-contacts hidden></section>';
export const INFO_PAGES:Readonly<Record<string,InfoPageDefinition>>={
"about-us": {key:"about-us",title:"关于我们",html:`
<section class="about-section">
<h2>品牌介绍</h2>
<p>91短剧为喜爱短剧的观众汇集多种题材与精选作品,让找剧、追剧和观看变得轻松便捷。</p>
<p>黄果吃瓜为喜爱短剧的观众汇集多种题材与精选作品,让找剧、追剧和观看变得轻松便捷。</p>
<p>我们相信故事能够带来共鸣,也希望让更多创作者的作品与喜欢它们的观众相遇。</p>
</section>
<section class="about-section">
@@ -17,12 +15,12 @@ export const INFO_PAGES:Readonly<Record<string,InfoPageDefinition>>={
<p>围绕内容发现与观看体验,持续完善搜索、收藏、追剧记录及多端体验,让每一次打开都能更快找到想看的故事。</p>
<p>品牌主张:好故事,值得被看见。</p>
</section>
${EMPTY_CONTACT_SECTION}
${infoContactSection()}
`},
"user-agreement": {key:"user-agreement",title:"用户协议",html:`
<section class="about-section">
<h2>使用协议</h2>
<p>使用条款 欢迎您光临【91短剧】(以下简称本网站),本网站由「91短剧」(以下简称91短剧)经营。</p>
<p>使用条款 欢迎您光临【黄果吃瓜】(以下简称本网站),本网站由「黄果吃瓜」(以下简称黄果吃瓜)经营。</p>
<p>本网站重视每一位使用者所享有的服务,特此说明本网站的使用政策,以保障您的权益。</p>
<p>请您仔细阅读本使用条款的内容:</p>
</section>
@@ -120,7 +118,7 @@ ${EMPTY_CONTACT_SECTION}
`},
"privacy-policy": {key:"privacy-policy",title:"隐私政策",html:`
<section class="about-section">
<p>91短剧(以下简称本公司)非常重视您的隐私权,并依据《个人资料保护法》(以下简称个资法)的规定,向您告知下列有关隐私权保护政策的更多内容。</p>
<p>黄果吃瓜(以下简称本公司)非常重视您的隐私权,并依据《个人资料保护法》(以下简称个资法)的规定,向您告知下列有关隐私权保护政策的更多内容。</p>
</section>
<section class="about-section">
<h2>一、本公司使用您个人资料的目的</h2>
@@ -184,12 +182,8 @@ ${EMPTY_CONTACT_SECTION}
<p>收藏保存在当前浏览器中,没有接入账号同步。更换浏览器、设备或清除网站数据后,原来的收藏可能不可见。</p>
</details>
<details>
<summary>VIP 和金币是否可以购买?</summary>
<p>这些标识用于展示剧集类型。目前没有充值、订阅或购买功能。</p>
</details>
<details>
<summary>如何反馈问题?</summary>
<p>前往<a href="/info/feedback/">意见反馈</a>,填写问题类型、设备和详细描述,再将反馈保存到本地。当前版本没有线上提交功能。</p>
<summary>观看短剧需要付费吗?</summary>
<p>不需要。本站全部短剧和视频均可免费观看,无需充值、购买或开通会员。</p>
</details>
`},
"2257": {key:"2257",title:"2257 合规声明",html:`
@@ -218,7 +212,7 @@ ${EMPTY_CONTACT_SECTION}
<span class="compliance-number" aria-hidden="true">04</span>
<div>
<h2>合规说明</h2>
<p>如发现疑似违规内容,请通过<a href="/info/feedback/">意见反馈</a>提供线索,以便核查处理。具体义务以适用法律法规为准。</p>
<p>如发现疑似违规内容,请通过官方TG ${OFFICIAL_TG_HANDLE} 提供线索,以便核查处理。具体义务以适用法律法规为准。</p>
</div>
</section>
`},
@@ -247,54 +241,19 @@ ${EMPTY_CONTACT_SECTION}
<section class="compliance-section">
<span class="compliance-number" aria-hidden="true">04</span>
<div>
<h2>联系邮箱</h2>
<p>版权通知及反通知可发送至 <a href="mailto:huangguoaiai@gmail.com" rel="sponsored nofollow noopener noreferrer">huangguoaiai@gmail.com</a>,请在邮件中一并提供核查所需的资料。</p>
<h2>联系方式</h2>
<p>版权通知及反通知请通过官方TG <a href="${OFFICIAL_TG_URL}" target="_blank" rel="sponsored nofollow noopener noreferrer">${OFFICIAL_TG_HANDLE}</a> 提交,并一并提供核查所需的资料。</p>
</div>
</section>
`},
};
const contactText=(value:unknown)=>typeof value==='string'?value.trim().replace(/立即(?:联系|加入)/g,'').replace(/^[\s::]+|[\s::]+$/g,''):'';
const escapeContact=(value:string)=>value.replace(/[&<>"']/g,char=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[char]!));
function contactValue(value:unknown):{text:string;href:string}|undefined {
const text=contactText(value);
if(!text||/[\x00-\x1f\x7f]/.test(text)||/mailto:|[^/\s@]+@[^/\s@]+\./i.test(text))return;
if(/^tel:\+?[\d() .-]+$/i.test(text))return {text:text.slice(4),href:text};
const url=text.startsWith('//')?'https:'+text:/^[\w.-]+\.[a-z]{2,}(?:[/?#]|$)/i.test(text)?'https://'+text:text;
try{
const parsed=new URL(url);
if(['https:','http:'].includes(parsed.protocol)&&!parsed.username&&!parsed.password)return {text,href:parsed.href};
return;
}catch{
if(/^[\w-]+:/i.test(text))return;
return {text,href:''};
}
/** The only contact shown, matching the other 黄果 sites. */
export function infoContactSection():string {
return `<section class="about-section" data-site-contacts><h2>联系我们</h2><p>官方TG:<a href="${OFFICIAL_TG_URL}" target="_blank" rel="sponsored nofollow noopener noreferrer">${OFFICIAL_TG_HANDLE}</a></p></section>`;
}
export function infoContactSection(config:Config={},contacts:FooterContact[]|null=[]):string {
const settings=config.config,addresses=config.newAddressInfo;
const telegram=(...values:unknown[])=>values.map(value=>{
const text=contactText(value);
return contactValue(/^@[a-z\d_]{4,}$/i.test(text)?'https://t.me/'+text.slice(1):text);
}).find(value=>value?.href&&/^https?:/.test(value.href));
const business=telegram(settings?.telegram,settings?.telegramAdd,addresses?.telegram,addresses?.telegramAdd);
const group=telegram(settings?.tgGroup,addresses?.tgGroup);
const rows:{name:string;text:string;href:string}[]=[];
if(business)rows.push({name:'商务合作',...business});
if(group)rows.push({name:'用户反馈',...group});
for(const contact of Array.isArray(contacts)?contacts:[]){
if(!contact||typeof contact!=='object')continue;
const name=contactText(contact.name);if(!name)continue;
if(/商务|商户|合作|反馈|客服|support|官方群|telegram|tg群|邮箱|邮件|e-?mail/i.test(name))continue;
const value=contactValue(contact.value);
if(value)rows.push({name,...value});
}
if(!rows.length)return EMPTY_CONTACT_SECTION;
return `<section class="about-section" data-site-contacts><h2>联系我们</h2>${rows.map(({name,text,href})=>`<p>${escapeContact(name)}:${href?`<a href="${escapeContact(href)}"${/^https?:/i.test(href)?' target="_blank" rel="sponsored nofollow noopener noreferrer"':''}>${escapeContact(text)}</a>`:escapeContact(text)}</p>`).join('')}</section>`;
}
export function getInfoPage(key:string,config:Config={},contacts:FooterContact[]|null=[]):InfoPageDefinition|undefined {
export function getInfoPage(key:string):InfoPageDefinition|undefined {
const page=Object.hasOwn(INFO_PAGES,key)?INFO_PAGES[key]:undefined;
return page&&key==='about-us'?{...page,html:page.html.replace(EMPTY_CONTACT_SECTION,infoContactSection(config,contacts))}:page;
return page;
}