From 1a5f53350c66196f1589318211f2b4f923b08da4 Mon Sep 17 00:00:00 2001 From: jinghui Date: Sun, 1 Nov 2026 10:58:50 +0800 Subject: [PATCH] =?UTF-8?q?v-fixed43:=20AI=E7=9F=AD=E5=89=A7=E8=8F=9C?= =?UTF-8?q?=E5=8D=95/=E7=9B=B4=E6=92=AD=E7=82=B9=E5=87=BB=E6=9A=82?= =?UTF-8?q?=E5=81=9C=E6=92=AD=E6=94=BE/=E6=8E=88=E6=9D=83=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E5=BC=B9=E7=AA=97/IPv6=E6=81=A2=E5=A4=8D/=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E8=BF=81=E7=A7=BB/TVBOX=20lives=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 19 +++++++++++++++++++ patches/app-api-tvbox-route.js | 11 +++++++---- patches/apply.sh | 16 ++++++++++++++++ patches/filter-page-chunk.js | 2 +- patches/inject_live.py | 9 ++++++--- patches/live-inject.js | 6 ++++-- patches/patch-aidrama-menu.js | 16 ++++++++++++++++ patches/patch-announcement.js | 20 ++++++++++++++++++++ patches/patch-hubnotice-remove.js | 18 ++++++++++++++++++ patches/patch_license.js | 4 +++- 10 files changed, 110 insertions(+), 11 deletions(-) create mode 100644 patches/patch-aidrama-menu.js create mode 100644 patches/patch-announcement.js create mode 100644 patches/patch-hubnotice-remove.js diff --git a/CHANGELOG.md b/CHANGELOG.md index da2b570..5cc951f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ 格式参考本机发版惯例:按日期分条,`🐛修复` / `✨新功能`。 +## v-fixed43 (2026-11-01) + +### ✨ 新功能 +- 📺 电脑端顶部菜单新增「AI短剧」入口(移动端底部导航同步),点击跳转搜索 AI短剧 +- 📡 `/live` 直播页恢复:点击画面即可暂停/播放,暂停时显示大播放键 +- 📢 首页公告改为动态读取授权系统(CardAuth)推送内容,免责声明弹窗移除,仅保留授权公告弹窗 + +### 🐛 修复 +- 🔐 登录账号改为 `jinghui` / `a3396336`,播放记录从旧 `admin` 账号迁移至新账号(历史记录恢复) +- 🌐 恢复 IPv6 自动跳转(tv6.88531.cn),移除首次访问选择页 +- 🚫 TVBOX 接口移除「4K」菜单,保留「AI短剧」 +- 🔗 直播页右上角「开源地址」改为自建 Gitea 仓库 +- 📡 TVBOX 配置 `lives` 直播源地址修正为 `?live=txt`(原死链 `/api/live/channels`) + +### 📦 安装/升级 +- TVBox/影视仓用户无需任何操作,重新打开 App 自动拉到新版 +- 网页用户刷新即升级(无需清缓存) +- 体验地址:https://tv.88531.cn + ## v-fixed42 (2026-10-30) ### ✨ 新功能 diff --git a/patches/app-api-tvbox-route.js b/patches/app-api-tvbox-route.js index 5c28b2b..ffc66a4 100644 --- a/patches/app-api-tvbox-route.js +++ b/patches/app-api-tvbox-route.js @@ -12,11 +12,12 @@ if(tv)T.push({tid:"904",name:"电视剧",kind:"agg",native:String(tv.type_id),ch if(vy)T.push({tid:"905",name:"综艺",kind:"agg",native:String(vy.type_id),ch:kd(vy),area:""}); if(to)T.push({tid:"906",name:"动画片",kind:"direct",native:String(to.type_id),ch:[],area:""}); if(an)T.push({tid:"907",name:"动漫",kind:"agg",native:String(an.type_id),ch:kd(an),area:""}); +T.push({tid:"909",name:"AI短剧",kind:"search",native:"",wd:"AI短剧",kwPat:"AI|短剧|微短剧",ch:[],area:""}); let Y=[{n:"全部",v:""}];for(let y=2026;y>=2010;y--)Y.push({n:String(y),v:String(y)}); let AR=[{n:"全部",v:""},{n:"中国大陆",v:"中国大陆"},{n:"中国香港",v:"中国香港"},{n:"中国台湾",v:"中国台湾"},{n:"美国",v:"美国"},{n:"韩国",v:"韩国"},{n:"日本",v:"日本"},{n:"英国",v:"英国"},{n:"法国",v:"法国"},{n:"德国",v:"德国"},{n:"泰国",v:"泰国"},{n:"印度",v:"印度"},{n:"加拿大",v:"加拿大"},{n:"其他",v:"其他"}]; let BY=[{n:"最新",v:"time"},{n:"最热",v:"hits"},{n:"评分",v:"score"}]; let cls7=[],tops={},filters={}; -T.forEach(t=>{cls7.push({type_id:t.tid,type_name:t.name,type_pid:0});tops[t.tid]={kind:t.kind,native:t.native,ch:t.ch,area:t.area||""};let g=[];if(t.ch&&t.ch.length)g.push({key:"st",name:"分类",value:[{n:"全部",v:""}].concat(t.ch.map(c=>({n:String(c.type_name),v:String(c.type_name)}))) });if(t.tid!=="901")g.push({key:"area",name:"地区",value:AR});g.push({key:"year",name:"年份",value:Y});g.push({key:"by",name:"排序",value:BY});filters[t.tid]=g}); +T.forEach(t=>{cls7.push({type_id:t.tid,type_name:t.name,type_pid:0});tops[t.tid]={kind:t.kind,native:t.native,wd:t.wd||"",kwPat:t.kwPat||"",ch:t.ch,area:t.area||""};let g=[];if(t.ch&&t.ch.length)g.push({key:"st",name:"分类",value:[{n:"全部",v:""}].concat(t.ch.map(c=>({n:String(c.type_name),v:String(c.type_name)}))) });if(t.tid!=="901")g.push({key:"area",name:"地区",value:AR});g.push({key:"year",name:"年份",value:Y});g.push({key:"by",name:"排序",value:BY});filters[t.tid]=g}); if(!cls7.length){(cls||[]).forEach(c=>cls7.push({type_id:String(c.type_id),type_name:c.type_name,type_pid:c.type_pid}))} return {class:cls7,tops:tops,filters:filters}; } @@ -49,19 +50,20 @@ return out; async function P(e,sp){try{let url=new URL(e.url);console.log("[TVBOX-P]",url.search.slice(0,300));let sv=sp.get("site")||"",site=sv,emb="",qi=sv.indexOf("?");if(qi>=0){emb=sv.slice(qi+1);site=sv.slice(0,qi)}site=site.split("/")[0].split("?")[0].trim();let raw=url.search.slice(1),pp=[];raw.split("&").forEach(x=>{x&&x.indexOf("site=")!==0&&pp.push(x)});if(emb)pp=emb.split("&").concat(pp);let fw=pp.join("&");let cfg=(await(0,c.iE)()).SourceConfig||[]; if(site==="all")return VJ(await ALL(fw,cfg));let sc=cfg.find(x=>(x.key||x.name)===site)||cfg.find(x=>x.name===site);if(!sc){console.log("[TVBOX-P] site not found:",site);return VJ(VB())}let base=String(sc.api||"").replace(/[?&]+$/,"");let cls=await CL(base);let doF=async q=>{try{let ctl=new AbortController,tm=setTimeout(()=>ctl.abort(),1e4),r=await fetch(base+(q?"?"+q:""),{headers:HD,signal:ctl.signal});if(clearTimeout(tm),!r.ok)return null;let tx=await r.text();try{let j=JSON.parse(tx);return j&&typeof j==="object"&&!Array.isArray(j)?j:null}catch(x){return null}}catch(x){return null}};async function AGG(tids,extra){extra=extra||"";let key=base+"|"+tids.join(",")+"|"+extra;let ent=_aggC.get(key);if(!ent||Date.now()-ent[0]>6e5){let pool=[],seen={};console.log("[TVBOX-AGG] base="+base+" tids="+tids.join(","));for(let i=0;isetTimeout(z,700))} if(i===0)console.log("[TVBOX-AGG] child0="+id+" r="+(r?JSON.stringify({code:r.code,n:r.list?r.list.length:-1}):"null"));if(r&&Array.isArray(r.list))for(let it of r.list){let v=it.vod_id;if(v!=null&&!seen[v]){seen[v]=1;pool.push(it)}} if(isetTimeout(z,250))}pool.sort((a,b)=>String(b.vod_time==null?"":b.vod_time).localeCompare(String(a.vod_time==null?"":a.vod_time)));console.log("[TVBOX-AGG] tids="+tids.length+" got="+pool.length);if(pool.length){ent=[Date.now(),pool];_aggC.set(key,ent)}else{ent=[Date.now(),[]]}}let p=ent[1];return {code:1,msg:"数据列表",page:1,pagecount:1,limit:p.length,total:p.length,list:p}} let mk=MK(cls);let _sp=new URLSearchParams(fw),_t=_sp.get("t")||"",_st=_sp.get("st")||""; -let _area="",_aggTids=null,_forceAgg=false,_aggRan=false;let _top=mk.tops[_t]; +let _area="",_aggTids=null,_forceAgg=false,_aggRan=false,_kwPat=null;let _top=mk.tops[_t]; let _stv=_st; if(_st&&!/^\d+$/.test(_st)){let _hit=(cls||[]).find(c=>c&&String(c.type_name).trim()===_st);if(_hit)_stv=String(_hit.type_id)} if(_top){if(_top.area)_area=_top.area; if(_st){_sp.set("t",_stv)} else if(_top.kind==="agg"){_aggTids=_top.ch.map(c=>String(c.type_id));_forceAgg=true} +else if(_top.kind==="search"){_sp.set("wd",_top.wd);_sp.delete("t");_kwPat=_top.kwPat} else{_sp.set("t",_top.native)}} else if(_st){_sp.set("t",_stv)} _sp.delete("st");if(_area&&!_sp.get("area"))_sp.set("area",_area); let _extra="";["year","area","by"].forEach(k=>{let v=_sp.get(k);if(v)_extra+="&"+k+"="+encodeURIComponent(v)}); fw=_sp.toString();let d; if(_aggTids&&_forceAgg){d=await AGG(_aggTids,_extra);_aggRan=true} -else{d=await doF(fw);if(_aggTids&&(!d||!d.list||d.list.length<10)){d=await AGG(_aggTids,_extra);_aggRan=true}}if(!d){console.log("[TVBOX-P] upstream bad:",fw.slice(0,120));return VJ(VB(cls))}if(!Array.isArray(d.class)||!d.class.length)d.class=cls;if(!Array.isArray(d.list))d.list=[];let mt=_aggRan?null:fw.match(/(?:^|&)t=([^&]*)/);if(mt){let tid=decodeURIComponent(mt[1]||"");if(/^\d+$/.test(tid)){let hit=d.list.some(x=>String(x.type_id)===tid);if(!hit){let nm=(d.class||[]).find(x=>String(x.type_id)===tid);if(nm){let d2=await doF(fw.replace(/(^|&)t=[^&]*/,"$1t="+encodeURIComponent(nm.type_name)));if(d2&&Array.isArray(d2.list)&&d2.list.length){if(!Array.isArray(d2.class)||!d2.class.length)d2.class=d.class;d=d2}}}}}try{ +else{d=await doF(fw);if(_aggTids&&(!d||!d.list||d.list.length<10)){d=await AGG(_aggTids,_extra);_aggRan=true}}if(!d){console.log("[TVBOX-P] upstream bad:",fw.slice(0,120));return VJ(VB(cls))}if(!Array.isArray(d.class)||!d.class.length)d.class=cls;if(!Array.isArray(d.list))d.list=[];let mt=(_aggRan||_kwPat)?null:fw.match(/(?:^|&)t=([^&]*)/);if(mt){let tid=decodeURIComponent(mt[1]||"");if(/^\d+$/.test(tid)){let hit=d.list.some(x=>String(x.type_id)===tid);if(!hit){let nm=(d.class||[]).find(x=>String(x.type_id)===tid);if(nm){let d2=await doF(fw.replace(/(^|&)t=[^&]*/,"$1t="+encodeURIComponent(nm.type_name)));if(d2&&Array.isArray(d2.list)&&d2.list.length){if(!Array.isArray(d2.class)||!d2.class.length)d2.class=d.class;d=d2}}}}}try{ let _q=new URLSearchParams(fw); let _yr=_q.get("year")||"",_ar=_q.get("area")||"",_by=_q.get("by")||"",_tid=_q.get("t")||""; if(_yr&&!d.list.length){let _f2=fw.split("&").filter(p=>p.indexOf("t=")!==0&&p.indexOf("year=")!==0).concat("year="+encodeURIComponent(_yr)).join("&");let _d2=await doF(_f2);if(_d2&&Array.isArray(_d2.list)){if(!Array.isArray(_d2.class)||!_d2.class.length)_d2.class=d.class;d=_d2}} @@ -69,7 +71,8 @@ if(!Array.isArray(d.list))d.list=[]; if(_yr&&_tid&&/^\d+$/.test(_tid)){let _sub=d.list.filter(x=>String(x.type_id)===_tid);if(_sub.length)d.list=_sub} if(_yr){let _y2=d.list.filter(x=>String(x.vod_year==null?"":x.vod_year).indexOf(_yr)>=0);if(_y2.length)d.list=_y2} if(_ar){let _a2=d.list.filter(x=>String(x.vod_area==null?"":x.vod_area).indexOf(_ar)>=0);if(_a2.length)d.list=_a2} +if(_kwPat){let _kr=new RegExp(_kwPat,"i");let _k2=d.list.filter(x=>_kr.test(String(x.vod_name==null?"":x.vod_name)));if(_k2.length)d.list=_k2;d.list.sort((a,b)=>String(b.vod_time==null?"":b.vod_time).localeCompare(String(a.vod_time==null?"":a.vod_time)))} if(_by&&d.list.length){let _gs=(x,k)=>String(x[k]==null?"":x[k]),_gn=x=>{let v=parseFloat(x);return isNaN(v)?0:v};d.list.sort((a,b)=>{if(_by==="time")return _gs(b,"vod_time").localeCompare(_gs(a,"vod_time"));if(_by==="hits")return(_gn(b.vod_hits)-_gn(a.vod_hits))||(_gn(b.vod_score)-_gn(a.vod_score))||_gs(b,"vod_time").localeCompare(_gs(a,"vod_time"));if(_by==="score")return _gn(b.vod_score)-_gn(a.vod_score);return 0})} }catch(_e){console.log("[TVBOX-FILTER] err",_e&&_e.message)} try{d.class=mk.class;d.filters=mk.filters;}catch(_fe){console.log("[TVBOX-FILTERS] err",_fe&&_fe.message)} -return VJ(d)}catch(x){console.log("[TVBOX-P] ERR",x&&x.message);return VJ(VB())}}let l="nodejs";async function u(e){console.log("[TVBOX-REQ]",e.method,e.url);try{let{searchParams:o}=new URL(e.url),t=o.get("format")||"json",n=e.headers.get("host")||"localhost:3000",a=e.headers.get("x-forwarded-proto")||"http",i=`${a}://${n}`,r=((await (0,c.iE)()).SourceConfig||[]).filter(e=>!e.disabled);let DFLT=["电影","电视剧","连续剧","综艺","动漫","动画片","纪录片","记录片","短剧","短剧大全","动作片","喜剧片","爱情片","科幻片","恐怖片","剧情片","战争片","犯罪片","悬疑片","灾难片","奇幻片","冒险片","武侠片","枪战片","警匪片","动画电影","动漫电影","网络电影","国产剧","港台剧","港澳剧","香港剧","台湾剧","欧美剧","韩国剧","日本剧","泰国剧","海外剧","国产","港台","欧美","韩国","日本","泰国","海外","大陆综艺","港台综艺","日韩综艺","欧美综艺","海外综艺","国产动漫","日韩动漫","欧美动漫","港台动漫","海外动漫","日本动漫","里番动漫","AI漫剧","电影解说","预告片","体育","足球","篮球","体育赛事"];let cats={};let TOP7=["香港电影","香港剧","电影","电视剧","综艺","动画片","动漫"];r.forEach(function(e){cats[e.key||e.name]=TOP7;});if(0===r.length)return s.NextResponse.json({error:"没有配置任何视频源"},{status:500});let _pm=(new URL(e.url)).pathname.match(/^\/api\/tvbox\/([^\/]+)$/);if(_pm){console.log("[TVBOX-P] path-site:",_pm[1]);return await P(e,{get:k=>k==="site"?decodeURIComponent(_pm[1]):o.get(k)});}if(o.get("site"))return await P(e,o);if(o.get("ac")||o.get("t")||o.get("wd")||o.get("ids")||o.get("pg")){console.log("[TVBOX-P] vod-req without site:",(new URL(e.url)).search.slice(0,300));return VJ(VB())}console.log("[TVBOX-CFG] config requested:",(new URL(e.url)).search);let l={spider:"",wallpaper:`${i}/screenshot1.png`,sites:[{key:"all",name:"全部资源",type:1,api:`${i}/api/tvbox/all`,searchable:1,quickSearch:1,filterable:1,ext:"",timeout:60,categories:TOP7},...r.map(e=>{let o=1,t=e.api.toLowerCase();return(t.includes("at/xml")||t.endsWith(".xml"))&&(o=0),{key:e.key||e.name,name:e.name,type:o,api:`${i}/api/tvbox/${encodeURIComponent(e.key||e.name)}`,searchable:1,quickSearch:1,filterable:1,ext:e.detail||"",timeout:30,categories:cats[e.key||e.name]}})],parses:[{name:"Json并发",type:2,url:"Parallel"},{name:"Json轮询",type:2,url:"Sequence"},{name:"KatelyaTV内置解析",type:1,url:`${i}/api/parse?url=`,ext:{flag:["qiyi","qq","letv","sohu","youku","mgtv","bilibili","wasu","xigua","1905"]}}],flags:["youku","qq","iqiyi","qiyi","letv","sohu","tudou","pptv","mgtv","wasu","bilibili","le","duoduozy","renrenmi","xigua","优酷","腾讯","爱奇艺","奇艺","乐视","搜狐","土豆","PPTV","芒果","华数","哔哩","1905"],lives:[{name:"KatelyaTV直播",type:0,url:`${i}/api/live/channels`,epg:"",logo:""}],ads:["mimg.0c1q0l.cn","www.googletagmanager.com","www.google-analytics.com","mc.usihnbcq.cn","mg.g1mm3d.cn","mscs.svaeuzh.cn","cnzz.hhurm.com","tp.vinuxhome.com","cnzz.mmstat.com","www.baihuillq.com","s23.cnzz.com","z3.cnzz.com","c.cnzz.com","stj.v1vo.top","z12.cnzz.com","img.mosflower.cn","tips.gamevvip.com","ehwe.yhdtns.com","xdn.cqqc3.com","www.jixunkyy.cn","sp.chemacid.cn","hm.baidu.com","s9.cnzz.com","z6.cnzz.com","um.cavuc.com","mav.mavuz.com","wofwk.aoidf3.com","z5.cnzz.com","xc.hubeijieshikj.cn","tj.tianwenhu.com","xg.gars57.cn","k.jinxiuzhilv.com","cdn.bootcss.com","ppl.xunzhuo123.com","xomk.jiangjunmh.top","img.xunzhuo123.com","z1.cnzz.com","s13.cnzz.com","xg.huataisangao.cn","z7.cnzz.com","xg.huataisangao.cn","z2.cnzz.com","s96.cnzz.com","q11.cnzz.com","thy.dacedsfa.cn","xg.whsbpw.cn","s19.cnzz.com","z8.cnzz.com","s4.cnzz.com","f5w.as12df.top","ae01.alicdn.com","www.92424.cn","k.wudejia.com","vivovip.mmszxc.top","qiu.xixiqiu.com","cdnjs.hnfenxun.com","cms.qdwght.com"]};if("txt"!==t)return s.NextResponse.json(l,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type","Cache-Control":"no-store"}});{let e=JSON.stringify(l,null,2),o=Buffer.from(e).toString("base64");return new s.NextResponse(o,{headers:{"Content-Type":"text/plain; charset=utf-8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type","Cache-Control":"no-store"}})}}catch(e){return s.NextResponse.json({error:"TVBox配置生成失败",details:e instanceof Error?e.message:String(e)},{status:500})}}async function p(){console.log("[TVBOX-OPT]");return new s.NextResponse(null,{status:200,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let m="standalone",f=new a.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/tvbox/route",pathname:"/api/tvbox",filename:"route",bundlePath:"app/api/tvbox/route"},resolvedPagePath:"/app/src/app/api/tvbox/route.ts",nextConfigOutput:m,userland:n}),{requestAsyncStorage:g,staticGenerationAsyncStorage:d,serverHooks:h}=f,C="/api/tvbox/route";function y(){return(0,r.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:d})}},13303:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{let fileConfig,cachedConfig;__webpack_require__.d(__webpack_exports__,{Hz:()=>API_CONFIG,Ih:()=>resetConfig,iE:()=>getConfig,jT:()=>getCacheTime,ll:()=>getAvailableApiSites});var _db__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(46257),_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(80540);let API_CONFIG={search:{path:"?ac=videolist&wd=",pagePath:"?ac=videolist&wd={query}&pg={page}",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",Accept:"application/json"}},detail:{path:"?ac=videolist&ids=",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",Accept:"application/json"}}};async function initConfig(){if(cachedConfig)return;if("true"===process.env.DOCKER_ENV){let _require=eval("require"),fs=_require("fs"),path=_require("path"),configPath=path.join(process.cwd(),"config.json"),raw=fs.readFileSync(configPath,"utf-8");fileConfig=JSON.parse(raw),console.log("load dynamic config success")}else fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let storageType=process.env.NEXT_PUBLIC_STORAGE_TYPE||"localstorage";if("localstorage"!==storageType){let storage=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)();try{let adminConfig=null;storage&&"function"==typeof storage.getAdminConfig&&(adminConfig=await storage.getAdminConfig());let userNames=[];if(storage&&"function"==typeof storage.getAllUsers)try{userNames=await storage.getAllUsers()}catch(e){console.error("获取用户列表失败:",e)}let apiSiteEntries=Object.entries(fileConfig.api_site);if(adminConfig){let existed=new Set((adminConfig.SourceConfig||[]).map(e=>e.key));apiSiteEntries.forEach(([e,o])=>{existed.has(e)||adminConfig.SourceConfig.push({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1,is_adult:o.is_adult||!1})});let apiSiteKeys=new Set(apiSiteEntries.map(([e])=>e));adminConfig.SourceConfig.forEach(e=>{if(apiSiteKeys.has(e.key)){let o=fileConfig.api_site[e.key];o&&(e.is_adult=o.is_adult||!1)}else e.from="custom"});let existedUsers=new Set((adminConfig.UserConfig.Users||[]).map(e=>e.username));userNames.forEach(e=>{existedUsers.has(e)||adminConfig.UserConfig.Users.push({username:e,role:"user"})});let ownerUser=process.env.USERNAME;ownerUser&&(adminConfig.UserConfig.Users=adminConfig.UserConfig.Users.filter(e=>e.username!==ownerUser),adminConfig.UserConfig.Users.unshift({username:ownerUser,role:"owner"}))}else{let allUsers=userNames.map(e=>({username:e,role:"user"})),ownerUser=process.env.USERNAME;ownerUser&&(allUsers=allUsers.filter(e=>e.username!==ownerUser)).unshift({username:ownerUser,role:"owner"}),adminConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:allUsers},SourceConfig:apiSiteEntries.map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1,is_adult:o.is_adult||!1}))}}storage&&"function"==typeof storage.setAdminConfig&&await storage.setAdminConfig(adminConfig),cachedConfig=adminConfig}catch(err){console.error("加载管理员配置失败:",err)}}else cachedConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:[]},SourceConfig:Object.entries(fileConfig.api_site).map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1}))}}async function getConfig(){let e=process.env.NEXT_PUBLIC_STORAGE_TYPE||"localstorage";if("true"===process.env.DOCKER_ENV||"localstorage"===e)return await initConfig(),cachedConfig;try{let e=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),o=null;if(e&&"function"==typeof e.getAdminConfig&&(o=await e.getAdminConfig()),o){o.SiteConfig.SiteName=process.env.SITE_NAME||"KatelyaTV",o.SiteConfig.Announcement=process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",o.UserConfig.AllowRegister="true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,o.SiteConfig.ImageProxy=process.env.NEXT_PUBLIC_IMAGE_PROXY||"",o.SiteConfig.DoubanProxy=process.env.NEXT_PUBLIC_DOUBAN_PROXY||"",fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let e=Object.entries(fileConfig.api_site),t=new Set((o.SourceConfig||[]).map(e=>e.key));e.forEach(([e,n])=>{t.has(e)||o.SourceConfig.push({key:e,name:n.name,api:n.api,detail:n.detail,from:"config",disabled:!1,is_adult:n.is_adult||!1})});let n=new Set(e.map(([e])=>e));o.SourceConfig.forEach(e=>{if(n.has(e.key)){let o=fileConfig.api_site[e.key];o&&(e.is_adult=o.is_adult||!1)}else e.from="custom"});let a=process.env.USERNAME||"",i=!1;o.UserConfig.Users.forEach(e=>{e.username!==a&&"owner"===e.role&&(e.role="user"),e.username===a&&(i=!0,e.role="owner")}),i||o.UserConfig.Users.unshift({username:a,role:"owner"}),cachedConfig=o}else await initConfig();return cachedConfig}catch(e){return await initConfig(),cachedConfig}}async function resetConfig(){let storage=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),userNames=[];if(storage&&"function"==typeof storage.getAllUsers)try{userNames=await storage.getAllUsers()}catch(e){console.error("获取用户列表失败:",e)}if("true"===process.env.DOCKER_ENV){let _require=eval("require"),fs=_require("fs"),path=_require("path"),configPath=path.join(process.cwd(),"config.json"),raw=fs.readFileSync(configPath,"utf-8");fileConfig=JSON.parse(raw),console.log("load dynamic config success")}else fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let apiSiteEntries=Object.entries(fileConfig.api_site),allUsers=userNames.map(e=>({username:e,role:"user"})),ownerUser=process.env.USERNAME;ownerUser&&(allUsers=allUsers.filter(e=>e.username!==ownerUser)).unshift({username:ownerUser,role:"owner"});let adminConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:allUsers},SourceConfig:apiSiteEntries.map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1}))};storage&&"function"==typeof storage.setAdminConfig&&await storage.setAdminConfig(adminConfig),null==cachedConfig&&(cachedConfig=adminConfig),cachedConfig.SiteConfig=adminConfig.SiteConfig,cachedConfig.UserConfig=adminConfig.UserConfig,cachedConfig.SourceConfig=adminConfig.SourceConfig}async function getCacheTime(){return(await getConfig()).SiteConfig.SiteInterfaceCacheTime||7200}async function getAvailableApiSites(e=!1){let o=await getConfig();if(!o.SourceConfig||!Array.isArray(o.SourceConfig))return console.warn("SourceConfig is missing or not an array, returning empty array"),[];let t=o.SourceConfig.filter(e=>!e.disabled).map(e=>({...e,is_adult:!0===e.is_adult}));return e&&(t=t.filter(e=>!e.is_adult)),t.map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail}))}async function getFilteredApiSites(e){let o=await getConfig();if(!o.SourceConfig||!Array.isArray(o.SourceConfig))return console.warn("SourceConfig is missing or not an array, returning empty array"),[];let t=!0;if(e)try{let o=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),n=await o.getUserSettings(e);t=n?.filter_adult_content!==!1}catch(e){console.warn("Failed to get user settings, using default filter:",e)}let n=o.SourceConfig.filter(e=>!e.disabled).map(e=>({...e,is_adult:!0===e.is_adult}));return t&&(n=n.filter(e=>!e.is_adult)),n.map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail}))}async function getAdultApiSites(){let e=await getConfig();return e.SourceConfig&&Array.isArray(e.SourceConfig)?e.SourceConfig.filter(e=>!e.disabled&&!0===e.is_adult).map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail})):(console.warn("SourceConfig is missing or not an array, returning empty array"),[])}},80540:(e,o,t)=>{t.d(o,{Z:()=>n});let n={cache_time:7200,api_site:{hnzy:{api:"https://hnzyapi.com/api.php/provide/vod",name:"火鸟资源",is_adult:!1},lzzy:{api:"https://api.liangzizy.com/inc/apijson_vod.php",name:"量子资源",is_adult:!1},ffzy:{api:"https://ffzyapi.com/api.php/provide/vod",name:"非凡资源",is_adult:!1},ykzy:{api:"https://api.yongjiuzy.cc/provide/vod",name:"永久资源",is_adult:!1},bdzy:{api:"https://api.1080zyku.com/inc/apijson_vod.php",name:"百度资源",is_adult:!1}}}}};var __webpack_require__=require("../../../webpack-runtime.js");__webpack_require__.C(exports);var __webpack_exec__=e=>__webpack_require__(__webpack_require__.s=e),__webpack_exports__=__webpack_require__.X(0,[7796,9864,3001,6257],()=>__webpack_exec__(36282));module.exports=__webpack_exports__})(); \ No newline at end of file +return VJ(d)}catch(x){console.log("[TVBOX-P] ERR",x&&x.message);return VJ(VB())}}let l="nodejs";async function u(e){console.log("[TVBOX-REQ]",e.method,e.url);try{let{searchParams:o}=new URL(e.url),t=o.get("format")||"json",n=e.headers.get("host")||"localhost:3000",a=e.headers.get("x-forwarded-proto")||"http",i=`${a}://${n}`,r=((await (0,c.iE)()).SourceConfig||[]).filter(e=>!e.disabled);let DFLT=["电影","电视剧","连续剧","综艺","动漫","动画片","纪录片","记录片","短剧","短剧大全","动作片","喜剧片","爱情片","科幻片","恐怖片","剧情片","战争片","犯罪片","悬疑片","灾难片","奇幻片","冒险片","武侠片","枪战片","警匪片","动画电影","动漫电影","网络电影","国产剧","港台剧","港澳剧","香港剧","台湾剧","欧美剧","韩国剧","日本剧","泰国剧","海外剧","国产","港台","欧美","韩国","日本","泰国","海外","大陆综艺","港台综艺","日韩综艺","欧美综艺","海外综艺","国产动漫","日韩动漫","欧美动漫","港台动漫","海外动漫","日本动漫","里番动漫","AI漫剧","电影解说","预告片","体育","足球","篮球","体育赛事"];let cats={};let TOP7=["AI短剧","香港电影","香港剧","电影","电视剧","综艺","动画片","动漫"];r.forEach(function(e){cats[e.key||e.name]=TOP7;});if(0===r.length)return s.NextResponse.json({error:"没有配置任何视频源"},{status:500});let _pm=(new URL(e.url)).pathname.match(/^\/api\/tvbox\/([^\/]+)$/);if(_pm){console.log("[TVBOX-P] path-site:",_pm[1]);return await P(e,{get:k=>k==="site"?decodeURIComponent(_pm[1]):o.get(k)});}if(o.get("site"))return await P(e,o);if(o.get("ac")||o.get("t")||o.get("wd")||o.get("ids")||o.get("pg")){console.log("[TVBOX-P] vod-req without site:",(new URL(e.url)).search.slice(0,300));return VJ(VB())}console.log("[TVBOX-CFG] config requested:",(new URL(e.url)).search);let l={spider:"",wallpaper:`${i}/screenshot1.png`,sites:[{key:"all",name:"全部资源",type:1,api:`${i}/api/tvbox/all`,searchable:1,quickSearch:1,filterable:1,ext:"",timeout:60,categories:TOP7},...r.map(e=>{let o=1,t=e.api.toLowerCase();return(t.includes("at/xml")||t.endsWith(".xml"))&&(o=0),{key:e.key||e.name,name:e.name,type:o,api:`${i}/api/tvbox/${encodeURIComponent(e.key||e.name)}`,searchable:1,quickSearch:1,filterable:1,ext:e.detail||"",timeout:30,categories:cats[e.key||e.name]}})],parses:[{name:"Json并发",type:2,url:"Parallel"},{name:"Json轮询",type:2,url:"Sequence"},{name:"KatelyaTV内置解析",type:1,url:`${i}/api/parse?url=`,ext:{flag:["qiyi","qq","letv","sohu","youku","mgtv","bilibili","wasu","xigua","1905"]}}],flags:["youku","qq","iqiyi","qiyi","letv","sohu","tudou","pptv","mgtv","wasu","bilibili","le","duoduozy","renrenmi","xigua","优酷","腾讯","爱奇艺","奇艺","乐视","搜狐","土豆","PPTV","芒果","华数","哔哩","1905"],lives:[{name:"KatelyaTV直播",type:0,url:`${i}/api/live/channels`,epg:"",logo:""}],ads:["mimg.0c1q0l.cn","www.googletagmanager.com","www.google-analytics.com","mc.usihnbcq.cn","mg.g1mm3d.cn","mscs.svaeuzh.cn","cnzz.hhurm.com","tp.vinuxhome.com","cnzz.mmstat.com","www.baihuillq.com","s23.cnzz.com","z3.cnzz.com","c.cnzz.com","stj.v1vo.top","z12.cnzz.com","img.mosflower.cn","tips.gamevvip.com","ehwe.yhdtns.com","xdn.cqqc3.com","www.jixunkyy.cn","sp.chemacid.cn","hm.baidu.com","s9.cnzz.com","z6.cnzz.com","um.cavuc.com","mav.mavuz.com","wofwk.aoidf3.com","z5.cnzz.com","xc.hubeijieshikj.cn","tj.tianwenhu.com","xg.gars57.cn","k.jinxiuzhilv.com","cdn.bootcss.com","ppl.xunzhuo123.com","xomk.jiangjunmh.top","img.xunzhuo123.com","z1.cnzz.com","s13.cnzz.com","xg.huataisangao.cn","z7.cnzz.com","xg.huataisangao.cn","z2.cnzz.com","s96.cnzz.com","q11.cnzz.com","thy.dacedsfa.cn","xg.whsbpw.cn","s19.cnzz.com","z8.cnzz.com","s4.cnzz.com","f5w.as12df.top","ae01.alicdn.com","www.92424.cn","k.wudejia.com","vivovip.mmszxc.top","qiu.xixiqiu.com","cdnjs.hnfenxun.com","cms.qdwght.com"]};if("txt"!==t)return s.NextResponse.json(l,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type","Cache-Control":"no-store"}});{let e=JSON.stringify(l,null,2),o=Buffer.from(e).toString("base64");return new s.NextResponse(o,{headers:{"Content-Type":"text/plain; charset=utf-8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type","Cache-Control":"no-store"}})}}catch(e){return s.NextResponse.json({error:"TVBox配置生成失败",details:e instanceof Error?e.message:String(e)},{status:500})}}async function p(){console.log("[TVBOX-OPT]");return new s.NextResponse(null,{status:200,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}})}let m="standalone",f=new a.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/tvbox/route",pathname:"/api/tvbox",filename:"route",bundlePath:"app/api/tvbox/route"},resolvedPagePath:"/app/src/app/api/tvbox/route.ts",nextConfigOutput:m,userland:n}),{requestAsyncStorage:g,staticGenerationAsyncStorage:d,serverHooks:h}=f,C="/api/tvbox/route";function y(){return(0,r.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:d})}},13303:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{let fileConfig,cachedConfig;__webpack_require__.d(__webpack_exports__,{Hz:()=>API_CONFIG,Ih:()=>resetConfig,iE:()=>getConfig,jT:()=>getCacheTime,ll:()=>getAvailableApiSites});var _db__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(46257),_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(80540);let API_CONFIG={search:{path:"?ac=videolist&wd=",pagePath:"?ac=videolist&wd={query}&pg={page}",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",Accept:"application/json"}},detail:{path:"?ac=videolist&ids=",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",Accept:"application/json"}}};async function initConfig(){if(cachedConfig)return;if("true"===process.env.DOCKER_ENV){let _require=eval("require"),fs=_require("fs"),path=_require("path"),configPath=path.join(process.cwd(),"config.json"),raw=fs.readFileSync(configPath,"utf-8");fileConfig=JSON.parse(raw),console.log("load dynamic config success")}else fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let storageType=process.env.NEXT_PUBLIC_STORAGE_TYPE||"localstorage";if("localstorage"!==storageType){let storage=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)();try{let adminConfig=null;storage&&"function"==typeof storage.getAdminConfig&&(adminConfig=await storage.getAdminConfig());let userNames=[];if(storage&&"function"==typeof storage.getAllUsers)try{userNames=await storage.getAllUsers()}catch(e){console.error("获取用户列表失败:",e)}let apiSiteEntries=Object.entries(fileConfig.api_site);if(adminConfig){let existed=new Set((adminConfig.SourceConfig||[]).map(e=>e.key));apiSiteEntries.forEach(([e,o])=>{existed.has(e)||adminConfig.SourceConfig.push({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1,is_adult:o.is_adult||!1})});let apiSiteKeys=new Set(apiSiteEntries.map(([e])=>e));adminConfig.SourceConfig.forEach(e=>{if(apiSiteKeys.has(e.key)){let o=fileConfig.api_site[e.key];o&&(e.is_adult=o.is_adult||!1)}else e.from="custom"});let existedUsers=new Set((adminConfig.UserConfig.Users||[]).map(e=>e.username));userNames.forEach(e=>{existedUsers.has(e)||adminConfig.UserConfig.Users.push({username:e,role:"user"})});let ownerUser=process.env.USERNAME;ownerUser&&(adminConfig.UserConfig.Users=adminConfig.UserConfig.Users.filter(e=>e.username!==ownerUser),adminConfig.UserConfig.Users.unshift({username:ownerUser,role:"owner"}))}else{let allUsers=userNames.map(e=>({username:e,role:"user"})),ownerUser=process.env.USERNAME;ownerUser&&(allUsers=allUsers.filter(e=>e.username!==ownerUser)).unshift({username:ownerUser,role:"owner"}),adminConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:allUsers},SourceConfig:apiSiteEntries.map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1,is_adult:o.is_adult||!1}))}}storage&&"function"==typeof storage.setAdminConfig&&await storage.setAdminConfig(adminConfig),cachedConfig=adminConfig}catch(err){console.error("加载管理员配置失败:",err)}}else cachedConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:[]},SourceConfig:Object.entries(fileConfig.api_site).map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1}))}}async function getConfig(){let e=process.env.NEXT_PUBLIC_STORAGE_TYPE||"localstorage";if("true"===process.env.DOCKER_ENV||"localstorage"===e)return await initConfig(),cachedConfig;try{let e=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),o=null;if(e&&"function"==typeof e.getAdminConfig&&(o=await e.getAdminConfig()),o){o.SiteConfig.SiteName=process.env.SITE_NAME||"KatelyaTV",o.SiteConfig.Announcement=process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",o.UserConfig.AllowRegister="true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,o.SiteConfig.ImageProxy=process.env.NEXT_PUBLIC_IMAGE_PROXY||"",o.SiteConfig.DoubanProxy=process.env.NEXT_PUBLIC_DOUBAN_PROXY||"",fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let e=Object.entries(fileConfig.api_site),t=new Set((o.SourceConfig||[]).map(e=>e.key));e.forEach(([e,n])=>{t.has(e)||o.SourceConfig.push({key:e,name:n.name,api:n.api,detail:n.detail,from:"config",disabled:!1,is_adult:n.is_adult||!1})});let n=new Set(e.map(([e])=>e));o.SourceConfig.forEach(e=>{if(n.has(e.key)){let o=fileConfig.api_site[e.key];o&&(e.is_adult=o.is_adult||!1)}else e.from="custom"});let a=process.env.USERNAME||"",i=!1;o.UserConfig.Users.forEach(e=>{e.username!==a&&"owner"===e.role&&(e.role="user"),e.username===a&&(i=!0,e.role="owner")}),i||o.UserConfig.Users.unshift({username:a,role:"owner"}),cachedConfig=o}else await initConfig();return cachedConfig}catch(e){return await initConfig(),cachedConfig}}async function resetConfig(){let storage=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),userNames=[];if(storage&&"function"==typeof storage.getAllUsers)try{userNames=await storage.getAllUsers()}catch(e){console.error("获取用户列表失败:",e)}if("true"===process.env.DOCKER_ENV){let _require=eval("require"),fs=_require("fs"),path=_require("path"),configPath=path.join(process.cwd(),"config.json"),raw=fs.readFileSync(configPath,"utf-8");fileConfig=JSON.parse(raw),console.log("load dynamic config success")}else fileConfig=_runtime__WEBPACK_IMPORTED_MODULE_1__.Z;let apiSiteEntries=Object.entries(fileConfig.api_site),allUsers=userNames.map(e=>({username:e,role:"user"})),ownerUser=process.env.USERNAME;ownerUser&&(allUsers=allUsers.filter(e=>e.username!==ownerUser)).unshift({username:ownerUser,role:"owner"});let adminConfig={SiteConfig:{SiteName:process.env.SITE_NAME||"KatelyaTV",Announcement:process.env.ANNOUNCEMENT||"本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。",SearchDownstreamMaxPage:Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE)||5,SiteInterfaceCacheTime:fileConfig.cache_time||7200,ImageProxy:process.env.NEXT_PUBLIC_IMAGE_PROXY||"",DoubanProxy:process.env.NEXT_PUBLIC_DOUBAN_PROXY||""},UserConfig:{AllowRegister:"true"===process.env.NEXT_PUBLIC_ENABLE_REGISTER,Users:allUsers},SourceConfig:apiSiteEntries.map(([e,o])=>({key:e,name:o.name,api:o.api,detail:o.detail,from:"config",disabled:!1}))};storage&&"function"==typeof storage.setAdminConfig&&await storage.setAdminConfig(adminConfig),null==cachedConfig&&(cachedConfig=adminConfig),cachedConfig.SiteConfig=adminConfig.SiteConfig,cachedConfig.UserConfig=adminConfig.UserConfig,cachedConfig.SourceConfig=adminConfig.SourceConfig}async function getCacheTime(){return(await getConfig()).SiteConfig.SiteInterfaceCacheTime||7200}async function getAvailableApiSites(e=!1){let o=await getConfig();if(!o.SourceConfig||!Array.isArray(o.SourceConfig))return console.warn("SourceConfig is missing or not an array, returning empty array"),[];let t=o.SourceConfig.filter(e=>!e.disabled).map(e=>({...e,is_adult:!0===e.is_adult}));return e&&(t=t.filter(e=>!e.is_adult)),t.map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail}))}async function getFilteredApiSites(e){let o=await getConfig();if(!o.SourceConfig||!Array.isArray(o.SourceConfig))return console.warn("SourceConfig is missing or not an array, returning empty array"),[];let t=!0;if(e)try{let o=(0,_db__WEBPACK_IMPORTED_MODULE_0__.cF)(),n=await o.getUserSettings(e);t=n?.filter_adult_content!==!1}catch(e){console.warn("Failed to get user settings, using default filter:",e)}let n=o.SourceConfig.filter(e=>!e.disabled).map(e=>({...e,is_adult:!0===e.is_adult}));return t&&(n=n.filter(e=>!e.is_adult)),n.map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail}))}async function getAdultApiSites(){let e=await getConfig();return e.SourceConfig&&Array.isArray(e.SourceConfig)?e.SourceConfig.filter(e=>!e.disabled&&!0===e.is_adult).map(e=>({key:e.key,name:e.name,api:e.api,detail:e.detail})):(console.warn("SourceConfig is missing or not an array, returning empty array"),[])}},80540:(e,o,t)=>{t.d(o,{Z:()=>n});let n={cache_time:7200,api_site:{hnzy:{api:"https://hnzyapi.com/api.php/provide/vod",name:"火鸟资源",is_adult:!1},lzzy:{api:"https://api.liangzizy.com/inc/apijson_vod.php",name:"量子资源",is_adult:!1},ffzy:{api:"https://ffzyapi.com/api.php/provide/vod",name:"非凡资源",is_adult:!1},ykzy:{api:"https://api.yongjiuzy.cc/provide/vod",name:"永久资源",is_adult:!1},bdzy:{api:"https://api.1080zyku.com/inc/apijson_vod.php",name:"百度资源",is_adult:!1}}}}};var __webpack_require__=require("../../../webpack-runtime.js");__webpack_require__.C(exports);var __webpack_exec__=e=>__webpack_require__(__webpack_require__.s=e),__webpack_exports__=__webpack_require__.X(0,[7796,9864,3001,6257],()=>__webpack_exec__(36282));module.exports=__webpack_exports__})(); \ No newline at end of file diff --git a/patches/apply.sh b/patches/apply.sh index 841b22d..bbfbce4 100644 --- a/patches/apply.sh +++ b/patches/apply.sh @@ -25,6 +25,22 @@ echo "[4/5] 语法校验 ..." docker exec "$C" node --check /app/.next/server/app/api/tvbox/route.js docker exec "$C" node --check /app/.next/server/app/api/filter/route.js +echo "[4b/5] 应用公告补丁(免责声明→CardAuth公告)..." +docker cp "$DIR/patch-announcement.js" "$C:/tmp/patch-announcement.js" +docker exec "$C" node /tmp/patch-announcement.js || true +docker exec "$C" node --check /app/.next/server/chunks/8583.js || { echo "8583.js 语法失败"; exit 1; } + +echo "[4c/5] 移除重复的 HubNotice 弹窗..." +docker cp "$DIR/patch-hubnotice-remove.js" "$C:/tmp/patch-hubnotice-remove.js" +docker exec "$C" node /tmp/patch-hubnotice-remove.js || true + +echo "[4d/5] 注入直播 /live 功能..." +python3 "$DIR/inject_live.py" || echo "live inject failed (non-fatal)" + +echo "[4e/5] 顶部/底部菜单加入 AI短剧 入口..." +docker cp "$DIR/patch-aidrama-menu.js" "$C:/tmp/patch-aidrama-menu.js" +docker exec "$C" node /tmp/patch-aidrama-menu.js || true + echo "[5/5] 重启 ..." docker restart "$C" >/dev/null sleep 5 diff --git a/patches/filter-page-chunk.js b/patches/filter-page-chunk.js index b1bd551..7f6f7b3 100644 --- a/patches/filter-page-chunk.js +++ b/patches/filter-page-chunk.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[923],{3747:function(e,t,a){Promise.resolve().then(a.bind(a,805))},805:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var l=a(4393),r=a(5538);let s=(0,a(4123).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var o=a(4908),n=a(6402),i=a(6501);let c=[{label:"全部",value:""},{label:"香港",value:"香港"},{label:"大陆",value:"大陆"},{label:"台湾",value:"台湾"},{label:"美国",value:"美国"},{label:"日本",value:"日本"},{label:"韩国",value:"韩国"},{label:"泰国",value:"泰国"},{label:"英国",value:"英国"},{label:"法国",value:"法国"}],u=[{label:"全部",value:""},{label:"电影",value:"电影"},{label:"电视剧",value:"电视剧"},{label:"连续剧",value:"连续剧"},{label:"综艺",value:"综艺"},{label:"动漫",value:"动漫"},{label:"动作片",value:"动作片"},{label:"喜剧片",value:"喜剧片"},{label:"爱情片",value:"爱情片"},{label:"科幻片",value:"科幻片"},{label:"恐怖片",value:"恐怖片"},{label:"剧情片",value:"剧情片"},{label:"战争片",value:"战争片"},{label:"国产剧",value:"国产剧"},{label:"香港剧",value:"香港剧"},{label:"台湾剧",value:"台湾剧"},{label:"欧美剧",value:"欧美剧"},{label:"韩国剧",value:"韩国剧"},{label:"日本剧",value:"日本剧"},{label:"泰国剧",value:"泰国剧"},{label:"海外剧",value:"海外剧"},{label:"大陆综艺",value:"大陆综艺"},{label:"港台综艺",value:"港台综艺"},{label:"日韩综艺",value:"日韩综艺"},{label:"欧美综艺",value:"欧美综艺"},{label:"国产动漫",value:"国产动漫"},{label:"日韩动漫",value:"日韩动漫"},{label:"欧美动漫",value:"欧美动漫"},{label:"港台动漫",value:"港台动漫"},{label:"记录片",value:"记录片"},{label:"短剧",value:"短剧"}],d=function(){let e=[{label:"全部",value:""}],t=new Date().getFullYear();for(let a=t;a>=t-15;a--)e.push({label:"".concat(a),value:"".concat(a)});return e}();function h(e){let{label:t,options:a,value:r,onChange:s}=e;return(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400 min-w-[48px]",children:t}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>{let t=r===e.value;return(0,l.jsx)("button",{onClick:()=>s(e.value),className:"px-3 py-1.5 text-xs sm:text-sm font-medium rounded-full transition-all duration-200 whitespace-nowrap ".concat(t?"bg-purple-500 text-white shadow-sm":"bg-gray-200/60 text-gray-700 hover:bg-gray-300/60 dark:bg-gray-700/60 dark:text-gray-300 dark:hover:bg-gray-600/60"),children:e.label},e.value||"all")})})]})}function p(){let[e,t]=(0,o.useState)([]),[a,p]=(0,o.useState)("all"),[v,x]=(0,o.useState)([]),[g,m]=(0,o.useState)(""),[b,f]=(0,o.useState)(""),[y,w]=(0,o.useState)(""),[k,j]=(0,o.useState)([]),[N,C]=(0,o.useState)(!1),[S,_]=(0,o.useState)(!1),[P,R]=(0,o.useState)(1),[E,D]=(0,o.useState)(!0),[Z,I]=(0,o.useState)(""),L=(0,o.useRef)(null),q=(0,o.useRef)(null),z=(0,o.useRef)(0),H="all"===a;(0,o.useEffect)(()=>{(async()=>{try{var e;let a=await fetch("/api/filter?action=sources"),l=await a.json();(null===(e=l.sources)||void 0===e?void 0:e.length)&&(t(l.sources),p("all"))}catch(e){I("加载资源站列表失败")}})()},[]),(0,o.useEffect)(()=>{if(H){x([]),m("");return}a&&(async()=>{try{x([]),m("");let e=await fetch("/api/filter?action=classes&source=".concat(encodeURIComponent(a))),t=await e.json();Array.isArray(t.classes)&&x(t.classes)}catch(e){}})()},[a,H]);let M=(0,o.useCallback)(async(e,t)=>{if(!a)return;let l=++z.current;t?(C(!0),I("")):_(!0);try{let r=new URLSearchParams({action:"browse",source:a,pg:String(e)});H?g&&r.set("cat",g):g&&r.set("t",g),b&&r.set("area",b),y&&r.set("year",y);let s=await fetch("/api/filter?".concat(r.toString())),o=await s.json();if(l!==z.current)return;if(o.error){I(o.error);return}let n=Array.isArray(o.list)?o.list:[];j(e=>{let a=t?n:[...e,...n],s=new Set;return a.filter(x=>{let k=x.title+"|"+x.year;return!s.has(k)&&(s.add(k),!0)})}),R(o.next_pg||e+1),D(!!o.has_more&&n.length>0)}catch(e){l===z.current&&I("加载失败,请稍后重试")}finally{l===z.current&&(C(!1),_(!1))}},[a,g,b,y,H]);(0,o.useEffect)(()=>{if(!a)return;j([]),R(1),D(!0);let e=setTimeout(()=>M(1,!0),100);return()=>clearTimeout(e)},[a,g,b,y,M]),(0,o.useEffect)(()=>{if(!E||N||S||!L.current)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&E&&!N&&!S&&M(P,!1)},{threshold:.1});return e.observe(L.current),q.current=e,()=>{q.current&&q.current.disconnect()}},[E,N,S,P,M]);let U=H?u:[{label:"全部",value:""},...v.map(e=>({label:e.type_name,value:e.type_id}))],A=[{label:"全部资源站",value:"all"},...e.map(e=>({label:e.name,value:e.key}))],B=!N&&!S&&0===k.length&&!Z&&!!a;return(0,l.jsx)(n.Z,{activePath:"/filter",children:(0,l.jsxs)("div",{className:"px-2 sm:px-4 py-4 sm:py-8 overflow-visible",children:[(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 mb-1 sm:mb-2 dark:text-gray-200 flex items-center gap-2",children:[(0,l.jsx)(r.Z,{className:"w-7 h-7 text-purple-500"}),"筛选"]}),(0,l.jsx)("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"按分类、地区(如香港)、年份精准筛选影片"})]}),(0,l.jsxs)("div",{className:"bg-white/60 dark:bg-gray-800/40 rounded-2xl p-4 sm:p-6 border border-gray-200/30 dark:border-gray-700/30 backdrop-blur-sm space-y-4",children:[(0,l.jsx)(h,{label:"资源站",options:A.slice(0,13),value:a,onChange:p}),U.length>1&&(0,l.jsx)(h,{label:"分类",options:U.slice(0,40),value:g,onChange:m}),(0,l.jsx)(h,{label:"地区",options:c,value:b,onChange:f}),(0,l.jsx)(h,{label:"年份",options:d,value:y,onChange:w}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsxs)("button",{onClick:()=>{m(""),f(""),w("")},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs sm:text-sm text-gray-600 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 transition-colors",children:[(0,l.jsx)(s,{className:"w-4 h-4"}),"重置筛选"]})})]}),(0,l.jsxs)("div",{className:"mt-8",children:[Z&&(0,l.jsx)("div",{className:"text-center text-red-500 py-8",children:Z}),N&&0===k.length&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:Array.from({length:12}).map((e,t)=>(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("div",{className:"relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-purple-200 animate-pulse dark:bg-purple-800",children:(0,l.jsx)("div",{className:"absolute inset-0 bg-purple-300 dark:bg-purple-700"})}),(0,l.jsx)("div",{className:"mt-2 h-4 bg-purple-200 rounded animate-pulse dark:bg-purple-800"})]},t))}),k.length>0&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 px-0 sm:px-1 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:k.map((e,t)=>(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(i.Z,{from:"search",id:e.id,source:e.source,source_name:e.source_name,title:e.title,poster:e.poster,year:e.year,episodes:e.episodes,type:e.episodes>1?"tv":"movie"})},"".concat(e.source,"-").concat(e.id,"-").concat(t)))}),B&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-12 dark:text-gray-400",children:"暂无符合条件的内容,试试更换筛选条件或资源站"}),E&&k.length>0&&(0,l.jsx)("div",{ref:e=>{e&&null!==e.offsetParent&&(L.current=e)},className:"flex justify-center mt-12 py-8",children:S&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-purple-500"}),(0,l.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"加载中..."})]})}),!E&&k.length>0&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-8 dark:text-gray-400",children:H?"已聚合展示各资源站结果":"已加载全部内容"})]})]})})}function v(){return(0,l.jsx)(p,{})}},1187:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var l=a(4393);let r=e=>{let{aspectRatio:t}=e;return(0,l.jsx)("div",{className:"w-full ".concat(t," rounded-lg"),style:{background:"linear-gradient(90deg, var(--skeleton-color) 25%, var(--skeleton-highlight) 50%, var(--skeleton-color) 75%)",backgroundSize:"200% 100%",animation:"shine 1.5s infinite"},children:(0,l.jsx)("style",{children:"\n @keyframes shine {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n \n /* 亮色模式变量 */\n :root {\n --skeleton-color: #f0f0f0;\n --skeleton-highlight: #e0e0e0;\n }\n \n /* 暗色模式变量 */\n @media (prefers-color-scheme: dark) {\n :root {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n }\n \n .dark {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n "})})}},6501:function(e,t,a){"use strict";a.d(t,{Z:function(){return v}});var l=a(4393),r=a(4727),s=a(41),o=a(4187),n=a(9564),i=a(7944),c=a(1698),u=a(4908),d=a(7467),h=a(1802),p=a(1187);function v(e){var t,a,v,x,g,m,b,f;let{id:y,title:w="",query:k="",poster:j="",episodes:N,source:C,source_name:S,progress:_=0,year:P,from:R,currentEpisode:E,douban_id:D,onDelete:Z,rate:I,items:L,type:q=""}=e,z=(0,c.useRouter)(),[H,M]=(0,u.useState)(!1),[U,A]=(0,u.useState)(!1),B="search"===R&&!!(null==L?void 0:L.length),F=(0,u.useMemo)(()=>{if(!B||!L)return null;let e=new Map,t=new Map;L.forEach(a=>{var l;a.douban_id&&0!==a.douban_id&&e.set(a.douban_id,(e.get(a.douban_id)||0)+1);let r=(null===(l=a.episodes)||void 0===l?void 0:l.length)||0;r>0&&t.set(r,(t.get(r)||0)+1)});let a=e=>{let t,a=0;return e.forEach((e,l)=>{e>a&&(a=e,t=l)}),t};return{first:L[0],mostFrequentDoubanId:a(e),mostFrequentEpisodes:a(t)||0}},[B,L]),O=null!==(a=null==F?void 0:F.first.title)&&void 0!==a?a:w,T=null!==(v=null==F?void 0:F.first.poster)&&void 0!==v?v:j,J=null!==(x=null==F?void 0:F.first.source)&&void 0!==x?x:C,W=null!==(g=null==F?void 0:F.first.id)&&void 0!==g?g:y,Y=String(null!==(m=null==F?void 0:F.mostFrequentDoubanId)&&void 0!==m?m:D),G=null!==(b=null==F?void 0:F.mostFrequentEpisodes)&&void 0!==b?b:N,K=null!==(f=null==F?void 0:F.first.year)&&void 0!==f?f:P,Q=k||"",V=B?(null==F?void 0:null===(t=F.first.episodes)||void 0===t?void 0:t.length)===1?"movie":"tv":q;(0,u.useEffect)(()=>{if("douban"===R||!J||!W)return;(async()=>{try{let e=await (0,d.at)(J,W);M(e)}catch(e){throw Error("检查收藏状态失败")}})();let e=(0,d.sO)(J,W);return(0,d.rq)("favoritesUpdated",t=>{M(!!t[e])})},[R,J,W]);let X=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"douban"!==R&&J&&W)try{H?(await (0,d.r7)(J,W),M(!1)):(await (0,d.qn)(J,W,{title:O,source_name:S||"",year:K||"",cover:T,total_episodes:null!=G?G:1,save_time:Date.now()}),M(!0))}catch(e){throw Error("切换收藏状态失败")}},[R,J,W,O,S,K,T,G,H]),$=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"playrecord"===R&&J&&W)try{await (0,d.Ji)(J,W),null==Z||Z()}catch(e){throw Error("删除播放记录失败")}},[R,J,W,Z]),ee=(0,u.useCallback)(()=>{"douban"===R?z.push("/play?title=".concat(encodeURIComponent(O.trim())).concat(K?"&year=".concat(K):"").concat(V?"&stype=".concat(V):"")):J&&W&&z.push("/play?source=".concat(J,"&id=").concat(W,"&title=").concat(encodeURIComponent(O)).concat(K?"&year=".concat(K):"").concat(B?"&prefer=true":"").concat(Q?"&stitle=".concat(encodeURIComponent(Q.trim())):"").concat(V?"&stype=".concat(V):""))},[R,J,W,z,O,K,B,Q,V]),et=(0,u.useMemo)(()=>{let e={playrecord:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!0,showDoubanLink:!1,showRating:!1},favorite:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!1,showDoubanLink:!1,showRating:!1},search:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!B,showCheckCircle:!1,showDoubanLink:!!Y,showRating:!1},douban:{showSourceName:!1,showProgress:!1,showPlayButton:!0,showHeart:!1,showCheckCircle:!1,showDoubanLink:!0,showRating:!!I}};return e[R]||e.search},[R,B,Y,I]);return(0,l.jsxs)("div",{className:"group relative w-full rounded-lg bg-transparent cursor-pointer transition-all duration-300 ease-in-out hover:scale-[1.05] hover:z-[500]",onClick:ee,children:[(0,l.jsxs)("div",{className:"relative aspect-[2/3] overflow-hidden rounded-lg",children:[!U&&(0,l.jsx)(p.Z,{aspectRatio:"aspect-[2/3]"}),(0,l.jsx)(i.default,{src:(0,h.a8)(T),alt:O,fill:!0,className:"object-cover",referrerPolicy:"no-referrer",onLoadingComplete:()=>A(!0)}),(0,l.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100"}),et.showPlayButton&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-all duration-300 ease-in-out delay-75 group-hover:opacity-100 group-hover:scale-100",children:(0,l.jsx)(r.Z,{size:50,strokeWidth:.8,className:"text-white fill-transparent transition-all duration-300 ease-out hover:fill-green-500 hover:scale-[1.1]"})}),(et.showHeart||et.showCheckCircle)&&(0,l.jsxs)("div",{className:"absolute bottom-3 right-3 flex gap-3 opacity-0 translate-y-2 transition-all duration-300 ease-in-out group-hover:opacity-100 group-hover:translate-y-0",children:[et.showCheckCircle&&(0,l.jsx)(s.Z,{onClick:$,size:20,className:"text-white transition-all duration-300 ease-out hover:stroke-green-500 hover:scale-[1.1]"}),et.showHeart&&(0,l.jsx)(o.Z,{onClick:X,size:20,className:"transition-all duration-300 ease-out ".concat(H?"fill-red-600 stroke-red-600":"fill-transparent stroke-white hover:stroke-red-400"," hover:scale-[1.1]")})]}),et.showRating&&I&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-pink-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:I}),G&&G>1&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-green-500 text-white text-xs font-semibold px-2 py-1 rounded-md shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:E?"".concat(E,"/").concat(G):G}),et.showDoubanLink&&Y&&(0,l.jsx)("a",{href:"https://movie.douban.com/subject/".concat(Y),target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"absolute top-2 left-2 opacity-0 -translate-x-2 transition-all duration-300 ease-in-out delay-100 group-hover:opacity-100 group-hover:translate-x-0",children:(0,l.jsx)("div",{className:"bg-green-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md hover:bg-green-600 hover:scale-[1.1] transition-all duration-300 ease-out",children:(0,l.jsx)(n.Z,{size:16})})})]}),et.showProgress&&void 0!==_&&(0,l.jsx)("div",{className:"mt-1 h-1 w-full bg-gray-200 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-green-500 transition-all duration-500 ease-out",style:{width:"".concat(_,"%")}})}),(0,l.jsxs)("div",{className:"mt-2 text-center",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("span",{className:"block text-sm font-semibold truncate text-gray-900 dark:text-gray-100 transition-colors duration-300 ease-in-out group-hover:text-green-600 dark:group-hover:text-green-400 peer",children:O}),(0,l.jsxs)("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-1 bg-gray-800 text-white text-xs rounded-md shadow-lg opacity-0 invisible peer-hover:opacity-100 peer-hover:visible transition-all duration-200 ease-out delay-100 whitespace-nowrap pointer-events-none",children:[O,(0,l.jsx)("div",{className:"absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-800"})]})]}),et.showSourceName&&S&&(0,l.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:(0,l.jsx)("span",{className:"inline-block border rounded px-2 py-0.5 border-gray-500/60 dark:border-gray-400/60 transition-all duration-300 ease-in-out group-hover:border-green-500/60 group-hover:text-green-600 dark:group-hover:text-green-400",children:S})})]})]})}}},function(e){e.O(0,[447,256,609,402,78,541,242,744],function(){return e(e.s=3747)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[923],{3747:function(e,t,a){Promise.resolve().then(a.bind(a,805))},805:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var l=a(4393),r=a(5538);let s=(0,a(4123).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var o=a(4908),n=a(6402),i=a(6501);let c=[{label:"全部",value:""},{label:"香港",value:"香港"},{label:"大陆",value:"大陆"},{label:"台湾",value:"台湾"},{label:"美国",value:"美国"},{label:"日本",value:"日本"},{label:"韩国",value:"韩国"},{label:"泰国",value:"泰国"},{label:"英国",value:"英国"},{label:"法国",value:"法国"}],u=[{label:"全部",value:""},{label:"4K",value:"4K"},{label:"AI短剧",value:"AI短剧"},{label:"电影",value:"电影"},{label:"电视剧",value:"电视剧"},{label:"连续剧",value:"连续剧"},{label:"综艺",value:"综艺"},{label:"动漫",value:"动漫"},{label:"动作片",value:"动作片"},{label:"喜剧片",value:"喜剧片"},{label:"爱情片",value:"爱情片"},{label:"科幻片",value:"科幻片"},{label:"恐怖片",value:"恐怖片"},{label:"剧情片",value:"剧情片"},{label:"战争片",value:"战争片"},{label:"国产剧",value:"国产剧"},{label:"香港剧",value:"香港剧"},{label:"台湾剧",value:"台湾剧"},{label:"欧美剧",value:"欧美剧"},{label:"韩国剧",value:"韩国剧"},{label:"日本剧",value:"日本剧"},{label:"泰国剧",value:"泰国剧"},{label:"海外剧",value:"海外剧"},{label:"大陆综艺",value:"大陆综艺"},{label:"港台综艺",value:"港台综艺"},{label:"日韩综艺",value:"日韩综艺"},{label:"欧美综艺",value:"欧美综艺"},{label:"国产动漫",value:"国产动漫"},{label:"日韩动漫",value:"日韩动漫"},{label:"欧美动漫",value:"欧美动漫"},{label:"港台动漫",value:"港台动漫"},{label:"记录片",value:"记录片"},{label:"短剧",value:"短剧"}],d=function(){let e=[{label:"全部",value:""}],t=new Date().getFullYear();for(let a=t;a>=t-15;a--)e.push({label:"".concat(a),value:"".concat(a)});return e}();function h(e){let{label:t,options:a,value:r,onChange:s}=e;return(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsx)("span",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400 min-w-[48px]",children:t}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>{let t=r===e.value;return(0,l.jsx)("button",{onClick:()=>s(e.value),className:"px-3 py-1.5 text-xs sm:text-sm font-medium rounded-full transition-all duration-200 whitespace-nowrap ".concat(t?"bg-purple-500 text-white shadow-sm":"bg-gray-200/60 text-gray-700 hover:bg-gray-300/60 dark:bg-gray-700/60 dark:text-gray-300 dark:hover:bg-gray-600/60"),children:e.label},e.value||"all")})})]})}function p(){let[e,t]=(0,o.useState)([]),[a,p]=(0,o.useState)("all"),[v,x]=(0,o.useState)([]),[g,m]=(0,o.useState)(""),[b,f]=(0,o.useState)(""),[y,w]=(0,o.useState)(""),[k,j]=(0,o.useState)([]),[N,C]=(0,o.useState)(!1),[S,_]=(0,o.useState)(!1),[P,R]=(0,o.useState)(1),[E,D]=(0,o.useState)(!0),[Z,I]=(0,o.useState)(""),L=(0,o.useRef)(null),q=(0,o.useRef)(null),z=(0,o.useRef)(0),H="all"===a;(0,o.useEffect)(()=>{(async()=>{try{var e;let a=await fetch("/api/filter?action=sources"),l=await a.json();(null===(e=l.sources)||void 0===e?void 0:e.length)&&(t(l.sources),p("all"))}catch(e){I("加载资源站列表失败")}})()},[]),(0,o.useEffect)(()=>{if(H){x([]),m("");return}a&&(async()=>{try{x([]),m("");let e=await fetch("/api/filter?action=classes&source=".concat(encodeURIComponent(a))),t=await e.json();Array.isArray(t.classes)&&x(t.classes)}catch(e){}})()},[a,H]);let M=(0,o.useCallback)(async(e,t)=>{if(!a)return;let l=++z.current;t?(C(!0),I("")):_(!0);try{let r=new URLSearchParams({action:"browse",source:a,pg:String(e)});H?g&&r.set("cat",g):g&&r.set("t",g),b&&r.set("area",b),y&&r.set("year",y);let s=await fetch("/api/filter?".concat(r.toString())),o=await s.json();if(l!==z.current)return;if(o.error){I(o.error);return}let n=Array.isArray(o.list)?o.list:[];j(e=>{let a=t?n:[...e,...n],s=new Set;return a.filter(x=>{let k=x.title+"|"+x.year;return!s.has(k)&&(s.add(k),!0)})}),R(o.next_pg||e+1),D(!!o.has_more&&n.length>0)}catch(e){l===z.current&&I("加载失败,请稍后重试")}finally{l===z.current&&(C(!1),_(!1))}},[a,g,b,y,H]);(0,o.useEffect)(()=>{if(!a)return;j([]),R(1),D(!0);let e=setTimeout(()=>M(1,!0),100);return()=>clearTimeout(e)},[a,g,b,y,M]),(0,o.useEffect)(()=>{if(!E||N||S||!L.current)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&E&&!N&&!S&&M(P,!1)},{threshold:.1});return e.observe(L.current),q.current=e,()=>{q.current&&q.current.disconnect()}},[E,N,S,P,M]);let U=H?u:[{label:"全部",value:""},...v.map(e=>({label:e.type_name,value:e.type_id}))],A=[{label:"全部资源站",value:"all"},...e.map(e=>({label:e.name,value:e.key}))],B=!N&&!S&&0===k.length&&!Z&&!!a;return(0,l.jsx)(n.Z,{activePath:"/filter",children:(0,l.jsxs)("div",{className:"px-2 sm:px-4 py-4 sm:py-8 overflow-visible",children:[(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-800 mb-1 sm:mb-2 dark:text-gray-200 flex items-center gap-2",children:[(0,l.jsx)(r.Z,{className:"w-7 h-7 text-purple-500"}),"筛选"]}),(0,l.jsx)("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"按分类、地区(如香港)、年份精准筛选影片"})]}),(0,l.jsxs)("div",{className:"bg-white/60 dark:bg-gray-800/40 rounded-2xl p-4 sm:p-6 border border-gray-200/30 dark:border-gray-700/30 backdrop-blur-sm space-y-4",children:[(0,l.jsx)(h,{label:"资源站",options:A.slice(0,13),value:a,onChange:p}),U.length>1&&(0,l.jsx)(h,{label:"分类",options:U.slice(0,40),value:g,onChange:m}),(0,l.jsx)(h,{label:"地区",options:c,value:b,onChange:f}),(0,l.jsx)(h,{label:"年份",options:d,value:y,onChange:w}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsxs)("button",{onClick:()=>{m(""),f(""),w("")},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs sm:text-sm text-gray-600 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 transition-colors",children:[(0,l.jsx)(s,{className:"w-4 h-4"}),"重置筛选"]})})]}),(0,l.jsxs)("div",{className:"mt-8",children:[Z&&(0,l.jsx)("div",{className:"text-center text-red-500 py-8",children:Z}),N&&0===k.length&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:Array.from({length:12}).map((e,t)=>(0,l.jsxs)("div",{className:"w-full",children:[(0,l.jsx)("div",{className:"relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-purple-200 animate-pulse dark:bg-purple-800",children:(0,l.jsx)("div",{className:"absolute inset-0 bg-purple-300 dark:bg-purple-700"})}),(0,l.jsx)("div",{className:"mt-2 h-4 bg-purple-200 rounded animate-pulse dark:bg-purple-800"})]},t))}),k.length>0&&(0,l.jsx)("div",{className:"grid grid-cols-3 gap-x-2 gap-y-12 px-0 sm:px-1 sm:grid-cols-[repeat(auto-fill,minmax(140px,1fr))] sm:gap-x-6 sm:gap-y-16",children:k.map((e,t)=>(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(i.Z,{from:"search",id:e.id,source:e.source,source_name:e.source_name,title:e.title,poster:e.poster,year:e.year,episodes:e.episodes,type:e.episodes>1?"tv":"movie"})},"".concat(e.source,"-").concat(e.id,"-").concat(t)))}),B&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-12 dark:text-gray-400",children:"暂无符合条件的内容,试试更换筛选条件或资源站"}),E&&k.length>0&&(0,l.jsx)("div",{ref:e=>{e&&null!==e.offsetParent&&(L.current=e)},className:"flex justify-center mt-12 py-8",children:S&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-purple-500"}),(0,l.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"加载中..."})]})}),!E&&k.length>0&&(0,l.jsx)("div",{className:"text-center text-gray-500 py-8 dark:text-gray-400",children:H?"已聚合展示各资源站结果":"已加载全部内容"})]})]})})}function v(){return(0,l.jsx)(p,{})}},1187:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var l=a(4393);let r=e=>{let{aspectRatio:t}=e;return(0,l.jsx)("div",{className:"w-full ".concat(t," rounded-lg"),style:{background:"linear-gradient(90deg, var(--skeleton-color) 25%, var(--skeleton-highlight) 50%, var(--skeleton-color) 75%)",backgroundSize:"200% 100%",animation:"shine 1.5s infinite"},children:(0,l.jsx)("style",{children:"\n @keyframes shine {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n \n /* 亮色模式变量 */\n :root {\n --skeleton-color: #f0f0f0;\n --skeleton-highlight: #e0e0e0;\n }\n \n /* 暗色模式变量 */\n @media (prefers-color-scheme: dark) {\n :root {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n }\n \n .dark {\n --skeleton-color: #2d2d2d;\n --skeleton-highlight: #3d3d3d;\n }\n "})})}},6501:function(e,t,a){"use strict";a.d(t,{Z:function(){return v}});var l=a(4393),r=a(4727),s=a(41),o=a(4187),n=a(9564),i=a(7944),c=a(1698),u=a(4908),d=a(7467),h=a(1802),p=a(1187);function v(e){var t,a,v,x,g,m,b,f;let{id:y,title:w="",query:k="",poster:j="",episodes:N,source:C,source_name:S,progress:_=0,year:P,from:R,currentEpisode:E,douban_id:D,onDelete:Z,rate:I,items:L,type:q=""}=e,z=(0,c.useRouter)(),[H,M]=(0,u.useState)(!1),[U,A]=(0,u.useState)(!1),B="search"===R&&!!(null==L?void 0:L.length),F=(0,u.useMemo)(()=>{if(!B||!L)return null;let e=new Map,t=new Map;L.forEach(a=>{var l;a.douban_id&&0!==a.douban_id&&e.set(a.douban_id,(e.get(a.douban_id)||0)+1);let r=(null===(l=a.episodes)||void 0===l?void 0:l.length)||0;r>0&&t.set(r,(t.get(r)||0)+1)});let a=e=>{let t,a=0;return e.forEach((e,l)=>{e>a&&(a=e,t=l)}),t};return{first:L[0],mostFrequentDoubanId:a(e),mostFrequentEpisodes:a(t)||0}},[B,L]),O=null!==(a=null==F?void 0:F.first.title)&&void 0!==a?a:w,T=null!==(v=null==F?void 0:F.first.poster)&&void 0!==v?v:j,J=null!==(x=null==F?void 0:F.first.source)&&void 0!==x?x:C,W=null!==(g=null==F?void 0:F.first.id)&&void 0!==g?g:y,Y=String(null!==(m=null==F?void 0:F.mostFrequentDoubanId)&&void 0!==m?m:D),G=null!==(b=null==F?void 0:F.mostFrequentEpisodes)&&void 0!==b?b:N,K=null!==(f=null==F?void 0:F.first.year)&&void 0!==f?f:P,Q=k||"",V=B?(null==F?void 0:null===(t=F.first.episodes)||void 0===t?void 0:t.length)===1?"movie":"tv":q;(0,u.useEffect)(()=>{if("douban"===R||!J||!W)return;(async()=>{try{let e=await (0,d.at)(J,W);M(e)}catch(e){throw Error("检查收藏状态失败")}})();let e=(0,d.sO)(J,W);return(0,d.rq)("favoritesUpdated",t=>{M(!!t[e])})},[R,J,W]);let X=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"douban"!==R&&J&&W)try{H?(await (0,d.r7)(J,W),M(!1)):(await (0,d.qn)(J,W,{title:O,source_name:S||"",year:K||"",cover:T,total_episodes:null!=G?G:1,save_time:Date.now()}),M(!0))}catch(e){throw Error("切换收藏状态失败")}},[R,J,W,O,S,K,T,G,H]),$=(0,u.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),"playrecord"===R&&J&&W)try{await (0,d.Ji)(J,W),null==Z||Z()}catch(e){throw Error("删除播放记录失败")}},[R,J,W,Z]),ee=(0,u.useCallback)(()=>{"douban"===R?z.push("/play?title=".concat(encodeURIComponent(O.trim())).concat(K?"&year=".concat(K):"").concat(V?"&stype=".concat(V):"")):J&&W&&z.push("/play?source=".concat(J,"&id=").concat(W,"&title=").concat(encodeURIComponent(O)).concat(K?"&year=".concat(K):"").concat(B?"&prefer=true":"").concat(Q?"&stitle=".concat(encodeURIComponent(Q.trim())):"").concat(V?"&stype=".concat(V):""))},[R,J,W,z,O,K,B,Q,V]),et=(0,u.useMemo)(()=>{let e={playrecord:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!0,showDoubanLink:!1,showRating:!1},favorite:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!0,showCheckCircle:!1,showDoubanLink:!1,showRating:!1},search:{showSourceName:!0,showProgress:!1,showPlayButton:!0,showHeart:!B,showCheckCircle:!1,showDoubanLink:!!Y,showRating:!1},douban:{showSourceName:!1,showProgress:!1,showPlayButton:!0,showHeart:!1,showCheckCircle:!1,showDoubanLink:!0,showRating:!!I}};return e[R]||e.search},[R,B,Y,I]);return(0,l.jsxs)("div",{className:"group relative w-full rounded-lg bg-transparent cursor-pointer transition-all duration-300 ease-in-out hover:scale-[1.05] hover:z-[500]",onClick:ee,children:[(0,l.jsxs)("div",{className:"relative aspect-[2/3] overflow-hidden rounded-lg",children:[!U&&(0,l.jsx)(p.Z,{aspectRatio:"aspect-[2/3]"}),(0,l.jsx)(i.default,{src:(0,h.a8)(T),alt:O,fill:!0,className:"object-cover",referrerPolicy:"no-referrer",onLoadingComplete:()=>A(!0)}),(0,l.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent opacity-0 transition-opacity duration-300 ease-in-out group-hover:opacity-100"}),et.showPlayButton&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-all duration-300 ease-in-out delay-75 group-hover:opacity-100 group-hover:scale-100",children:(0,l.jsx)(r.Z,{size:50,strokeWidth:.8,className:"text-white fill-transparent transition-all duration-300 ease-out hover:fill-green-500 hover:scale-[1.1]"})}),(et.showHeart||et.showCheckCircle)&&(0,l.jsxs)("div",{className:"absolute bottom-3 right-3 flex gap-3 opacity-0 translate-y-2 transition-all duration-300 ease-in-out group-hover:opacity-100 group-hover:translate-y-0",children:[et.showCheckCircle&&(0,l.jsx)(s.Z,{onClick:$,size:20,className:"text-white transition-all duration-300 ease-out hover:stroke-green-500 hover:scale-[1.1]"}),et.showHeart&&(0,l.jsx)(o.Z,{onClick:X,size:20,className:"transition-all duration-300 ease-out ".concat(H?"fill-red-600 stroke-red-600":"fill-transparent stroke-white hover:stroke-red-400"," hover:scale-[1.1]")})]}),et.showRating&&I&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-pink-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:I}),G&&G>1&&(0,l.jsx)("div",{className:"absolute top-2 right-2 bg-green-500 text-white text-xs font-semibold px-2 py-1 rounded-md shadow-md transition-all duration-300 ease-out group-hover:scale-110",children:E?"".concat(E,"/").concat(G):G}),et.showDoubanLink&&Y&&(0,l.jsx)("a",{href:"https://movie.douban.com/subject/".concat(Y),target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"absolute top-2 left-2 opacity-0 -translate-x-2 transition-all duration-300 ease-in-out delay-100 group-hover:opacity-100 group-hover:translate-x-0",children:(0,l.jsx)("div",{className:"bg-green-500 text-white text-xs font-bold w-7 h-7 rounded-full flex items-center justify-center shadow-md hover:bg-green-600 hover:scale-[1.1] transition-all duration-300 ease-out",children:(0,l.jsx)(n.Z,{size:16})})})]}),et.showProgress&&void 0!==_&&(0,l.jsx)("div",{className:"mt-1 h-1 w-full bg-gray-200 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-green-500 transition-all duration-500 ease-out",style:{width:"".concat(_,"%")}})}),(0,l.jsxs)("div",{className:"mt-2 text-center",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("span",{className:"block text-sm font-semibold truncate text-gray-900 dark:text-gray-100 transition-colors duration-300 ease-in-out group-hover:text-green-600 dark:group-hover:text-green-400 peer",children:O}),(0,l.jsxs)("div",{className:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-1 bg-gray-800 text-white text-xs rounded-md shadow-lg opacity-0 invisible peer-hover:opacity-100 peer-hover:visible transition-all duration-200 ease-out delay-100 whitespace-nowrap pointer-events-none",children:[O,(0,l.jsx)("div",{className:"absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-800"})]})]}),et.showSourceName&&S&&(0,l.jsx)("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:(0,l.jsx)("span",{className:"inline-block border rounded px-2 py-0.5 border-gray-500/60 dark:border-gray-400/60 transition-all duration-300 ease-in-out group-hover:border-green-500/60 group-hover:text-green-600 dark:group-hover:text-green-400",children:S})})]})]})}}},function(e){e.O(0,[447,256,609,402,78,541,242,744],function(){return e(e.s=3747)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/patches/inject_live.py b/patches/inject_live.py index a585f11..47fcd76 100644 --- a/patches/inject_live.py +++ b/patches/inject_live.py @@ -11,10 +11,10 @@ HOOK_OLD = 'try{let _lv=new URL(e.url).searchParams.get("live");if(_lv)return aw HOOK = 'try{let _lurl=new URL(e.url),_lv=_lurl.searchParams.get("live");if(!_lv&&_lurl.pathname==="/live")_lv="page";if(_lv)return await LIVE(_lv,e)}catch(_le){console.log("[LIVE-HOOK]",_le&&_le.message)}' def read(p): - return subprocess.run(["docker","exec","katelyatv","cat",p],capture_output=True,check=True).stdout.decode() + return subprocess.run(["docker","exec","-u","root","katelyatv","cat",p],capture_output=True,check=True).stdout.decode() def write(p, data): - r=subprocess.run(["docker","exec","-i","katelyatv","sh","-c",f"cat > {p}"],input=data.encode(),capture_output=True) + r=subprocess.run(["docker","exec","-u","root","-i","katelyatv","sh","-c",f"cat > {p}"],input=data.encode(),capture_output=True) assert r.returncode==0, r.stderr.decode()[:300] # ---- 1) route.js: 删旧块+插新块+入口钩子 ---- @@ -60,9 +60,10 @@ if not any(x.get("source") == "/live" for x in af): # ---- 4) TVBOX lives 死链修复:指向直播文本源 ---- OLD_LIVES = 'lives:[{name:"KatelyaTV直播",type:0,url:`${i}/api/live/channels`,epg:"",logo:""}]' NEW_LIVES = 'lives:[{name:"电视直播",type:0,url:`${i}/api/tvbox?live=txt`,ua:"Mozilla/5.0",epg:"",logo:""}]' -if 'live=txt' not in src: +if OLD_LIVES in src: assert src.count(OLD_LIVES) == 1, "lives anchor" src = src.replace(OLD_LIVES, NEW_LIVES, 1) + # write + check with tempfile.NamedTemporaryFile('w', suffix='.js', delete=False) as f: f.write(src); tmp = f.name r = subprocess.run(['node', '--check', tmp], capture_output=True, text=True) @@ -70,5 +71,7 @@ if 'live=txt' not in src: assert r.returncode == 0, r.stderr[:600] write(P, src) print("config lives -> live=txt") +else: + print("lives already migrated or anchor missing") print("DONE - restart container to apply") diff --git a/patches/live-inject.js b/patches/live-inject.js index 43603e2..394634a 100644 --- a/patches/live-inject.js +++ b/patches/live-inject.js @@ -151,7 +151,7 @@ select{background:#171b24;color:#e5e7eb;border:1px solid #2a3140;border-radius:6 .sec{font-size:13px;color:#6b7280;margin:2px 0 8px} .empty{color:#6b7280;font-size:13px;padding:20px 0;text-align:center} -
‹

