Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d508f84954 | ||
|
|
54fdea4f84 | ||
|
|
d84fd23918 | ||
|
|
2e8ee2eb64 | ||
|
|
5c77b39239 | ||
|
|
7b27de7551 |
No files matched your search
+1
-1
@@ -51,7 +51,7 @@ ENV NODE_ENV=production
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
ENV DOCKER_ENV=true
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed68
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed74
|
||||
|
||||
# 从构建器中复制 standalone 输出
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
|
||||
+14
-3
@@ -29,17 +29,28 @@ const all=await liveEpgAll();
|
||||
const key=EPG_MAP[name]||(all[name]?name:null);
|
||||
if(!key)return{has:false,list:[]};
|
||||
return{has:true,epg_key:key,list:all[key]||[]}}
|
||||
async function liveText(u,ms){const c=new AbortController();const t=setTimeout(()=>c.abort(),ms||15000);
|
||||
try{const r=await fetch(u,{redirect:"follow",signal:c.signal,headers:{"User-Agent":LIVE_UA,"Referer":LIVE_UP+"/"}});return await r.text()}finally{clearTimeout(t)}}
|
||||
async function liveText(u,ms){const timeout=ms||25000;let lastErr=null;
|
||||
for(let attempt=1;attempt<=3;attempt++){
|
||||
const c=new AbortController();const t=setTimeout(()=>c.abort(),timeout);
|
||||
try{const r=await fetch(u,{redirect:"follow",signal:c.signal,headers:{"User-Agent":LIVE_UA,"Referer":LIVE_UP+"/"}});
|
||||
if(!r.ok)throw new Error("http "+r.status);
|
||||
const txt=await r.text();clearTimeout(t);return txt}
|
||||
catch(e){clearTimeout(t);lastErr=e;console.log("[LIVE-FETCH-RETRY]",attempt+"/3",(u||"").slice(0,60),e&&e.message);
|
||||
if(attempt<3)await new Promise(r=>setTimeout(r,800*attempt))}}
|
||||
throw lastErr||new Error("fetch failed")}
|
||||
function liveRegion(n){if(/澳门|澳門|澳[視视]|澳亚|莲花/.test(n))return"澳门";
|
||||
if(/凤凰|TVB|有线|有線|NOW|ViuTV|HOY|港台|香港|明珠|HKS/.test(n))return"香港";
|
||||
if(/中天|东森|東森|中视|中視|台视|台視|三立|非凡|民视|民視|华视|華視|镜电视|鏡電視|寰宇|TVBS|纬来|緯來|ELEVEN|DAZN|爱尔达|愛爾達/.test(n))return"台湾";return"其他"}
|
||||
async function liveChannels(){
|
||||
if(liveCh.list&&Date.now()-liveCh.ts<3600e3)return liveCh.list;
|
||||
try{
|
||||
const h=await liveText(LIVE_UP+"/?tid=gt");const seen=new Set(),list=[];
|
||||
for(const m of h.matchAll(/href="\?act=play&(?:amp;)?tid=gt&(?:amp;)?id=(\d+)"[^>]*>\s*([^<]+?)\s*</g)){
|
||||
if(!seen.has(m[1])){seen.add(m[1]);list.push({id:m[1],name:m[2]})}}
|
||||
if(list.length){list.forEach(function(c){c.region=liveRegion(c.name)});liveCh.list=list;liveCh.ts=Date.now()}return list||[]}
|
||||
if(list.length){list.forEach(function(c){c.region=liveRegion(c.name)});liveCh.list=list;liveCh.ts=Date.now();return list}
|
||||
throw new Error("channels empty")}catch(e){console.log("[LIVE-CH-ERR]",e&&e.message);
|
||||
if(liveCh.list&&liveCh.list.length){console.log("[LIVE-CH-STALE] use stale list n="+liveCh.list.length);return liveCh.list}
|
||||
return[]}}
|
||||
async function liveLines(id){
|
||||
const c=liveLn.get(id);if(c&&Date.now()-c.ts<1800e3)return c.lines;
|
||||
const h=await liveText(LIVE_UP+"/?act=play&tid=gt&id="+encodeURIComponent(id));
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
if(!self.define){let e,s={};const a=(a,n)=>(a=new URL(a+".js",n).href,s[a]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()}).then(()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e}));self.define=(n,i)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let t={};const r=e=>a(e,c),o={module:{uri:c},exports:t,require:r};s[c]=Promise.all(n.map(e=>o[e]||r(e))).then(e=>(i(...e),t))}}define(["./workbox-e9849328"],function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"d3c25753d011e80b2ccd5a754ac24ed9"},{url:"/_next/static/0MjBArWMO37oCPAjOorM5/_buildManifest.js",revision:"85aecd8a55db42fc901f52386fd2a680"},{url:"/_next/static/0MjBArWMO37oCPAjOorM5/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/151-8711dd3ec7fbfa61.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/234-b4915b11eb0bb661.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/242-5a0502f47346ed4a.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/273-fffc7e5390a1c642.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/547-65bdb23e16942a03.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/609-46d66c37b95adf6a.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/78-b091442d784a205f.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/866-7f5b3d6941560701.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/_not-found/page-2f2263c5b98c190a.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/admin/page-759806afdd5b7523.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/config/page-228e0af5a31948e0.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/douban/page-72adc56cdd9fa67a.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/filter/page-4cebc2f48c3257a1.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/ipv6/page-8a601c06ae5900e7.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/layout-abad67b72f2d607d.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/live/page-f9e105dfdc52a0d4.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/login/page-b2957b92254ae889.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/page-e5765bbccc00a155.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/play/page-5cfe996f3331a017.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/search/page-62b12f466a432302.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/settings/page-acdcc4f7e3aba36e.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/tvbox/page-b0ddd4e31a961ddc.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/app/warning/page-e6b20b93b37dc516.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/b145b63a-d75d6adf389a7589.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/c72274ce-909438a8a5dd87a5.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/da9543df-c2ce5269243dd748.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/framework-6e06c675866dc992.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/main-8daa958ee4a360c2.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/main-app-734bbab0f54e7373.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/pages/_app-3fcac1a2c632f1ef.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/pages/_error-d3fe151bf402c134.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-f732225cafd52a05.js",revision:"0MjBArWMO37oCPAjOorM5"},{url:"/_next/static/css/23100062f5d4aac0.css",revision:"23100062f5d4aac0"},{url:"/_next/static/css/da6e9b4a73108890.css",revision:"da6e9b4a73108890"},{url:"/_next/static/css/e93463efba6c08e2.css",revision:"e93463efba6c08e2"},{url:"/_next/static/media/19cfc7226ec3afaa-s.woff2",revision:"9dda5cfc9a46f256d0e131bb535e46f8"},{url:"/_next/static/media/21350d82a1f187e9-s.woff2",revision:"4e2553027f1d60eff32898367dd4d541"},{url:"/_next/static/media/8e9860b6e62d6359-s.woff2",revision:"01ba6c2a184b8cba08b0d57167664d75"},{url:"/_next/static/media/ba9851c3c22cd980-s.woff2",revision:"9e494903d6b0ffec1a1e14d34427d44d"},{url:"/_next/static/media/c5fe6dc8356a8c31-s.woff2",revision:"027a89e9ab733a145db70f09b8a18b42"},{url:"/_next/static/media/df0a9ae256c0569c-s.woff2",revision:"d54db44de5ccb18886ece2fda72bdfe0"},{url:"/_next/static/media/e4af272ccee01ff0-s.p.woff2",revision:"65850a373e258f1c897a2b3d75eb74de"},{url:"/favicon.ico",revision:"c5deLine truncated
|
||||
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()}).then(()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(i,a)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let t={};const r=e=>n(e,c),o={module:{uri:c},exports:t,require:r};s[c]=Promise.all(i.map(e=>o[e]||r(e))).then(e=>(a(...e),t))}}define(["./workbox-e9849328"],function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"85a885cf9d52dfc1f9e7714b1099e163"},{url:"/_next/static/chunks/151-8711dd3ec7fbfa61.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/234-8975aa8e308e2c95.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/242-5a0502f47346ed4a.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/273-fffc7e5390a1c642.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/547-65bdb23e16942a03.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/609-46d66c37b95adf6a.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/78-b091442d784a205f.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/866-7f5b3d6941560701.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/_not-found/page-2f2263c5b98c190a.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/admin/page-759806afdd5b7523.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/config/page-e11c360d4b3b5cc5.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/douban/page-72adc56cdd9fa67a.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/filter/page-4cebc2f48c3257a1.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/ipv6/page-659cd71fb4b9a563.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/layout-abad67b72f2d607d.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/live/page-63f48c7b5b4e432c.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/login/page-b2957b92254ae889.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/page-e7df8976ebcc4d71.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/play/page-4b74435a3843991f.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/search/page-62b12f466a432302.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/settings/page-563818cdeb3743df.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/tvbox/page-8126310a5c549d37.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/app/warning/page-e6b20b93b37dc516.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/b145b63a-d75d6adf389a7589.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/c72274ce-909438a8a5dd87a5.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/da9543df-c2ce5269243dd748.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/framework-6e06c675866dc992.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/main-68795df77d27d928.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/main-app-734bbab0f54e7373.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/pages/_app-3fcac1a2c632f1ef.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/pages/_error-d3fe151bf402c134.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-f732225cafd52a05.js",revision:"npJwqxq3GQJATZ3iINZqR"},{url:"/_next/static/css/23100062f5d4aac0.css",revision:"23100062f5d4aac0"},{url:"/_next/static/css/50ddca8f740c6eb6.css",revision:"50ddca8f740c6eb6"},{url:"/_next/static/css/da6e9b4a73108890.css",revision:"da6e9b4a73108890"},{url:"/_next/static/media/19cfc7226ec3afaa-s.woff2",revision:"9dda5cfc9a46f256d0e131bb535e46f8"},{url:"/_next/static/media/21350d82a1f187e9-s.woff2",revision:"4e2553027f1d60eff32898367dd4d541"},{url:"/_next/static/media/8e9860b6e62d6359-s.woff2",revision:"01ba6c2a184b8cba08b0d57167664d75"},{url:"/_next/static/media/ba9851c3c22cd980-s.woff2",revision:"9e494903d6b0ffec1a1e14d34427d44d"},{url:"/_next/static/media/c5fe6dc8356a8c31-s.woff2",revision:"027a89e9ab733a145db70f09b8a18b42"},{url:"/_next/static/media/df0a9ae256c0569c-s.woff2",revision:"d54db44de5ccb18886ece2fda72bdfe0"},{url:"/_next/static/media/e4af272ccee01ff0-s.p.woff2",revision:"65850a373e258f1c897a2b3d75eb74de"},{url:"/_next/static/npJwqxq3GQJATZ3iINZqR/_buildManifest.js",revision:"85aecd8a55db42fc901f52386fd2a680"},{url:"/_next/static/npJwqxq3GQJATZ3iINZqR/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/favicon.ico",revision:"c5deLine truncated
|
||||
@@ -0,0 +1,67 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const SEARXNG = process.env.SEARXNG_URL || 'http://192.168.68.19:4000';
|
||||
|
||||
interface HotComment {
|
||||
title: string;
|
||||
content: string;
|
||||
url: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
// 评论聚合:SearXNG 全网搜“片名+评价/影评/观后感”,正文长的优先,取前 10 条
|
||||
export async function GET(req: NextRequest) {
|
||||
const { searchParams } = new URL(req.url);
|
||||
const title = (searchParams.get('title') || '').trim();
|
||||
if (!title) return NextResponse.json({ code: 0, msg: '缺少片名', list: [] });
|
||||
|
||||
const queries = [`${title} 评价`, `${title} 影评 观后感`];
|
||||
const seen = new Set<string>();
|
||||
const out: HotComment[] = [];
|
||||
|
||||
for (const q of queries) {
|
||||
if (out.length >= 10) break;
|
||||
let d: any = null;
|
||||
try {
|
||||
const r = await fetch(
|
||||
`${SEARXNG}/search?q=${encodeURIComponent(q)}&format=json&language=zh-CN`,
|
||||
{ signal: AbortSignal.timeout(15000) }
|
||||
);
|
||||
if (!r.ok) continue;
|
||||
d = await r.json();
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
const results: any[] = Array.isArray(d?.results) ? d.results : [];
|
||||
// 正文长的优先(一般是真实影评),顺带过滤纯导航/下载站
|
||||
results.sort(
|
||||
(a, b) => String(b?.content || '').length - String(a?.content || '').length
|
||||
);
|
||||
for (const x of results) {
|
||||
if (out.length >= 10) break;
|
||||
const url: string = String(x?.url || '');
|
||||
const content: string = String(x?.content || '').replace(/\s+/g, ' ').trim();
|
||||
if (!url || !content || content.length < 40) continue;
|
||||
if (/rarbg|torrent|magnet|bt\.| JAV|javhd|porn|赌场|博彩|贷款/i.test(url + content)) continue;
|
||||
let host = '';
|
||||
try {
|
||||
host = new URL(url).hostname.replace(/^www\.|^m\.|^wap\./, '');
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
const key = host + '|' + content.slice(0, 60);
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
out.push({
|
||||
title: String(x?.title || host).slice(0, 80),
|
||||
content: content.slice(0, 600),
|
||||
url,
|
||||
source: host,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({ code: 1, msg: 'ok', list: out.slice(0, 10) });
|
||||
}
|
||||
@@ -48,29 +48,35 @@ async function fetchClass(api: string): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
// t=902(香港剧 direct)→ 源站真实 id;t=901(香港电影 agg)→ 源站电影 id + area=香港过滤
|
||||
async function resolveTop(sources: SrcCfg[], sp: URLSearchParams): Promise<{ extraArea: string }> {
|
||||
// t=901-907(顶层分类)→ 每个源各自的真实 type_id(各源分类表不同,不能拿第一个源的 id 发给全源)
|
||||
// t=902(香港剧):源站有“香港剧”类目则直取;没有则取电视剧类目 + area=香港 过滤,保证只出香港剧
|
||||
async function resolveTopPerSource(sources: SrcCfg[], sp: URLSearchParams): Promise<{ extraArea: string; nativeByApi: Map<string, string> }> {
|
||||
const t = sp.get('t');
|
||||
if (!t || !/^90[1-9]$/.test(t) || sp.get('wd')) return { extraArea: '' };
|
||||
const first = sources[0];
|
||||
if (!first) return { extraArea: '' };
|
||||
const cls = await fetchClass(first.api);
|
||||
const byN: Record<string, any> = {};
|
||||
cls.forEach((c) => { if (c && c.type_name != null) byN[String(c.type_name).trim()] = c; });
|
||||
const fd = (...names: string[]) => { for (const n of names) if (byN[n]) return byN[n]; return null; };
|
||||
const mv = fd('电影', '电影片');
|
||||
const tv = fd('连续剧', '电视剧', '剧集');
|
||||
const vy = fd('综艺', '综艺片');
|
||||
const an = fd('动漫', '动漫片');
|
||||
const to = fd('动画片', '动画电影', '动漫电影');
|
||||
const hk = fd('香港剧', '港澳剧', '港台剧', '港剧');
|
||||
const nat: Record<string, any> = { '901': mv, '902': hk, '903': mv, '904': tv, '905': vy, '906': to, '907': an };
|
||||
const hit = nat[t];
|
||||
if (hit) {
|
||||
sp.set('t', String(hit.type_id));
|
||||
if (t === '901') { sp.set('area', '香港'); return { extraArea: '香港' }; }
|
||||
}
|
||||
return { extraArea: '' };
|
||||
const nativeByApi = new Map<string, string>();
|
||||
if (!t || !/^90[1-9]$/.test(t) || sp.get('wd') || sp.get('ids')) return { extraArea: '', nativeByApi };
|
||||
const classes = await Promise.all(sources.map((s) => fetchClass(s.api)));
|
||||
sources.forEach((s, i) => {
|
||||
const byN: Record<string, any> = {};
|
||||
(classes[i] || []).forEach((c) => { if (c && c.type_name != null) byN[String(c.type_name).trim()] = c; });
|
||||
const fd = (...names: string[]) => { for (const n of names) if (byN[n]) return byN[n]; return null; };
|
||||
const mv = fd('电影', '电影片');
|
||||
const tv = fd('连续剧', '电视剧', '剧集');
|
||||
const vy = fd('综艺', '综艺片');
|
||||
const an = fd('动漫', '动漫片');
|
||||
const to = fd('动画片', '动画电影', '动漫电影');
|
||||
const hk = fd('香港剧', '港澳剧', '港台剧', '港剧');
|
||||
let hit = null;
|
||||
if (t === '901') hit = mv;
|
||||
else if (t === '902') hit = hk || tv;
|
||||
else if (t === '903') hit = mv;
|
||||
else if (t === '904') hit = tv;
|
||||
else if (t === '905') hit = vy;
|
||||
else if (t === '906') hit = to;
|
||||
else if (t === '907') hit = an;
|
||||
if (hit) nativeByApi.set(s.api, String(hit.type_id));
|
||||
});
|
||||
if (t === '901' || t === '902') return { extraArea: '香港', nativeByApi };
|
||||
return { extraArea: '', nativeByApi };
|
||||
}
|
||||
|
||||
async function aggregateAll(sources: SrcCfg[], sp: URLSearchParams) {
|
||||
@@ -96,15 +102,23 @@ async function aggregateAll(sources: SrcCfg[], sp: URLSearchParams) {
|
||||
return out;
|
||||
}
|
||||
|
||||
let q = 'ac=videolist&pg=' + pg;
|
||||
if (wd) q += '&wd=' + encodeURIComponent(wd);
|
||||
// 顶层 9xx 分类先映射到源站真实 type_id(旧补丁 P() tops 逻辑)
|
||||
const { extraArea } = await resolveTop(srcs, sp);
|
||||
const t2 = sp.get('t');
|
||||
if (t2) q += '&t=' + encodeURIComponent(t2);
|
||||
['st', 'year', 'area', 'by'].forEach((k) => { const v = sp.get(k); if (v) q += '&' + k + '=' + encodeURIComponent(v); });
|
||||
// 顶层 9xx 分类:每个源用自己的真实 type_id 查询(旧补丁 P() tops 逻辑,源码化时按源分别映射)
|
||||
const topT = sp.get('t');
|
||||
const isTop = topT && /^90[1-9]$/.test(topT) && !wd && !ids;
|
||||
const { extraArea, nativeByApi } = isTop
|
||||
? await resolveTopPerSource(srcs, sp)
|
||||
: { extraArea: '', nativeByApi: new Map<string, string>() };
|
||||
const baseExtra = ['st', 'year', 'area', 'by'].map((k) => { const v = sp.get(k); return v ? '&' + k + '=' + encodeURIComponent(v) : ''; }).join('');
|
||||
const queries = srcs.map((s) => {
|
||||
let q = 'ac=videolist&pg=' + pg;
|
||||
if (wd) q += '&wd=' + encodeURIComponent(wd);
|
||||
const nt = isTop ? nativeByApi.get(s.api) : topT;
|
||||
if (nt) q += '&t=' + encodeURIComponent(nt);
|
||||
q += baseExtra;
|
||||
return q;
|
||||
});
|
||||
|
||||
const results = await Promise.all(srcs.map((s) => subFetch(s.api, q)));
|
||||
const results = await Promise.all(srcs.map((s, i) => subFetch(s.api, queries[i])));
|
||||
const seen: Record<string, number> = {};
|
||||
let list: any[] = [];
|
||||
results.forEach((d, i) => {
|
||||
@@ -117,10 +131,20 @@ async function aggregateAll(sources: SrcCfg[], sp: URLSearchParams) {
|
||||
}
|
||||
});
|
||||
list.sort((a, b) => String(b.vod_time == null ? '' : b.vod_time).localeCompare(String(a.vod_time == null ? '' : a.vod_time)));
|
||||
// 902 香港剧硬性过滤:只保留地区含“香港”的条目(兜底:无地区但名字命中的保留,避免误杀)
|
||||
if (topT === '902') {
|
||||
const hkPat = /港剧|粤语|TVB|邵氏|香港/i;
|
||||
list = list.filter((x) => {
|
||||
const area = String(x.vod_area || '');
|
||||
if (area.indexOf('香港') >= 0 || area === '香港') return true;
|
||||
if (!area && hkPat.test(String(x.vod_name || ''))) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
const fy = sp.get('year');
|
||||
const fa = sp.get('area') || extraArea;
|
||||
if (fy) list = list.filter((x) => String(x.vod_year || '').indexOf(fy) >= 0);
|
||||
if (fa) list = list.filter((x) => String(x.vod_area || '').indexOf(fa) >= 0);
|
||||
if (fa && topT !== '902') list = list.filter((x) => String(x.vod_area || '').indexOf(fa) >= 0);
|
||||
list = list.slice(0, 300);
|
||||
out.list = list; out.total = list.length; out.limit = list.length;
|
||||
const rep = results.find((d) => d && Array.isArray(d.class) && d.class.length);
|
||||
|
||||
+6
-6
@@ -61,12 +61,6 @@ export default async function RootLayout({
|
||||
let announcement =
|
||||
process.env.ANNOUNCEMENT ||
|
||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。Link Me TG:@katelya77';
|
||||
// 授权中心公告优先(CardAuth):有则覆盖默认免责声明,失败开放保留原公告
|
||||
try {
|
||||
const hub = (global as any).__licenseHub || eval('require')('/app/license-hub.js');
|
||||
const n = hub.getNotice ? hub.getNotice() : '';
|
||||
if (n) announcement = String(n);
|
||||
} catch {}
|
||||
let enableRegister = process.env.NEXT_PUBLIC_ENABLE_REGISTER === 'true';
|
||||
let imageProxy = process.env.NEXT_PUBLIC_IMAGE_PROXY || '';
|
||||
let doubanProxy = process.env.NEXT_PUBLIC_DOUBAN_PROXY || '';
|
||||
@@ -81,6 +75,12 @@ export default async function RootLayout({
|
||||
imageProxy = config.SiteConfig.ImageProxy;
|
||||
doubanProxy = config.SiteConfig.DoubanProxy;
|
||||
}
|
||||
// 授权中心公告优先(CardAuth):有则覆盖 config 默认免责声明,失败开放保留原公告
|
||||
try {
|
||||
const hub = (global as any).__licenseHub || eval('require')('/app/license-hub.js');
|
||||
const n = hub.getNotice ? hub.getNotice() : '';
|
||||
if (n) announcement = String(n);
|
||||
} catch {}
|
||||
|
||||
// 将运行时配置注入到全局 window 对象,供客户端在运行时读取
|
||||
const runtimeConfig = {
|
||||
|
||||
@@ -22,7 +22,6 @@ import ContinueWatching from '@/components/ContinueWatching';
|
||||
import HkDramaRow from '@/components/HkDramaRow';
|
||||
import PageLayout from '@/components/PageLayout';
|
||||
import PaginatedRow from '@/components/PaginatedRow';
|
||||
import { useSite } from '@/components/SiteProvider';
|
||||
import VideoCard from '@/components/VideoCard';
|
||||
|
||||
// 主内容区大型 KatelyaTV Logo 组件
|
||||
@@ -81,7 +80,6 @@ function HomeClient() {
|
||||
const [hotTvShows, setHotTvShows] = useState<DoubanItem[]>([]);
|
||||
const [hotVarietyShows, setHotVarietyShows] = useState<DoubanItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const { announcement } = useSite();
|
||||
|
||||
// 分页状态管理
|
||||
const [moviePage, setMoviePage] = useState(0);
|
||||
@@ -98,20 +96,6 @@ function HomeClient() {
|
||||
varietyShows: true,
|
||||
});
|
||||
|
||||
const [showAnnouncement, setShowAnnouncement] = useState(false);
|
||||
|
||||
// 检查公告弹窗状态
|
||||
useEffect(() => {
|
||||
if (typeof window !== 'undefined' && announcement) {
|
||||
const hasSeenAnnouncement = localStorage.getItem('hasSeenAnnouncement');
|
||||
if (hasSeenAnnouncement !== announcement) {
|
||||
setShowAnnouncement(true);
|
||||
} else {
|
||||
setShowAnnouncement(Boolean(!hasSeenAnnouncement && announcement));
|
||||
}
|
||||
}
|
||||
}, [announcement]);
|
||||
|
||||
// 收藏夹数据
|
||||
type FavoriteItem = {
|
||||
id: string;
|
||||
@@ -311,11 +295,6 @@ function HomeClient() {
|
||||
return unsubscribe;
|
||||
}, [activeTab]);
|
||||
|
||||
const handleCloseAnnouncement = (announcement: string) => {
|
||||
setShowAnnouncement(false);
|
||||
localStorage.setItem('hasSeenAnnouncement', announcement); // 记录已查看弹窗
|
||||
};
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<div className='px-4 sm:px-8 lg:px-12 py-4 sm:py-8 overflow-visible'>
|
||||
@@ -553,40 +532,6 @@ function HomeClient() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{announcement && showAnnouncement && (
|
||||
<div
|
||||
className={`fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm dark:bg-black/70 p-4 transition-opacity duration-300 ${
|
||||
showAnnouncement ? '' : 'opacity-0 pointer-events-none'
|
||||
}`}
|
||||
>
|
||||
<div className='w-full max-w-md rounded-xl bg-white p-6 shadow-xl dark:bg-gray-900 transform transition-all duration-300 hover:shadow-2xl'>
|
||||
<div className='flex justify-between items-start mb-4'>
|
||||
<h3 className='text-2xl font-bold tracking-tight text-gray-800 dark:text-white border-b border-purple-500 pb-1'>
|
||||
提示
|
||||
</h3>
|
||||
<button
|
||||
onClick={() => handleCloseAnnouncement(announcement)}
|
||||
className='text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-white transition-colors'
|
||||
aria-label='关闭'
|
||||
></button>
|
||||
</div>
|
||||
<div className='mb-6'>
|
||||
<div className='relative overflow-hidden rounded-lg mb-4 bg-purple-50 dark:bg-purple-900/20'>
|
||||
<div className='absolute inset-y-0 left-0 w-1.5 bg-purple-500 dark:bg-purple-400'></div>
|
||||
<p className='ml-4 text-gray-600 dark:text-gray-300 leading-relaxed'>
|
||||
{announcement}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => handleCloseAnnouncement(announcement)}
|
||||
className='w-full rounded-lg bg-gradient-to-r from-purple-600 to-purple-700 px-4 py-3 text-white font-medium shadow-md hover:shadow-lg hover:from-purple-700 hover:to-purple-800 dark:from-purple-600 dark:to-purple-700 dark:hover:from-purple-700 dark:hover:to-purple-800 transition-all duration-300 transform hover:-translate-y-0.5'
|
||||
>
|
||||
我知道了
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import { getVideoResolutionFromM3u8, processImageUrl } from '@/lib/utils';
|
||||
|
||||
import EpisodeSelector from '@/components/EpisodeSelector';
|
||||
import PageLayout from '@/components/PageLayout';
|
||||
import VideoMetaExtra from '@/components/VideoMetaExtra';
|
||||
import SkipController, { SkipSettingsButton } from '@/components/SkipController';
|
||||
|
||||
// 扩展 HTMLVideoElement 类型以支持 hls 属性
|
||||
@@ -1701,6 +1702,20 @@ function PlayPageClient() {
|
||||
{detail.desc}
|
||||
</div>
|
||||
)}
|
||||
{/* 演员 / 评分 / 全网热评 */}
|
||||
{detail && (
|
||||
<VideoMetaExtra
|
||||
title={detail.title}
|
||||
actor={detail.actor}
|
||||
director={detail.director}
|
||||
score={detail.score}
|
||||
scoreNum={detail.score_num}
|
||||
doubanScore={detail.douban_score}
|
||||
doubanId={detail.douban_id}
|
||||
area={detail.area}
|
||||
lang={detail.lang}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ type VodItem = {
|
||||
vod_time?: string;
|
||||
};
|
||||
|
||||
const SHOW_COUNT = 10;
|
||||
|
||||
export default function HkDramaRow() {
|
||||
const [items, setItems] = useState<VodItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/api/tvbox/all?ac=videolist&t=902&pg=1&by=time')
|
||||
@@ -28,12 +31,14 @@ export default function HkDramaRow() {
|
||||
String(a.vod_time || '')
|
||||
);
|
||||
});
|
||||
setItems(arr.slice(0, 5));
|
||||
setItems(arr.slice(0, SHOW_COUNT));
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {})
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
if (!items.length) return null;
|
||||
// 加载失败且无数据时不占位;加载中显示骨架占位,与其它栏目同时出现
|
||||
if (!loading && !items.length) return null;
|
||||
|
||||
return (
|
||||
<section className='mb-8'>
|
||||
@@ -49,7 +54,17 @@ export default function HkDramaRow() {
|
||||
</Link>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 relative'>
|
||||
{items.map((v) => {
|
||||
{loading
|
||||
? // 加载中显示10个占位,与热门电影/剧集同时出现,避免后半拍跳动
|
||||
Array.from({ length: SHOW_COUNT }).map((_, index) => (
|
||||
<div key={index} className='w-full'>
|
||||
<div className='relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-purple-200 animate-pulse dark:bg-purple-800'>
|
||||
<div className='absolute inset-0 bg-purple-300 dark:bg-purple-700'></div>
|
||||
</div>
|
||||
<div className='mt-2 h-4 bg-purple-200 rounded animate-pulse dark:bg-purple-800'></div>
|
||||
</div>
|
||||
))
|
||||
: items.map((v) => {
|
||||
const key = String(v.vod_id || '');
|
||||
const sep = key.indexOf(':');
|
||||
const ks = sep > 0 ? key.slice(0, sep) : '';
|
||||
|
||||
@@ -29,10 +29,8 @@ export default function HubBell({ forceShow = false }: { forceShow?: boolean })
|
||||
<button
|
||||
onClick={() => {
|
||||
try {
|
||||
localStorage.removeItem('hasSeenAnnouncement');
|
||||
window.dispatchEvent(new CustomEvent('open-hub-notice'));
|
||||
} catch {}
|
||||
if (location.pathname === '/') location.reload();
|
||||
else location.href = '/';
|
||||
}}
|
||||
title='公告通知'
|
||||
className={
|
||||
|
||||
@@ -16,6 +16,30 @@ export default function HubNotice() {
|
||||
const [mode, setMode] = useState<'ann' | 'upd'>('ann');
|
||||
|
||||
useEffect(() => {
|
||||
const openHandler = () => {
|
||||
// 铃铛手动打开:有授权公告就显示公告,无公告则显示版本信息兜底
|
||||
fetch('/api/license-config', { cache: 'no-store' })
|
||||
.then((r) => r.json())
|
||||
.then((j) => {
|
||||
if (!j || j.code !== 200 || !j.data) return;
|
||||
const d = j.data as LicenseData;
|
||||
setData(d);
|
||||
if (d.announcement) {
|
||||
setMode('ann');
|
||||
setVisible(true);
|
||||
} else if (Array.isArray((d as any).announcements) && (d as any).announcements.length) {
|
||||
const first = (d as any).announcements[0];
|
||||
setData({ ...d, announcement: first });
|
||||
setMode('ann');
|
||||
setVisible(true);
|
||||
} else {
|
||||
setMode('upd');
|
||||
setVisible(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
window.addEventListener('open-hub-notice', openHandler);
|
||||
const t = setTimeout(() => {
|
||||
fetch('/api/license-config', { cache: 'no-store' })
|
||||
.then((r) => r.json())
|
||||
@@ -42,7 +66,10 @@ export default function HubNotice() {
|
||||
})
|
||||
.catch(() => {});
|
||||
}, 1500);
|
||||
return () => clearTimeout(t);
|
||||
return () => {
|
||||
clearTimeout(t);
|
||||
window.removeEventListener('open-hub-notice', openHandler);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!visible || !data) return null;
|
||||
@@ -50,11 +77,13 @@ export default function HubNotice() {
|
||||
const title =
|
||||
mode === 'ann' && data.announcement
|
||||
? String(data.announcement.title || '📢 公告')
|
||||
: '发现新版本 v' + String(data.latest || '');
|
||||
: data.latest
|
||||
? '发现新版本 v' + String(data.latest || '')
|
||||
: '米视TV v' + String(data.version || '');
|
||||
const body =
|
||||
mode === 'ann' && data.announcement
|
||||
? String(data.announcement.content || '')
|
||||
: String(data.changelog || '').slice(0, 600);
|
||||
: String(data.changelog || '当前已是最新版本,暂无授权中心公告。').slice(0, 600);
|
||||
|
||||
const close = (dismissVer = false) => {
|
||||
try {
|
||||
|
||||
@@ -23,6 +23,12 @@ const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => {
|
||||
|
||||
{/* 右侧按钮 */}
|
||||
<div className='flex items-center gap-2'>
|
||||
<span
|
||||
className='shrink-0 select-none rounded-md px-1.5 py-0.5 text-[10px] font-bold tracking-wide text-purple-600 dark:text-purple-400 bg-purple-500/10 border border-purple-500/20'
|
||||
title='米视TV 当前版本'
|
||||
>
|
||||
v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
|
||||
</span>
|
||||
<ThemeToggle />
|
||||
<UserMenu />
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,12 @@ export default function TopRightButtons({ variant = 'bar' }: TopRightButtonsProp
|
||||
if (variant === 'float') {
|
||||
return (
|
||||
<div className='fixed top-2 right-2 z-50 flex items-center gap-1.5 rounded-xl bg-black/55 px-2 py-1.5 backdrop-blur-md border border-white/10'>
|
||||
<span
|
||||
className='shrink-0 select-none rounded-md px-1.5 py-1 text-[10px] font-bold tracking-wide text-purple-300 bg-purple-500/20 border border-purple-400/30'
|
||||
title='米视TV 当前版本'
|
||||
>
|
||||
v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
|
||||
</span>
|
||||
<HubBell forceShow />
|
||||
<TvboxButton forceShow compact />
|
||||
<Ipv6Button forceShow compact />
|
||||
@@ -37,7 +43,7 @@ export default function TopRightButtons({ variant = 'bar' }: TopRightButtonsProp
|
||||
className='hidden lg:inline-flex shrink-0 items-center select-none rounded-lg px-2 py-1.5 text-xs font-bold tracking-wide text-purple-600 dark:text-purple-400 bg-purple-500/10 border border-purple-500/20'
|
||||
title='米视TV 当前版本'
|
||||
>
|
||||
v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed68'}
|
||||
v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
|
||||
</span>
|
||||
<HubBell />
|
||||
<TvboxButton />
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
interface HotComment {
|
||||
title: string;
|
||||
content: string;
|
||||
url: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
// 演员 / 评分 / 全网热评(详情页简介下方)
|
||||
export default function VideoMetaExtra({
|
||||
title,
|
||||
actor,
|
||||
director,
|
||||
score,
|
||||
scoreNum,
|
||||
doubanScore,
|
||||
doubanId,
|
||||
area,
|
||||
lang,
|
||||
}: {
|
||||
title: string;
|
||||
actor?: string;
|
||||
director?: string;
|
||||
score?: string;
|
||||
scoreNum?: number;
|
||||
doubanScore?: string;
|
||||
doubanId?: number;
|
||||
area?: string;
|
||||
lang?: string;
|
||||
}) {
|
||||
const [comments, setComments] = useState<HotComment[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!title) return;
|
||||
let alive = true;
|
||||
setLoading(true);
|
||||
fetch(`/api/hot-comments?title=${encodeURIComponent(title)}`)
|
||||
.then((r) => r.json())
|
||||
.then((d) => {
|
||||
if (alive && d?.code === 1) setComments(d.list || []);
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
if (alive) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, [title]);
|
||||
|
||||
const actors = (actor || '')
|
||||
.split(/[,,、\/|]/)
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
.slice(0, 20);
|
||||
const scoreNum1 = parseFloat(score || '') || 0;
|
||||
const dbNum = parseFloat(doubanScore || '') || 0;
|
||||
const showScore = scoreNum1 > 0 ? scoreNum1.toFixed(1) : dbNum > 0 ? dbNum.toFixed(1) : '';
|
||||
|
||||
if (!actors.length && !director && !showScore && !area && !loading && !comments.length) return null;
|
||||
|
||||
return (
|
||||
<div className='mt-4 space-y-4'>
|
||||
{/* 导演 / 地区 / 语言 */}
|
||||
{(director || area || lang) && (
|
||||
<div className='text-sm opacity-80 space-x-4'>
|
||||
{director && (
|
||||
<span>
|
||||
导演:<span className='font-medium'>{director}</span>
|
||||
</span>
|
||||
)}
|
||||
{area && <span>地区:{area}</span>}
|
||||
{lang && <span>语言:{lang}</span>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 评分 */}
|
||||
{showScore && (
|
||||
<div className='flex items-center gap-2'>
|
||||
<span className='text-sm opacity-80'>评分</span>
|
||||
<span className='text-2xl font-bold text-amber-500'>{showScore}</span>
|
||||
<span className='flex text-amber-500'>
|
||||
{[1, 2, 3, 4, 5].map((i) => (
|
||||
<span key={i} className={i <= Math.round(Number(showScore) / 2) ? '' : 'opacity-30'}>
|
||||
★
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
{scoreNum && scoreNum > 0 && <span className='text-xs opacity-60'>({scoreNum}人评)</span>}
|
||||
{doubanId ? (
|
||||
<a
|
||||
href={`https://movie.douban.com/subject/${doubanId}/`}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
className='text-xs text-green-600 hover:underline ml-1'
|
||||
>
|
||||
豆瓣详情 →
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 演员列表 */}
|
||||
{actors.length > 0 && (
|
||||
<div>
|
||||
<div className='text-sm font-semibold mb-2 opacity-80'>演员({actors.length})</div>
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
{actors.map((a) => (
|
||||
<Link
|
||||
key={a}
|
||||
href={`/search?q=${encodeURIComponent(a)}`}
|
||||
title={`搜索${a}的全部作品`}
|
||||
className='px-3 py-1 rounded-full bg-gray-200/70 dark:bg-gray-700/70 text-sm hover:bg-green-500 hover:text-white dark:hover:bg-green-600 transition-colors cursor-pointer'
|
||||
>
|
||||
{a}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 全网热评 Top10 */}
|
||||
<div>
|
||||
<div className='text-sm font-semibold mb-2 opacity-80'>
|
||||
全网热评 Top10 <span className='font-normal opacity-60'>(来自网上公开影评聚合)</span>
|
||||
</div>
|
||||
{loading && comments.length === 0 && (
|
||||
<div className='space-y-2'>
|
||||
{[0, 1, 2].map((i) => (
|
||||
<div key={i} className='animate-pulse h-14 rounded-lg bg-gray-200/70 dark:bg-gray-700/50' />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{!loading && comments.length === 0 && (
|
||||
<div className='text-sm opacity-50'>暂无全网热评,换个片名或稍后再试。</div>
|
||||
)}
|
||||
<div className='space-y-2'>
|
||||
{comments.map((c, i) => (
|
||||
<a
|
||||
key={i}
|
||||
href={c.url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
className='block rounded-lg bg-gray-100/80 dark:bg-gray-800/60 p-3 hover:bg-gray-200/80 dark:hover:bg-gray-700/60 transition-colors'
|
||||
>
|
||||
<div className='flex items-center gap-2 mb-1'>
|
||||
<span className='text-xs font-bold text-white bg-amber-500 rounded px-1.5 py-0.5'>
|
||||
{i + 1}
|
||||
</span>
|
||||
<span className='text-sm font-medium truncate flex-1'>{c.title}</span>
|
||||
<span className='text-xs opacity-50 flex-shrink-0'>{c.source}</span>
|
||||
</div>
|
||||
<div className='text-sm opacity-80 leading-relaxed line-clamp-3'>{c.content}</div>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -266,6 +266,13 @@ export async function getDetailFromApi(
|
||||
desc: cleanHtmlTags(videoDetail.vod_content),
|
||||
type_name: videoDetail.type_name,
|
||||
douban_id: videoDetail.vod_douban_id,
|
||||
actor: videoDetail.vod_actor || '',
|
||||
director: videoDetail.vod_director || '',
|
||||
score: String(videoDetail.vod_score ?? ''),
|
||||
score_num: Number(videoDetail.vod_score_num ?? 0) || 0,
|
||||
douban_score: String(videoDetail.vod_douban_score ?? ''),
|
||||
area: videoDetail.vod_area || '',
|
||||
lang: videoDetail.vod_lang || '',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,13 @@ export interface SearchResult {
|
||||
desc?: string;
|
||||
type_name?: string;
|
||||
douban_id?: number;
|
||||
actor?: string;
|
||||
director?: string;
|
||||
score?: string;
|
||||
score_num?: number;
|
||||
douban_score?: string;
|
||||
area?: string;
|
||||
lang?: string;
|
||||
}
|
||||
|
||||
// 豆瓣数据结构
|
||||
|
||||
@@ -34,6 +34,16 @@ export async function middleware(request: NextRequest) {
|
||||
});
|
||||
}
|
||||
|
||||
// 访问日志(源码化,替代旧 patches/patch_access_log.js 运行时注入 next 内部 start-server):
|
||||
// middleware 覆盖全部路由请求,跳过静态资源
|
||||
if (pathname.indexOf('/_next/static') !== 0 && pathname !== '/favicon.ico') {
|
||||
const ua = (request.headers.get('user-agent') || '-').slice(0, 90);
|
||||
const ref = request.headers.get('referer');
|
||||
console.log(
|
||||
`[ACCESS] ${new Date().toISOString()} ip=${ip} ${request.method} ${fullUrl} ua=${JSON.stringify(ua)}${ref ? ` ref=${ref.slice(0, 80)}` : ''}`
|
||||
);
|
||||
}
|
||||
|
||||
// 跳过不需要认证的路径
|
||||
if (shouldSkipAuth(pathname)) {
|
||||
return NextResponse.next();
|
||||
|
||||
Reference in new issue
Block a user