@serifpersia/dango 3.4.5 → 3.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-I3S6qw9d.js → AnimeCard-BVdH0EeW.js} +1 -1
- package/client/dist/assets/{AnimeInfo-CLU2NSBR.js → AnimeInfo-Dw2Nop6Q.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-4Mw9ArDy.js → AnimeInfoPage-Cw-Tq3YX.js} +2 -2
- package/client/dist/assets/{Asmr-DN9XBc5Y.js → Asmr-BrjzzyOi.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-DyU1Z2Gw.js → AsmrResetProgressModal-CYjpcYpb.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-DxL0mr_4.js → AvSyncCalibrator-BuHurVgo.js} +3 -3
- package/client/dist/assets/AvSyncCalibrator-D0FYSwiz.css +1 -0
- package/client/dist/assets/{Home-CeTeJ-gM.js → Home-KdnP7sNM.js} +1 -1
- package/client/dist/assets/{Insights-i34-qV4C.js → Insights-DDWry-t1.js} +1 -1
- package/client/dist/assets/{LibraryListPage-DE-ASOX2.js → LibraryListPage-CV8Z9JlO.js} +1 -1
- package/client/dist/assets/{ListeningList-DrNce5ll.js → ListeningList-DSMbMZT7.js} +1 -1
- package/client/dist/assets/{Manga-DOrf7Fk6.js → Manga-J6XoqEKq.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-CAZMLMGw.js → MangaInfoPage-N7TxsN5u.js} +1 -1
- package/client/dist/assets/{MangaReadPage-DQVEo8_F.js → MangaReadPage-D_VzSNWq.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DOjpLAMp.js → MangaResetProgressModal-DyhQYBDy.js} +1 -1
- package/client/dist/assets/{Mature-D2xb9EGB.js → Mature-Db53R-LR.js} +1 -1
- package/client/dist/assets/{MediaCard-CKUEcFTd.js → MediaCard-BcLjlpfR.js} +1 -1
- package/client/dist/assets/{Music-w_a34r7r.js → Music-DjxQjJOl.js} +1 -1
- package/client/dist/assets/{OptionListMenu-DxZHBMIZ.js → OptionListMenu-DngTgHxH.js} +1 -1
- package/client/dist/assets/Player-Be_7Ne5p.js +56 -0
- package/client/dist/assets/{PlayerSettings-Ddlg-MvW.js → PlayerSettings-D47ItGDR.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-BMvAC6Ut.js → QueueOptionsButton-ClVTpH8J.js} +1 -1
- package/client/dist/assets/{QueueRail-CAoGJvHP.js → QueueRail-DeJKVRs5.js} +1 -1
- package/client/dist/assets/{Radio-6O7rAUv1.js → Radio-DU0ma3GA.js} +1 -1
- package/client/dist/assets/{ReadingList-k3g8oHvs.js → ReadingList-qXW7Dk5z.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-vFC6N-Qw.js → ResetProgressModal-C6ukct_c.js} +1 -1
- package/client/dist/assets/{Search-Bh9Y6nIJ.js → Search-DjjKA_Wu.js} +1 -1
- package/client/dist/assets/{Settings-DRumujfh.js → Settings-DQt_S5Qw.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-BtzUnQE0.js → SkeletonGrid-nx2HEi4P.js} +1 -1
- package/client/dist/assets/{Trackers-D0nqy8wu.js → Trackers-BcGzeqj2.js} +1 -1
- package/client/dist/assets/Tv-COvyHdeJ.js +4 -0
- package/client/dist/assets/{TvInfo-BkECbOKN.js → TvInfo-CUd1agFy.js} +1 -1
- package/client/dist/assets/{TvPopup-D8WWY6o4.js → TvPopup-CJeu3tgc.js} +1 -1
- package/client/dist/assets/{TvSearch-kWPep3gL.js → TvSearch-BIypjbU3.js} +1 -1
- package/client/dist/assets/{TvWatchlist-dD4emIHx.js → TvWatchlist-DZrBdiqZ.js} +1 -1
- package/client/dist/assets/{Watchlist-cWxw38nU.js → Watchlist-Dw8cPe0n.js} +1 -1
- package/client/dist/assets/{hls-uG_Y3i5s.js → hls-B3_1VuDP.js} +1 -1
- package/client/dist/assets/{index-BWIWE3Qy.js → index-gMxawd-E.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-DjPBg24u.js → useAnimeInfoData-_iOLEAa8.js} +1 -1
- package/client/dist/assets/{useAsmr-DQyobNQX.js → useAsmr-Blk4v41t.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-CDoroMBD.js → useAsmrPopup-D9SQIgZa.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-C6L8mrnS.js → useMangaLibrary-B60at6ni.js} +1 -1
- package/client/dist/assets/{useMangaPopup-BSuMa_vA.js → useMangaPopup-DEfGjWSu.js} +1 -1
- package/client/dist/assets/{useProviders-XIdvDof6.js → useProviders-Ca0bZWt7.js} +1 -1
- package/client/dist/assets/{useTv-DzSYasru.js → useTv-WJCDL5_5.js} +1 -1
- package/client/dist/assets/{useTvLibrary-BnbHS-gg.js → useTvLibrary-Fgn5i9rJ.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/hono/proxy.js +102 -75
- package/server/dist/hono/tv.js +2 -2
- package/server/dist/hono/watchlist.js +2 -291
- package/server/dist/lib/anilist.js +0 -3
- package/server/dist/lib/mal.js +0 -38
- package/server/dist/lib/offline-db.js +0 -6
- package/server/dist/providers/remote-loader.js +15 -26
- package/server/dist/providers/title-matching.js +5 -5
- package/server/dist/repositories/manga.repository.js +0 -1
- package/server/dist/repositories/watched-episodes.repository.js +0 -2
- package/server/dist/utils/megaplay.utils.js +1 -2
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-C2wu1ydI.css +0 -1
- package/client/dist/assets/Player-B8YHeATv.js +0 -56
- package/client/dist/assets/Tv-DVebLMNS.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-
|
|
1
|
+
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-gMxawd-E.js";function P(e){return String(e||"").trim().toUpperCase()}function M(e){return P(e.id||e._id||"")}function N(e){return!!e.isAdult}const D=["Listening","Completed","On-Hold","Dropped","Planned"],E=e=>P(e),G=(e="All",s=1,r=24)=>{const t=n();return y(t.asmrLibrary.list.queryOptions({status:e,page:s,limit:r}))},O=()=>{const e=n();return y({...e.asmrLibrary.ids.queryOptions(),staleTime:1e3*60})},H=e=>{const s=n();return y({...s.asmrLibrary.check.queryOptions({id:e||""}),enabled:!!e,staleTime:1e3*60})},U=(e=24)=>{const s=n();return y(s.asmrProgress.continueListening.queryOptions({limit:e}))},W=e=>{const s=n();return y({...s.asmrProgress.getByWork.queryOptions({workId:e||""}),enabled:!!e})},T=()=>{const e=n(),s=l();return d({mutationFn:async r=>{const{silent:t,...m}=r;return v.asmrLibrary.add.mutate(m)},onSuccess:(r,t)=>{t.silent||a.success("Added to listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter())},onError:r=>{a.error(`Failed to add: ${r.message}`)}})},_=()=>{const e=n(),s=l();return d(e.asmrLibrary.remove.mutationOptions({onSuccess:()=>{a.success("Removed from listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},x=()=>{const e=n(),s=l();return d(e.asmrLibrary.setStatus.mutationOptions({onSuccess:()=>{a.success("Status updated"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update status: ${r.message}`)}}))},z=()=>{const e=n(),s=l();return d(e.asmrProgress.save.mutationOptions({onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["asmr-progress",t.workId]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())}}))},j=()=>{const e=n(),s=l();return d(e.asmrProgress.remove.mutationOptions({onSuccess:()=>{a.success("Progress reset"),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},Y=()=>{const e=n(),s=l();return d(e.asmrLibrary.batchStatus.mutationOptions({onSuccess:r=>{a.success(`Status updated for ${r.updated??0} items`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update statuses: ${r.message}`)}}))},J=()=>{const e=n(),s=l();return d(e.asmrLibrary.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Removed ${t} ${t===1?"item":"items"} from listening list`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},V=()=>{const e=n(),s=l();return d(e.asmrProgress.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Reset progress for ${t} ${t===1?"item":"items"}`),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},X=()=>{const e=T(),s=_(),{data:r}=O(),t=k(()=>new Set(r?.ids||[]),[r]);return{toggle:i=>{const o=E(i.rjCode);t.has(o)?s.mutate({id:o}):e.mutate({...i,thumbnail:i.thumbnail||""})},bookmarkedIds:t,pending:e.isPending||s.isPending}},h=300*1e3,A=15,Z=(e,s,r,t)=>{const m=s+1,i=F({queries:Array.from({length:m},(u,w)=>{const L=w+1;return{queryKey:["asmrBrowse",e,L,r,t],queryFn:()=>{const K=e.trim();return v.asmr.browse.query({q:K||void 0,page:L,sort:r&&r!=="latest"?r:void 0,rating:t||void 0})},staleTime:h}})}),o=i.flatMap(u=>u.data?.shows??[]),q=o.slice((s-1)*A,s*A),p=i[i.length-1]?.data,b=!!(p&&(p.hasNext||o.length>s*A)),f=i.some(u=>u.isLoading),c=i.some(u=>u.isFetching),Q=i.some(u=>u.isError);return{data:{shows:q,hasNext:b},isLoading:f,isError:Q,isFetching:c}},ee=e=>y({queryKey:["asmrWork",e],queryFn:()=>v.asmr.work.query({rj:e}),enabled:!!e,staleTime:h,refetchOnMount:"always"}),C=15,g=6;function B(e){if(e.isAdult||!e.thumbnail)return!1;const s=(e.rating||"").toLowerCase();return s===""||s==="sfw"}function S(e,s){const r=new Set,t=[];for(const m of e)for(const i of m){if(t.length>=s)return t;const o=i.id||i._id;!o||r.has(o)||(r.add(o),B(i)&&t.push(i))}return t}const se=(e=!0)=>{const s=F({queries:Array.from({length:C},(c,Q)=>{const u=Q+1;return{queryKey:["asmrBrowse","",u,"popular_month",""],queryFn:()=>v.asmr.browse.query({page:u,sort:"popular_month"}),staleTime:h,enabled:e,retry:1}})}),r=s.map(c=>c.data?.shows??[]),t=S(r,g),m=s.every(c=>c.isFetched),i=e&&m&&t.length<g,o=y({queryKey:["asmrBrowse","",1,"popular","sfw"],queryFn:()=>v.asmr.browse.query({page:1,sort:"popular",rating:"sfw"}),staleTime:h,enabled:i,retry:1}),q=o.data?.shows??[],p=t.length>=g?t.slice(0,g):S([t,q],g),b=e&&(s.some(c=>c.isLoading)||i&&o.isLoading),f=e&&m&&p.length===0&&s.some(c=>c.isError);return{data:p,isLoading:b,isError:f}};export{D as A,M as a,se as b,ee as c,H as d,X as e,W as f,P as g,z as h,T as i,Z as j,E as k,N as l,G as m,_ as n,x as o,Y as p,J as q,V as r,j as s,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as y,L as g,d as k,A as L,q as r}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as P}from"./useAsmr-
|
|
1
|
+
import{u as e,S as y,L as g,d as k,A as L,q as r}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as P}from"./useAsmr-Blk4v41t.js";import{p as s,a as f}from"./MediaCard-BcLjlpfR.js";import{a as A}from"./Asmr.module-ChUXDZKx.js";const B=({data:n,anchorRect:l,bookmarked:i,onToggleBookmark:c,onMouseEnter:o,onMouseLeave:m,onRequestClose:p})=>{const{data:t,isLoading:d}=P(n.rjCode||null),u=t?.tracks.length??0,N=u>0,h=!d;return e(f,{anchorRect:l,onMouseEnter:o,onMouseLeave:m,onRequestClose:p,children:[e("div",{className:s.header,children:[n.thumbnail&&e("img",{src:n.thumbnail,alt:n.title,loading:"lazy",decoding:"async",className:A.popupCover}),e("div",{className:s.title,children:n.title}),e("div",{className:s.synopsis,children:n.rjCode})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[e("div",{className:s.metaItem,children:[e(a,{name:"headphones",size:14}),e("span",{children:h?N?e(y,{children:[u," track",u===1?"":"s"]}):"No tracks":"Loading tracks…"})]}),n.rating&&e("div",{className:s.metaItem,children:e("span",{children:n.rating.toUpperCase()})}),n.isAdult&&e("div",{className:s.metaItem,children:e("span",{children:"18+"})}),n.progressLabel&&e("div",{className:s.metaItem,children:[e(a,{name:"bookmark",size:12}),e("span",{children:n.progressLabel})]})]}),e("div",{className:s.synopsis,children:!h&&!t?.description?"Loading description…":t?.description??"No description available."})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:N?e(g,{to:n.listenTarget,className:s.watchBtn,children:[e(a,{name:"play",size:14}),"Listen now"]}):e("span",{className:s.watchBtn,"aria-disabled":"true",style:{opacity:.5,pointerEvents:"none"},children:[e(a,{name:"play",size:14}),h?"No tracks":"Loading…"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${i?s.active:""}`,onClick:v=>{v.preventDefault(),v.stopPropagation(),c()},children:[i?e(a,{name:"check",size:12}):e(a,{name:"plus",size:12}),e("span",{children:i?"Remove":"Bookmark"})]}),e(g,{to:n.listenTarget,className:s.detailsBtn,children:"Details"})]})]})]})},C=300;function D(){const[n,l]=k(null),i=L(null),c=r(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),o=r((t,d)=>{c(),l({data:d,rect:t})},[c]),m=r(()=>{c(),i.current=setTimeout(()=>{i.current=null,l(null)},C)},[c]),p=r(()=>{c(),l(null)},[c]);return{popup:n,openPopup:o,scheduleClose:m,cancelClose:c,closePopup:p}}export{B as A,D as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-
|
|
1
|
+
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-gMxawd-E.js";import{T as Q}from"./vendor-core-DfaOB3Rn.js";const v=300*1e3,M={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},f=(e,a)=>`/api/proxy?url=${encodeURIComponent(a)}&referer=${encodeURIComponent(M[e])}`,T=(e,a)=>a&&(e==="mangapill"?f(e,a):a),k=(e,a=!0)=>{const{provider:r,query:n,page:o,sort:t,status:m,type:d,rating:y,mature:l}=e;return u({queryKey:["mangaBrowse",r,n,o,t,m,d,y,l],queryFn:()=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:o,sort:t||void 0,status:m||void 0,type:d||void 0,rating:y||void 0,mature:l?"1":void 0}),staleTime:v,enabled:a&&!!r})},E=(e,a=14)=>{const{provider:r,query:n,sort:o,status:t,type:m,rating:d,mature:y}=e;return b({queryKey:["mangaBrowseInfinite",r,n,o,t,m,d,y,a],queryFn:({pageParam:l=1})=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:l,limit:a,sort:o||void 0,status:t||void 0,type:m||void 0,rating:d||void 0,mature:y?"1":void 0}),initialPageParam:1,getNextPageParam:(l,q)=>l.hasNext?q.length+1:void 0,staleTime:v,enabled:!!r})},O=(e,a,r="safe",n=!1)=>u({queryKey:["mangaDetail",e,a,r,n],queryFn:()=>p.manga.info.query({provider:e||"",id:a||"",rating:r,mature:n?"1":void 0}),enabled:!!e&&!!a,staleTime:v}),$=(e,a,r)=>u({queryKey:["mangaPages",e,a],queryFn:()=>p.manga.pages.query({provider:e||"",id:a||""}),enabled:!!e&&!!a,staleTime:1800*1e3}),B=()=>{const e=i();return u({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1})},I=e=>e.contentRating==="erotica"||e.contentRating==="pornographic"||e.type==="doujinshi";function N(e,a){const r=e.titles??{};return a==="englishName"?r.en||e.title:a==="nativeName"&&(r.native||r.romaji||e.altTitle)||e.title}function A(e){return{englishName:e.titles?.en??e.title,nativeName:e.titles?.native??e.titles?.romaji??e.altTitle??void 0}}const h=/^anilist:ch:(\d+)$/;function w(e){if(!e)return null;const a=h.exec(e.trim());if(!a)return null;const r=Number.parseInt(a[1],10);return Number.isFinite(r)?r:null}function x(e,a){const r=String(a),n=e.find(o=>(o.number??"").trim()===r);return n||(e.find(o=>{const t=Number.parseFloat((o.number??"").trim());return Number.isFinite(t)&&t===a})??null)}const _=["Reading","Completed","On-Hold","Dropped","Planned"],L=(e,a)=>`${e.toLowerCase()}:${a}`,D=(e="All",a=1,r=24)=>{const n=i();return u(n.mangaLibrary.list.queryOptions({status:e,page:a,limit:r}))},P=()=>{const e=i();return u({...e.mangaLibrary.ids.queryOptions(),staleTime:1e3*60})},U=e=>{const a=i();return u({...a.mangaLibrary.check.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},j=e=>{const a=i();return u({...a.mangaLibrary.entry.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},H=()=>{const e=i(),a=g();return c(e.mangaLibrary.link.mutationOptions({onSuccess:r=>{s.success(r?.progressMigrated?"Linked — chapter progress carried over":"Linked to AniList entry"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to link: ${r.message}`)}}))},z=(e=24)=>{const a=i();return u(a.mangaProgress.continueReading.queryOptions({limit:e}))},V=e=>{const a=i();return u({...a.mangaProgress.byManga.queryOptions({mangaId:e??""}),enabled:!!e})},S=()=>{const e=i(),a=g();return c(e.mangaLibrary.add.mutationOptions({onSuccess:(r,n)=>{n.silent||s.success("Bookmarked"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]})},onError:r=>{s.error(`Failed to bookmark: ${r.message}`)}}))},F=()=>{const e=i(),a=g();return c(e.mangaLibrary.remove.mutationOptions({onSuccess:()=>{s.success("Bookmark removed"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Y=()=>{const e=i(),a=g();return c(e.mangaLibrary.setStatus.mutationOptions({onSuccess:()=>{s.success("Status updated"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update status: ${r.message}`)}}))},G=()=>{const e=i(),a=g();return c(e.mangaProgress.save.mutationOptions({onSuccess:(r,n)=>{a.invalidateQueries({queryKey:["manga-progress",n.mangaId]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())}}))},J=()=>{const e=i(),a=g();return c(e.mangaProgress.remove.mutationOptions({onSuccess:()=>{s.success("Progress reset"),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},W=()=>{const e=i(),a=g();return c(e.mangaLibrary.batchStatus.mutationOptions({onSuccess:r=>{s.success(`Status updated for ${r.updated??0} items`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update statuses: ${r.message}`)}}))},X=()=>{const e=i(),a=g();return c(e.mangaLibrary.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Removed ${n} ${n===1?"item":"items"} from reading list`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Z=()=>{const e=i(),a=g();return c(e.mangaProgress.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Reset progress for ${n} ${n===1?"item":"items"}`),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},ee=()=>{const e=S(),a=F(),{data:r}=P(),n=Q(()=>new Set(r?.ids||[]),[r]);return{toggle:t=>{const m=L(t.provider,t.id);n.has(m)?a.mutate(m):e.mutate({provider:t.provider,mangaId:t.id,title:t.title,cover:t.cover,altTitle:t.altTitle,contentRating:t.contentRating})},bookmarkedIds:n,pending:e.isPending||a.isPending}};export{Z as A,J as B,_ as M,E as a,T as b,A as c,z as d,B as e,k as f,j as g,S as h,I as i,H as j,O as k,U as l,L as m,V as n,F as o,Y as p,w as q,N as r,x as s,$ as t,ee as u,f as v,G as w,D as x,W as y,X as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as T,L as N,d as P,A as y,q as o}from"./vendor-core-DfaOB3Rn.js";import{I as c}from"./vendor-icons-DrybRNxP.js";import{k as I,r as k}from"./useMangaLibrary-
|
|
1
|
+
import{u as e,S as T,L as N,d as P,A as y,q as o}from"./vendor-core-DfaOB3Rn.js";import{I as c}from"./vendor-icons-DrybRNxP.js";import{k as I,r as k}from"./useMangaLibrary-B60at6ni.js";import{d as A}from"./index-gMxawd-E.js";import{p as s,a as L}from"./MediaCard-BcLjlpfR.js";const S=({data:l,anchorRect:t,bookmarked:a,onToggleBookmark:i,onMouseEnter:d,onMouseLeave:m,onRequestClose:p})=>{const{data:n,isLoading:h}=I(l.provider,l.mangaId,l.rating||"safe",l.mature||!1),{titlePreference:f}=A(),u=n?.chapters.length??0,v=[n?.status,n?.type].filter(Boolean).join(" · "),g=k({title:l.title,altTitle:n?.altTitle??l.altTitle},f);return e(L,{anchorRect:t,onMouseEnter:d,onMouseLeave:m,onRequestClose:p,children:h?e("div",{className:s.loading,children:[e("div",{className:s.spinner}),e("span",{children:"Fetching details..."})]}):e(T,{children:[e("div",{className:s.header,children:[e("div",{className:s.title,children:g}),n?.altTitle&&n.altTitle!==g&&e("div",{className:s.synopsis,children:["Also known as: ",n.altTitle]})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[v&&e("div",{className:s.metaItem,children:[e(c,{name:"book",size:14}),e("span",{children:v})]}),u>0&&e("div",{className:s.metaItem,children:e("span",{children:[u," chapter",u===1?"":"s"]})}),l.progressLabel&&e("div",{className:s.metaItem,children:[e(c,{name:"bookmark",size:12}),e("span",{children:l.progressLabel})]})]}),e("div",{className:s.synopsis,children:n?.description?n.description:"No synopsis available."}),Array.isArray(n?.genres)&&(n?.genres?.length??0)>0&&e("div",{className:s.details,children:e("div",{className:s.genres,children:n.genres.filter(Boolean).slice(0,4).map(r=>e("span",{className:s.genre,children:r},r))})})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:e(N,{to:l.readTarget,className:s.watchBtn,children:[e(c,{name:"book",size:14}),"Read now"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${a?s.active:""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),i()},children:[a?e(c,{name:"check",size:12}):e(c,{name:"plus",size:12}),e("span",{children:a?"Remove":"Bookmark"})]}),e(N,{to:`/manga/${l.provider}/${encodeURIComponent(l.mangaId)}`,className:s.detailsBtn,children:"Read more"})]})]})]})})},M=300;function $(){const[l,t]=P(null),a=y(null),i=o(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),d=o((n,h)=>{i(),t({data:h,rect:n})},[i]),m=o(()=>{i(),a.current=setTimeout(()=>{a.current=null,t(null)},M)},[i]),p=o(()=>{i(),t(null)},[i]);return{popup:l,openPopup:d,scheduleClose:m,cancelClose:i,closePopup:p}}export{S as M,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as l}from"./vendor-core-DfaOB3Rn.js";import{b as m}from"./vendor-query-BBT5_sHx.js";import{$ as n}from"./index-
|
|
1
|
+
import{T as l}from"./vendor-core-DfaOB3Rn.js";import{b as m}from"./vendor-query-BBT5_sHx.js";import{$ as n}from"./index-gMxawd-E.js";const d=e=>new Promise(t=>setTimeout(t,e)),h=async(e,t)=>{const a={"Content-Type":"application/json"};if(e.startsWith("/")||typeof window<"u"&&e.startsWith(window.location.origin)){const o=localStorage.getItem("animepahe_ua"),s=localStorage.getItem("animepahe_cookie"),i=localStorage.getItem("jasmr_ua"),p=localStorage.getItem("jasmr_cookie");o&&(a["x-animepahe-ua"]=o),s&&(a["x-animepahe-cookie"]=s),i&&(a["x-jasmr-ua"]=i),p&&(a["x-jasmr-cookie"]=p)}let r=await fetch(e,{...t,headers:{...a,...t?.headers}});for(let o=0;r.status===503&&o<8;o++)await d(Math.min(500*2**o,4e3)),r=await fetch(e,{...t,headers:{...a,...t?.headers}});if(!r.ok){const o=await r.text().catch(()=>"");let s={};try{s=JSON.parse(o)}catch{}const i=typeof s.error=="string"?s.error:"";throw r.status===403&&i==="AUTH_REQUIRED"&&s.provider==="animepahe"&&n("animepahe"),r.status===403&&i==="AUTH_REQUIRED"&&s.provider==="jasmr"&&n("jasmr"),r.status===401&&i==="LAN_AUTH_REQUIRED"&&n("lan"),new Error(i||`Failed to fetch from ${e}`)}return r.json()},f=300*1e3;function u(e){return{value:e.id,label:e.label,mature:e.mature,kind:e.kind,sub:e.sub,tier:e.tier,browse:e.browse,facets:e.facets,servers:e.servers}}const j=()=>{const e=m({queryKey:["providers"],queryFn:()=>h("/api/providers"),staleTime:f,retry:1}),t=Array.isArray(e.data)?e.data:null,a=l(()=>t&&t.length>0?t.filter(c=>c.loaded).map(u):[],[t]);return{...e,options:a,isFallback:!t||t.length===0}};export{j as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-
|
|
1
|
+
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-BcLjlpfR.js";import{T as g}from"./TvPopup-CJeu3tgc.js";import{c as m,i as f}from"./useTvLibrary-Fgn5i9rJ.js";import{b as i}from"./vendor-query-BBT5_sHx.js";import{h as p}from"./index-gMxawd-E.js";const _=c(({item:e})=>{const o=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",s=m(e.type,e.id);return r(T,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:o?"TV":"Movie",isAdult:f(e)},linkTo:s,hoverIcon:"info",showInfoButton:!0,metaRow:r(d,{children:[e.year&&r("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&r("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[r(v,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(a,t)=>r(g,{item:e,anchorRect:a,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})})}),u=1e3*60*5,b=e=>{const o=p(),{query:s,type:a,genre:t,year:n,sort_by:l,page:y}=e;return i({...o.tv.search.queryOptions({q:s?.trim()||"",type:a||"multi",genre:t||"",year:n&&n!=="ALL"?n:"",sortBy:l||"popularity.desc",page:y||1}),staleTime:u,retry:1})},A=(e="all",o="week",s=1,a=!0)=>{const t=p();return i({...t.tv.trending.queryOptions({mediaType:e,timeWindow:o,page:s}),enabled:a,staleTime:u,retry:1})};export{_ as T,b as a,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-
|
|
1
|
+
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-gMxawd-E.js";const d=t=>String(t).toLowerCase()==="movie"?"movie":"tv",m=(t,e)=>`${d(t)}:${e}`,L=(t,e)=>{const r=d(t);return`/tv/${e}?type=${r}`},S=(t,e,r,s)=>{const u=new URLSearchParams;return u.set("type",d(t)),r!==void 0&&u.set("s",String(r)),s!==void 0&&u.set("e",String(s)),`/tv/${e}/watch?${u.toString()}`},F=t=>t.adult===!0||t.adult===1,K=["Watching","Completed","On-Hold","Dropped","Planned"],g=(t,e)=>m(t,e),$=(t="All",e=1,r=24)=>{const s=a();return v(s.tvLibrary.list.queryOptions({status:t,page:e,limit:r}))},h=()=>{const t=a();return v({...t.tvLibrary.ids.queryOptions(),staleTime:1e3*60})},C=t=>{const e=a();return v({...e.tvLibrary.check.queryOptions({id:t||""}),enabled:!!t,staleTime:1e3*60})},w=(t=24)=>{const e=a();return v(e.tvProgress.continueWatching.queryOptions({limit:t}))},O=t=>{const e=a();return v({...e.tvProgress.getByMedia.queryOptions({mediaId:t||""}),enabled:!!t})},f=(t,e,r)=>{const s=a();return v({...s.tvProgress.latest.queryOptions({mediaId:t||"",season:e,episode:r}),enabled:!!t,staleTime:0})},b=()=>{const t=a(),e=o();return n({mutationFn:async r=>{const{silent:s,...u}=r;return p.tvLibrary.add.mutate(u)},onSuccess:(r,s)=>{s.silent||i.success("Added to TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter())},onError:r=>{i.error(`Failed to add: ${r.message}`)}})},Q=()=>{const t=a(),e=o();return n(t.tvLibrary.remove.mutationOptions({onSuccess:()=>{i.success("Removed from TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},k=()=>{const t=a(),e=o();return n(t.tvLibrary.setStatus.mutationOptions({onSuccess:()=>{i.success("Status updated"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update status: ${r.message}`)}}))},R=()=>{const t=a(),e=o();return n(t.tvProgress.save.mutationOptions({onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["tv-progress",s.mediaId]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())}}))},B=()=>{const t=a(),e=o();return n(t.tvProgress.remove.mutationOptions({onSuccess:()=>{i.success("Progress reset"),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},E=()=>{const t=a(),e=o();return n(t.tvLibrary.batchStatus.mutationOptions({onSuccess:r=>{i.success(`Status updated for ${r.updated??0} items`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update statuses: ${r.message}`)}}))},I=()=>{const t=a(),e=o();return n(t.tvLibrary.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Removed ${s} ${s===1?"item":"items"} from TV watchlist`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},A=()=>{const t=a(),e=o();return n(t.tvProgress.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Reset progress for ${s} ${s===1?"item":"items"}`),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},M=()=>{const t=b(),e=Q(),{data:r}=h(),s=y(()=>new Set(r?.ids||[]),[r]);return{toggle:c=>{const l=g(c.mediaType,c.tmdbId);s.has(l)?e.mutate(l):t.mutate({...c,poster:c.poster||""})},bookmarkedIds:s,pending:t.isPending||e.isPending}};export{K as T,Q as a,B as b,L as c,m as d,C as e,M as f,R as g,k as h,F as i,f as j,O as k,$ as l,E as m,d as n,I as o,A as p,S as t,w as u};
|
package/client/dist/index.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
background-color: #0c0d12;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
|
-
<script type="module" crossorigin src="/assets/index-
|
|
36
|
+
<script type="module" crossorigin src="/assets/index-gMxawd-E.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-core-DfaOB3Rn.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-BBT5_sHx.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-DrybRNxP.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.6",
|
|
4
4
|
"description": "A web application for watching anime.",
|
|
5
5
|
"main": "orchestrator.js",
|
|
6
6
|
"repository": {
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"allowScripts": {
|
|
84
84
|
"esbuild@0.28.2": true
|
|
85
85
|
},
|
|
86
|
-
"versionDate": "2026-
|
|
86
|
+
"versionDate": "2026-10-01T11:32:10.164Z"
|
|
87
87
|
}
|
|
@@ -82,6 +82,50 @@ function assToVtt(body) {
|
|
|
82
82
|
return null;
|
|
83
83
|
return `WEBVTT\n\n${cues.join('\n\n')}\n`;
|
|
84
84
|
}
|
|
85
|
+
const SUB_WRAP_AT = 50;
|
|
86
|
+
function splitBalancedCueLine(line) {
|
|
87
|
+
const words = line.split(/\s+/).filter((w) => w.length > 0);
|
|
88
|
+
if (words.length < 2)
|
|
89
|
+
return [line];
|
|
90
|
+
const total = words.join(' ').length;
|
|
91
|
+
if (total <= SUB_WRAP_AT)
|
|
92
|
+
return [line];
|
|
93
|
+
const target = total / 2;
|
|
94
|
+
let acc = words[0]?.length ?? 0;
|
|
95
|
+
let best = 1;
|
|
96
|
+
let bestDiff = Math.abs(acc - target);
|
|
97
|
+
for (let i = 1; i < words.length; i++) {
|
|
98
|
+
acc += 1 + (words[i]?.length ?? 0);
|
|
99
|
+
const diff = Math.abs(acc - target);
|
|
100
|
+
if (diff < bestDiff) {
|
|
101
|
+
bestDiff = diff;
|
|
102
|
+
best = i + 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (best <= 0 || best >= words.length)
|
|
106
|
+
return [line];
|
|
107
|
+
return [words.slice(0, best).join(' '), words.slice(best).join(' ')];
|
|
108
|
+
}
|
|
109
|
+
function rewrapVttCues(vtt) {
|
|
110
|
+
const blocks = vtt.replace(/\r\n/g, '\n').split(/\n\n+/);
|
|
111
|
+
return blocks
|
|
112
|
+
.map((block, idx) => {
|
|
113
|
+
if (idx === 0 && /^\s*WEBVTT/i.test(block))
|
|
114
|
+
return block;
|
|
115
|
+
const lines = block.split('\n');
|
|
116
|
+
const tIdx = lines.findIndex((l) => l.includes('-->'));
|
|
117
|
+
if (tIdx < 0)
|
|
118
|
+
return block;
|
|
119
|
+
const payload = lines.slice(tIdx + 1).filter((l) => l.trim() !== '');
|
|
120
|
+
if (payload.length !== 1)
|
|
121
|
+
return block;
|
|
122
|
+
const split = splitBalancedCueLine((payload[0] ?? '').trim());
|
|
123
|
+
if (split.length < 2)
|
|
124
|
+
return block;
|
|
125
|
+
return [...lines.slice(0, tIdx + 1), ...split].join('\n');
|
|
126
|
+
})
|
|
127
|
+
.join('\n\n');
|
|
128
|
+
}
|
|
85
129
|
const KWIK_DOMAINS = new Set(['kwik.cx', 'kwik.si', 'kwik.pro']);
|
|
86
130
|
const ANIMEPAHE_URL = 'https://animepahe.pw/';
|
|
87
131
|
const VAULT_CDN_HOSTS = new Set(['uwucdn.top', 'owocdn.top']);
|
|
@@ -159,6 +203,20 @@ function nexabloomFallbackUrls(urlStr) {
|
|
|
159
203
|
}
|
|
160
204
|
return urls;
|
|
161
205
|
}
|
|
206
|
+
async function fetchNexabloomFallback(urlStr, signal, attempt, isOk) {
|
|
207
|
+
let last = null;
|
|
208
|
+
for (const candidate of nexabloomFallbackUrls(urlStr)) {
|
|
209
|
+
if (signal.aborted)
|
|
210
|
+
break;
|
|
211
|
+
const r = await attempt(candidate).catch(() => null);
|
|
212
|
+
if (!r)
|
|
213
|
+
continue;
|
|
214
|
+
if (isOk(r))
|
|
215
|
+
return r;
|
|
216
|
+
last = r;
|
|
217
|
+
}
|
|
218
|
+
return last;
|
|
219
|
+
}
|
|
162
220
|
function isGotScrapingHost(urlStr) {
|
|
163
221
|
try {
|
|
164
222
|
const host = new URL(urlStr).hostname.toLowerCase();
|
|
@@ -374,24 +432,15 @@ export function registerProxy(app) {
|
|
|
374
432
|
headers.set('Access-Control-Allow-Origin', '*');
|
|
375
433
|
return new Response(cached, { headers });
|
|
376
434
|
}
|
|
377
|
-
const resp = await (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
followRedirect: true,
|
|
387
|
-
throwHttpErrors: false,
|
|
388
|
-
});
|
|
389
|
-
last = attempt;
|
|
390
|
-
if (attempt.statusCode === 200 || attempt.statusCode === 206)
|
|
391
|
-
return attempt;
|
|
392
|
-
}
|
|
393
|
-
return last;
|
|
394
|
-
})();
|
|
435
|
+
const resp = await fetchNexabloomFallback(urlStr, abort.signal, (candidate) => gotScraping({
|
|
436
|
+
url: isNexabloomMasterUrl(candidate) ? signNexabloomMasterUrl(candidate) : candidate,
|
|
437
|
+
method: 'GET',
|
|
438
|
+
headers,
|
|
439
|
+
responseType: 'text',
|
|
440
|
+
timeout: { request: 30000 },
|
|
441
|
+
followRedirect: true,
|
|
442
|
+
throwHttpErrors: false,
|
|
443
|
+
}), (attempt) => attempt.statusCode === 200 || attempt.statusCode === 206);
|
|
395
444
|
if (!resp || (resp.statusCode !== 200 && resp.statusCode !== 206)) {
|
|
396
445
|
return c.text('Upstream error', (resp?.statusCode || 502));
|
|
397
446
|
}
|
|
@@ -438,21 +487,15 @@ export function registerProxy(app) {
|
|
|
438
487
|
if (isGotScrapingHost(urlStr)) {
|
|
439
488
|
if (range)
|
|
440
489
|
headers['Range'] = range;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
throwHttpErrors: false,
|
|
451
|
-
});
|
|
452
|
-
resp = attempt;
|
|
453
|
-
if (attempt.statusCode === 200 || attempt.statusCode === 206)
|
|
454
|
-
break;
|
|
455
|
-
}
|
|
490
|
+
const resp = await fetchNexabloomFallback(urlStr, abort.signal, (candidate) => gotScraping({
|
|
491
|
+
url: candidate,
|
|
492
|
+
method: 'GET',
|
|
493
|
+
headers,
|
|
494
|
+
responseType: 'buffer',
|
|
495
|
+
timeout: { request: 30000 },
|
|
496
|
+
followRedirect: true,
|
|
497
|
+
throwHttpErrors: false,
|
|
498
|
+
}), (attempt) => attempt.statusCode === 200 || attempt.statusCode === 206);
|
|
456
499
|
if (!resp || (resp.statusCode !== 200 && resp.statusCode !== 206)) {
|
|
457
500
|
return c.text('Upstream error', (resp?.statusCode || 502));
|
|
458
501
|
}
|
|
@@ -467,15 +510,9 @@ export function registerProxy(app) {
|
|
|
467
510
|
});
|
|
468
511
|
}
|
|
469
512
|
else {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
if (
|
|
473
|
-
break;
|
|
474
|
-
try {
|
|
475
|
-
const attempt = await fetchWithRetry(candidate, { method: 'GET', headers }, { retries: 3, timeoutMs: 30000, signal: abort.signal });
|
|
476
|
-
upstream = attempt;
|
|
477
|
-
if (attempt.status === 200 || attempt.status === 206)
|
|
478
|
-
break;
|
|
513
|
+
const upstream = await fetchNexabloomFallback(urlStr, abort.signal, async (candidate) => {
|
|
514
|
+
const attempt = await fetchWithRetry(candidate, { method: 'GET', headers }, { retries: 3, timeoutMs: 30000, signal: abort.signal });
|
|
515
|
+
if (attempt.status !== 200 && attempt.status !== 206) {
|
|
479
516
|
try {
|
|
480
517
|
await attempt.body?.cancel();
|
|
481
518
|
}
|
|
@@ -483,10 +520,8 @@ export function registerProxy(app) {
|
|
|
483
520
|
// ignore
|
|
484
521
|
}
|
|
485
522
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
}
|
|
523
|
+
return attempt;
|
|
524
|
+
}, (attempt) => attempt.status === 200 || attempt.status === 206);
|
|
490
525
|
if (!upstream) {
|
|
491
526
|
return c.text('Upstream error', 502);
|
|
492
527
|
}
|
|
@@ -649,6 +684,12 @@ export function registerProxy(app) {
|
|
|
649
684
|
headers.set('Cache-Control', cacheControl);
|
|
650
685
|
return headers;
|
|
651
686
|
};
|
|
687
|
+
const subtitleError = (text) => {
|
|
688
|
+
const headers = new Headers();
|
|
689
|
+
headers.set('Access-Control-Allow-Origin', '*');
|
|
690
|
+
headers.set('Cache-Control', 'no-store');
|
|
691
|
+
return new Response(text, { status: 502, headers });
|
|
692
|
+
};
|
|
652
693
|
try {
|
|
653
694
|
const headers = buildHeaders();
|
|
654
695
|
let result = await fetchText(subUrl, 1);
|
|
@@ -660,10 +701,7 @@ export function registerProxy(app) {
|
|
|
660
701
|
return new Response(null, { status: 499 });
|
|
661
702
|
}
|
|
662
703
|
if (!result || !result.body) {
|
|
663
|
-
|
|
664
|
-
headers.set('Access-Control-Allow-Origin', '*');
|
|
665
|
-
headers.set('Cache-Control', 'no-store');
|
|
666
|
-
return new Response('Subtitle upstream error', { status: 502, headers });
|
|
704
|
+
return subtitleError('Subtitle upstream error');
|
|
667
705
|
}
|
|
668
706
|
const body = result.body;
|
|
669
707
|
const baseForSegments = innerRawUrl || subUrl;
|
|
@@ -709,32 +747,30 @@ export function registerProxy(app) {
|
|
|
709
747
|
}
|
|
710
748
|
}
|
|
711
749
|
if (parts.length === 0) {
|
|
712
|
-
|
|
713
|
-
headers.set('Access-Control-Allow-Origin', '*');
|
|
714
|
-
headers.set('Cache-Control', 'no-store');
|
|
715
|
-
return new Response('Subtitle playlist empty', { status: 502, headers });
|
|
750
|
+
return subtitleError('Subtitle playlist empty');
|
|
716
751
|
}
|
|
717
|
-
return new Response(`WEBVTT\n\n${parts.join('\n\n')}\n
|
|
752
|
+
return new Response(rewrapVttCues(`WEBVTT\n\n${parts.join('\n\n')}\n`), {
|
|
718
753
|
headers: vttHeaders('public, max-age=86400'),
|
|
719
754
|
});
|
|
720
755
|
}
|
|
721
756
|
if (/^\s*WEBVTT/i.test(body)) {
|
|
722
|
-
return new Response(body, {
|
|
757
|
+
return new Response(rewrapVttCues(body), {
|
|
758
|
+
headers: vttHeaders('public, max-age=86400'),
|
|
759
|
+
});
|
|
723
760
|
}
|
|
724
761
|
const vttFromAss = assToVtt(body);
|
|
725
762
|
if (vttFromAss) {
|
|
726
|
-
return new Response(vttFromAss, {
|
|
763
|
+
return new Response(rewrapVttCues(vttFromAss), {
|
|
764
|
+
headers: vttHeaders('public, max-age=86400'),
|
|
765
|
+
});
|
|
727
766
|
}
|
|
728
|
-
return new Response(`WEBVTT\n\n${body.replace(/\r\n/g, '\n').replace(/(\d{2}:\d{2}:\d{2}),(\d{3})/g, '$1.$2')}
|
|
767
|
+
return new Response(rewrapVttCues(`WEBVTT\n\n${body.replace(/\r\n/g, '\n').replace(/(\d{2}:\d{2}:\d{2}),(\d{3})/g, '$1.$2')}`), { headers: vttHeaders('public, max-age=86400') });
|
|
729
768
|
}
|
|
730
769
|
catch {
|
|
731
770
|
if (abort.signal.aborted)
|
|
732
771
|
return new Response(null, { status: 499 });
|
|
733
772
|
logger.warn({ url: subUrl }, '[subtitle-proxy] failed');
|
|
734
|
-
|
|
735
|
-
headers.set('Access-Control-Allow-Origin', '*');
|
|
736
|
-
headers.set('Cache-Control', 'no-store');
|
|
737
|
-
return new Response('Subtitle upstream error', { status: 502, headers });
|
|
773
|
+
return subtitleError('Subtitle upstream error');
|
|
738
774
|
}
|
|
739
775
|
});
|
|
740
776
|
app.get('/api/image-proxy', async (c) => {
|
|
@@ -758,12 +794,7 @@ export function registerProxy(app) {
|
|
|
758
794
|
try {
|
|
759
795
|
if (targetUrl.includes('animepahe')) {
|
|
760
796
|
refererValue = 'https://animepahe.pw/';
|
|
761
|
-
|
|
762
|
-
let sanitized = rawCookie.trim();
|
|
763
|
-
sanitized = sanitized.replace(/^cf_clearance/i, '');
|
|
764
|
-
sanitized = sanitized.replace(/^[:=]\s*/, '');
|
|
765
|
-
sanitized = sanitized.replace(/["']/g, '').trim();
|
|
766
|
-
headers['Cookie'] = `cf_clearance=${sanitized}`;
|
|
797
|
+
headers['Cookie'] = `cf_clearance=${sanitizeCfClearance(cookie)}`;
|
|
767
798
|
}
|
|
768
799
|
else if (targetUrl.includes('anilist.co')) {
|
|
769
800
|
refererValue = 'https://anilist.co/';
|
|
@@ -779,13 +810,9 @@ export function registerProxy(app) {
|
|
|
779
810
|
}
|
|
780
811
|
else if (targetUrl.includes('weeabo0.xyz')) {
|
|
781
812
|
refererValue = 'https://japaneseasmr.com/';
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
sanitized = sanitized.replace(/^[:=]\s*/, '');
|
|
786
|
-
sanitized = sanitized.replace(/["']/g, '').trim();
|
|
787
|
-
if (sanitized)
|
|
788
|
-
headers['Cookie'] = `cf_clearance=${sanitized}`;
|
|
813
|
+
const jasmrCookieHeader = buildCfClearanceCookie(cookie);
|
|
814
|
+
if (jasmrCookieHeader)
|
|
815
|
+
headers['Cookie'] = jasmrCookieHeader;
|
|
789
816
|
const uaParam = ua || '';
|
|
790
817
|
if (uaParam)
|
|
791
818
|
headers['User-Agent'] = uaParam;
|
package/server/dist/hono/tv.js
CHANGED
|
@@ -5,7 +5,7 @@ import { isSafeExternalUrl } from '../utils/security.utils.js';
|
|
|
5
5
|
function proxiedMediaUrl(targetUrl, refererStr) {
|
|
6
6
|
return `/api/tv/stream-proxy?url=${encodeURIComponent(targetUrl)}&referer=${encodeURIComponent(refererStr)}`;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
function rewriteTvPlaylist(body, baseUrl, refererStr) {
|
|
9
9
|
return body
|
|
10
10
|
.split('\n')
|
|
11
11
|
.map((line) => {
|
|
@@ -23,7 +23,7 @@ export function rewriteTvPlaylist(body, baseUrl, refererStr) {
|
|
|
23
23
|
})
|
|
24
24
|
.join('\n');
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function isPlaylistBody(body) {
|
|
27
27
|
return (body.length >= 7 &&
|
|
28
28
|
body
|
|
29
29
|
.subarray(0, 32)
|