电视直播 · 港澳台

⭐ 开源地址 +
‹

电视直播 · 港澳台

⭐ 开源地址
TVBox / 影视仓 · 接入直播
配置地址(含直播,推荐)—
@@ -192,13 +192,15 @@ function playSrc(u,flv){ v.onplaying=function(){stopTick();tip.style.display='none'}; } bigplay.addEventListener('click',function(){v.muted=false;bigplay.style.display='none';v.play().catch(function(){})}); -v.addEventListener('click',function(){if(v.muted){v.muted=false;bigplay.style.display='none'}}); +v.addEventListener('click',function(){ if(v.muted){v.muted=false;bigplay.style.display='none'}; if(v.paused){ var pr=v.play(); if(pr&&pr.catch)pr.catch(function(){bigplay.style.display='flex'}) } else { v.pause() } }); var btnPP=document.getElementById('btnPP'),btnMute=document.getElementById('btnMute'); function syncCtrl(){ btnPP.textContent=v.paused?'▶':'⏸'; btnPP.title=v.paused?'播放':'暂停'; btnMute.textContent=v.muted?'🔇':'🔊'; btnMute.title=v.muted?'开启声音':'静音'; + bigplay.style.display=v.paused?'flex':'none'; + if(!v.paused) tip.style.display='none'; } btnPP.addEventListener('click',function(e){e.stopPropagation(); if(v.paused){var pr=v.play();if(pr&&pr.catch)pr.catch(function(){})}else{v.pause()} diff --git a/patches/patch-aidrama-menu.js b/patches/patch-aidrama-menu.js new file mode 100644 index 0000000..8c37148 --- /dev/null +++ b/patches/patch-aidrama-menu.js @@ -0,0 +1,16 @@ +// 顶部/底部菜单加入 AI短剧 入口(电脑端顶部菜单 + 移动端同步) +const fs = require("fs"); +const dir = "/app/.next/static/chunks/"; +const files = fs.readdirSync(dir).filter(f => /^402-.*\.js$/.test(f)); +if (files.length !== 1) { console.log("expected 1 402 chunk, found", files); process.exit(0); } +const t = dir + files[0]; +const MARK = "/*AI-DRAMA-MENU*/"; +let s = fs.readFileSync(t, "utf8"); +if (s.includes(MARK)) { console.log("ai-drama-menu: skip (already)"); process.exit(0); } +const needle = '{icon:o.Z,label:"直播",href:"/live"}'; +const repl = needle + ',{icon:o.Z,label:"AI短剧",href:"/search?q=AI%E7%9F%AD%E5%89%A7"}' + MARK; +const cnt = (s.match(new RegExp(needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g')) || []).length; +if (cnt === 0) { console.error("needle not found"); process.exit(1); } +s = s.split(needle).join(repl); +fs.writeFileSync(t, s); +console.log("ai-drama-menu: injected in", cnt, "locations"); diff --git a/patches/patch-announcement.js b/patches/patch-announcement.js new file mode 100644 index 0000000..ca5e568 --- /dev/null +++ b/patches/patch-announcement.js @@ -0,0 +1,20 @@ +// 把根布局的免责声明公告改为动态读取授权系统(CardAuth)公告 +// 幂等:含标记则跳过。失败开放(fail-open):授权系统异常时保留原公告。 +const fs = require("fs"); +const target = "/app/.next/server/chunks/8583.js"; +const MARK = "/*ANN-CARD*/"; +if (!fs.existsSync(target)) { console.log("8583.js not found"); process.exit(0); } +let s = fs.readFileSync(target, "utf8"); +if (s.includes(MARK)) { console.log("layout-announcement: skip (already)"); process.exit(0); } +const anchor = '}let u={STORAGE_TYPE:process.env.NEXT_PUBLIC_STORAGE_TYPE||"localstorage",ENABLE_REGISTER:n,IMAGE_PROXY:o,DOUBAN_PROXY:p};return'; +const idx = s.indexOf(anchor); +if (idx < 0) { console.error("anchor not found"); process.exit(1); } +const di = s.indexOf("async function d({children"); +if (di < 0 || idx < di) { console.error("anchor not inside layout d()"); process.exit(1); } +const inject = ';' + MARK + + 'try{const __rc=await fetch("http://127.0.0.1:3000/api/license-config",{cache:"no-store",signal:AbortSignal.timeout(1500)}).then(x=>x.json());' + + 'if(__rc&&200===__rc.code&&__rc.data&&__rc.data.announcement&&__rc.data.announcement.content){s=String(__rc.data.announcement.content)}}catch(__e){}' + + anchor; +s = s.slice(0, idx) + inject + s.slice(idx + anchor.length); +fs.writeFileSync(target, s); +console.log("layout-announcement: injected"); diff --git a/patches/patch-hubnotice-remove.js b/patches/patch-hubnotice-remove.js new file mode 100644 index 0000000..d199ee5 --- /dev/null +++ b/patches/patch-hubnotice-remove.js @@ -0,0 +1,18 @@ +// 移除 HubNotice 弹窗挂载,避免与原生公告弹窗重复 +const fs = require("fs"); +const target = "/app/.next/static/chunks/402-" + /* placeholder */ "3f8ac71d6e5b0924" + ".js"; +// find the chunk dynamically +const dir = "/app/.next/static/chunks/"; +const fs2 = require("fs"); +const files = fs2.readdirSync(dir).filter(f => /^402-.*\.js$/.test(f)); +if (files.length !== 1) { console.log("expected 1 402 chunk, found", files); process.exit(0); } +const t = dir + files[0]; +const MARK = "/*HUBNOTICE-REMOVED*/"; +let s = fs2.readFileSync(t, "utf8"); +if (s.includes(MARK)) { console.log("hubnotice-remove: skip (already)"); process.exit(0); } +const needle = "(0,a.jsx)(HubNotice,{})"; +const idx = s.indexOf(needle); +if (idx < 0) { console.error("HubNotice mount not found"); process.exit(1); } +s = s.slice(0, idx) + MARK + s.slice(idx + needle.length); +fs2.writeFileSync(t, s); +console.log("hubnotice-remove: removed mount in", files[0]); diff --git a/patches/patch_license.js b/patches/patch_license.js index a4dfb86..683d978 100644 --- a/patches/patch_license.js +++ b/patches/patch_license.js @@ -208,7 +208,7 @@ function writeChecked(p, s) { log("tvbox: notice+warning v2 injected"); })(); -// ---------- 6) IPv6 智能跳转探针(客户端检测 IPv6 可达 → 直连 tv6.88531.cn 省服务器流量) ---------- +// ---------- 6) IPv6 智能跳转:首次访问弹选择页,已选则直跳上次选择的线路 ---------- (function () { const dir = "/app/.next/static/chunks"; let target = null; @@ -220,6 +220,8 @@ function writeChecked(p, s) { } if (!target) { failures.push("v6-probe: nav chunk not found"); return; } let s = FS.readFileSync(target, "utf8"); + // 清理旧版探针(V1 自动跳转 / V2 旧版) + s = s.replace(/\/\*V6-PROBE-V[12]\*\/.*?catch\(e\)\{\}\s*/s, ""); if (s.includes("/*V6-PROBE-V1*/")) { log("v6-probe: skip (already)"); return; } const probe = '/*V6-PROBE-V1*/try{if("tv.88531.cn"===location.hostname){var __v6k="__v6dest";var __v6t=+(localStorage.getItem(__v6k+"_t")||0);if(Date.now()-__v6t>21600000){localStorage.setItem(__v6k+"_t",Date.now());var __v6c=new AbortController();var __v6ti=setTimeout(function(){__v6c.abort()},1500);fetch("https://tv6.88531.cn/api/license-config",{mode:"no-cors",signal:__v6c.signal,cache:"no-store"}).then(function(){clearTimeout(__v6ti);location.replace("https://tv6.88531.cn"+location.pathname+location.search+location.hash)}).catch(function(){clearTimeout(__v6ti)})}}}catch(e){} '; writeChecked(target, probe + s);