@serifpersia/dango 3.5.7 → 3.5.9
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 +2 -2
- package/client/dist/assets/{AnimeCard-Bj5amdPt.js → AnimeCard-CDeVbWJO.js} +1 -1
- package/client/dist/assets/{AnimeInfo-B4b7iyCZ.js → AnimeInfo-DVpM_cPF.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-_p_S9R09.js → AnimeInfoPage-Cc3OcfHY.js} +2 -2
- package/client/dist/assets/{Asmr-B4idhS3o.js → Asmr-DZmR_EHb.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-BBrzzQFJ.js → AsmrResetProgressModal-DBCDlfYq.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-DipT4BfD.js → AvSyncCalibrator-Cf5L0Dxf.js} +1 -1
- package/client/dist/assets/{Home-B3U4UeUo.js → Home-BqhPqzWF.js} +1 -1
- package/client/dist/assets/{Insights-CLwUQoct.js → Insights-CmbbDZr3.js} +1 -1
- package/client/dist/assets/{LibraryListPage-CcsUAzeL.js → LibraryListPage-jLA7gnux.js} +1 -1
- package/client/dist/assets/{ListeningList-DZDivEEp.js → ListeningList-Cm9zGlLB.js} +1 -1
- package/client/dist/assets/{Manga-DLLGgY3d.js → Manga-x4pVT4ZH.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-CAoertK2.js → MangaInfoPage-BPSW9UER.js} +1 -1
- package/client/dist/assets/{MangaReadPage-86iAGfPF.js → MangaReadPage-V1iDbCfL.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-BrgEfFCo.js → MangaResetProgressModal-Dto3km2X.js} +1 -1
- package/client/dist/assets/{Mature-u1Zfj04I.js → Mature-B0DoN3tQ.js} +1 -1
- package/client/dist/assets/{MediaCard-DlN3VNy8.js → MediaCard-D6_9HL2Z.js} +1 -1
- package/client/dist/assets/{Music-stf7yXDU.js → Music-1MlUIfdw.js} +1 -1
- package/client/dist/assets/{OptionListMenu-BFOitF3F.js → OptionListMenu-BWwktIiH.js} +1 -1
- package/client/dist/assets/{Player-DYz2t2Zv.js → Player-Dgtn--lM.js} +2 -2
- package/client/dist/assets/{PlayerSettings-D2Gz6FgV.js → PlayerSettings-CI5hGpEU.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-DFny02Po.js → QueueOptionsButton-DjcdOJgg.js} +1 -1
- package/client/dist/assets/{QueueRail-C3FF1-f3.js → QueueRail-B5z_xhzj.js} +1 -1
- package/client/dist/assets/{Radio-BiRQreJI.js → Radio-BAE-Q-iN.js} +1 -1
- package/client/dist/assets/{ReadingList-kAreUiz-.js → ReadingList-B97i_hGv.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-DGE5sfz2.js → ResetProgressModal-C7-CvTi-.js} +1 -1
- package/client/dist/assets/{Search-Dvt7ZYbV.js → Search-CbPFjKeU.js} +1 -1
- package/client/dist/assets/Settings-BbihEcZ2.js +21 -0
- package/client/dist/assets/{SkeletonGrid-CtRkgW2V.js → SkeletonGrid-BA_x2PRl.js} +1 -1
- package/client/dist/assets/{Trackers-DqaC4bYh.js → Trackers-Bperfrcz.js} +1 -1
- package/client/dist/assets/{Tv-Ug-q07EH.js → Tv-BSGuUz2F.js} +1 -1
- package/client/dist/assets/{TvInfo-BfjnqnCn.js → TvInfo-CxSmzVSL.js} +1 -1
- package/client/dist/assets/{TvPopup-DgTptetJ.js → TvPopup-S5blnD3l.js} +1 -1
- package/client/dist/assets/{TvSearch-D_VbFQF-.js → TvSearch-B-2sRNbN.js} +1 -1
- package/client/dist/assets/{TvWatchlist-DCx1lBta.js → TvWatchlist-MaA-qhQw.js} +1 -1
- package/client/dist/assets/{Watchlist-Cdi7veTd.js → Watchlist-yVEi1oVn.js} +1 -1
- package/client/dist/assets/{hls-PlQLwAyI.js → hls-CnFtaJwf.js} +1 -1
- package/client/dist/assets/index-Ck-R0JKv.css +1 -0
- package/client/dist/assets/index-DNxWyfmM.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-nFJhxeIK.js → useAnimeInfoData-BqAd5seW.js} +1 -1
- package/client/dist/assets/{useAsmr-BFiC1M0v.js → useAsmr-B1vlDm2S.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-BfVuxWTa.js → useAsmrPopup-BNJC4JQo.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-DKLDWCwz.js → useMangaLibrary-CU3bFfuD.js} +1 -1
- package/client/dist/assets/{useMangaPopup-C1z1dsYB.js → useMangaPopup-LbRnTFzq.js} +1 -1
- package/client/dist/assets/{useProviders-aF3Qns7U.js → useProviders-CvKGEjDV.js} +1 -1
- package/client/dist/assets/{useTv-DkUFW44b.js → useTv-LsgXHZD4.js} +1 -1
- package/client/dist/assets/{useTvLibrary-CrUDB1RB.js → useTvLibrary-c90knUfT.js} +1 -1
- package/client/dist/favicon.svg +11 -0
- package/client/dist/index.html +3 -3
- package/client/dist/repo_logo.svg +33 -0
- package/package.json +2 -2
- package/server/dist/trpc/routers/settings.js +1 -0
- package/server/package.json +1 -1
- package/client/dist/assets/Settings-D-BMTUko.js +0 -21
- package/client/dist/assets/index-NKjVUCZV.js +0 -178
- package/client/dist/assets/index-w_r2lTCe.css +0 -1
- package/client/dist/favicon.ico +0 -0
- package/client/dist/logo-mochi.png +0 -0
- package/client/dist/logo-sakura.png +0 -0
- package/client/dist/logo.png +0 -0
|
@@ -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-DNxWyfmM.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 f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-
|
|
1
|
+
import{u as e,S as f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-CU3bFfuD.js";import{d as I}from"./index-DNxWyfmM.js";import{p as s,a as k}from"./MediaCard-D6_9HL2Z.js";import{u as P}from"./usePopup-DS9jMzp6.js";const R=({data:i,anchorRect:d,bookmarked:r,onToggleBookmark:p,onMouseEnter:h,onMouseLeave:v,onRequestClose:g})=>{const{data:a,isLoading:N}=y(i.provider,i.mangaId,i.rating||"safe",i.mature||!1),{titlePreference:u}=I(),t=a?.chapters.length??0,c=[a?.status,a?.type].filter(Boolean).join(" · "),o=T({title:i.title,altTitle:a?.altTitle??i.altTitle},u);return e(k,{anchorRect:d,onMouseEnter:h,onMouseLeave:v,onRequestClose:g,children:N?e("div",{className:s.loading,children:[e("div",{className:s.spinner}),e("span",{children:"Fetching details..."})]}):e(f,{children:[e("div",{className:s.header,children:[e("div",{className:s.title,children:o}),a?.altTitle&&a.altTitle!==o&&e("div",{className:s.synopsis,children:["Also known as: ",a.altTitle]})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[c&&e("div",{className:s.metaItem,children:[e(l,{name:"book",size:14}),e("span",{children:c})]}),t>0&&e("div",{className:s.metaItem,children:e("span",{children:[t," chapter",t===1?"":"s"]})}),i.progressLabel&&e("div",{className:s.metaItem,children:[e(l,{name:"bookmark",size:12}),e("span",{children:i.progressLabel})]})]}),e("div",{className:s.synopsis,children:a?.description?a.description:"No synopsis available."}),Array.isArray(a?.genres)&&(a?.genres?.length??0)>0&&e("div",{className:s.details,children:e("div",{className:s.genres,children:a.genres.filter(Boolean).slice(0,4).map(n=>e("span",{className:s.genre,children:n},n))})})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:e(m,{to:i.readTarget,className:s.watchBtn,children:[e(l,{name:"book",size:14}),"Read now"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${r?s.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),p()},children:[r?e(l,{name:"check",size:12}):e(l,{name:"plus",size:12}),e("span",{children:r?"Remove":"Bookmark"})]}),e(m,{to:`/manga/${i.provider}/${encodeURIComponent(i.mangaId)}`,className:s.detailsBtn,children:"Read more"})]})]})]})})},$=()=>P();export{R as M,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-
|
|
1
|
+
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-DNxWyfmM.js";const n=300*1e3;function u(r){return{value:r.id,label:r.label,mature:r.mature,kind:r.kind,sub:r.sub,tier:r.tier,browse:r.browse,facets:r.facets,servers:r.servers}}const d=()=>{const r=a({queryKey:["providers"],queryFn:()=>i("/api/providers"),staleTime:n,retry:1}),e=Array.isArray(r.data)?r.data:null,t=o(()=>e&&e.length>0?e.filter(s=>s.loaded).map(u):[],[e]);return{...r,options:t,isFallback:!e||e.length===0}};export{d 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-D6_9HL2Z.js";import{T as g}from"./TvPopup-S5blnD3l.js";import{c as m,i as f}from"./useTvLibrary-c90knUfT.js";import{b as i}from"./vendor-query-BBT5_sHx.js";import{h as p}from"./index-DNxWyfmM.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-DNxWyfmM.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};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14.9" height="14.9" viewBox="-0.66 -2.36 14.9 14.9">
|
|
2
|
+
<path
|
|
3
|
+
fill="#897cff"
|
|
4
|
+
stroke="#5646db"
|
|
5
|
+
stroke-width="0.9"
|
|
6
|
+
stroke-linejoin="round"
|
|
7
|
+
paint-order="stroke fill"
|
|
8
|
+
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
9
|
+
<path fill="#140f15" d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
10
|
+
<path fill="#140f15" d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
11
|
+
</svg>
|
package/client/dist/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<meta
|
|
8
8
|
name="description"
|
|
@@ -33,11 +33,11 @@
|
|
|
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-DNxWyfmM.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">
|
|
40
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
40
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Ck-R0JKv.css">
|
|
41
41
|
</head>
|
|
42
42
|
|
|
43
43
|
<body>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="38.4" height="13.3" viewBox="-11.85 -0.8 38.4 13.3">
|
|
2
|
+
<path
|
|
3
|
+
fill="#e1afef"
|
|
4
|
+
stroke="#a978a9"
|
|
5
|
+
stroke-width="0.9"
|
|
6
|
+
stroke-linejoin="round"
|
|
7
|
+
paint-order="stroke fill"
|
|
8
|
+
d="M 7.0022839,0 C 3.0649855,0 -0.09802047,2.4883888 0.0022839,6 c 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.5304511,0.392468 6.5849461,-4.168088 C 13.62431,2.8853946 10.939582,0 7.0022839,0 Z" />
|
|
9
|
+
<path fill="#140f15" d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
10
|
+
<path fill="#140f15" d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
11
|
+
<g transform="translate(12.231148 1.5056648)">
|
|
12
|
+
<path
|
|
13
|
+
fill="#e3e1ee"
|
|
14
|
+
stroke="#b3b1c6"
|
|
15
|
+
stroke-width="0.9"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
paint-order="stroke fill"
|
|
18
|
+
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
19
|
+
<path fill="#140f15" d="m 3.3556746,2.945744 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
20
|
+
<path fill="#140f15" d="m 6.9812931,2.945744 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
21
|
+
</g>
|
|
22
|
+
<g transform="translate(-11.063909 1.423053)">
|
|
23
|
+
<path
|
|
24
|
+
fill="#897cff"
|
|
25
|
+
stroke="#5646db"
|
|
26
|
+
stroke-width="0.9"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
paint-order="stroke fill"
|
|
29
|
+
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
30
|
+
<path fill="#140f15" d="m 7.3136624,3.376812 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
31
|
+
<path fill="#140f15" d="m 10.939281,3.376812 c -0.585889,0 -0.652029,2.3368563 -0.02476,2.3368563 0.660496,0 0.670465,-2.3368563 0.02476,-2.3368563 z" />
|
|
32
|
+
</g>
|
|
33
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.9",
|
|
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-10-
|
|
86
|
+
"versionDate": "2026-10-13T22:50:45.916Z"
|
|
87
87
|
}
|
|
@@ -12,6 +12,7 @@ import { keyInput, setSettingInput } from '../validation.js';
|
|
|
12
12
|
export const SETTING_DEFAULTS = {
|
|
13
13
|
discordRPCEnabled: 'true',
|
|
14
14
|
discordRPCHideMature: 'true',
|
|
15
|
+
dangoGaze: 'true',
|
|
15
16
|
ignoreAdultContent: 'true',
|
|
16
17
|
mangaIgnoreAdultContent: 'true',
|
|
17
18
|
tvIgnoreAdultContent: 'true',
|
package/server/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{d as s,A as H,h as G,u as e,q as ae,S as fe,T as ve,p as we,g as re,_ as be}from"./vendor-core-DfaOB3Rn.js";import{d as ke,t as _,B as T,M as $,j as ce,h as Ce,z as ie,F as X,G as _e,T as Se,u as Ne,e as Te,H as Ie,y as oe,A as Re,V as xe,I as Le}from"./index-NKjVUCZV.js";import{u as ne}from"./vendor-query-BBT5_sHx.js";import{T as K}from"./ToggleSwitch-CN_ppEc9.js";import{I as Y}from"./vendor-icons-DrybRNxP.js";const Z={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ee=["name","nativeName","englishName"],te={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},De=()=>{const{titlePreference:t,setTitlePreference:r,loading:i}=ke(),[l,o]=s(te[t]),[v,b]=s(!1),h=H(null);G(()=>{i||o(te[t])},[t,i]);const a=async()=>{if(v)return;b(!0);const g=(ee.indexOf(t)+1)%ee.length,m=ee[g],d=te[m];h.current&&(h.current.style.transform="translateX(-100%)",h.current.style.opacity="0"),setTimeout(async()=>{o(d),r(m),h.current&&(h.current.style.transition="none",h.current.style.transform="translateX(100%)",h.current.style.opacity="0",h.current.offsetWidth,h.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",h.current.style.transform="translateX(0)",h.current.style.opacity="1");try{await _.settings.set.mutate({key:"titlePreference",value:m})}catch(S){console.error("Error saving title preference:",S)}finally{b(!1)}},300)};return i?e("p",{children:"Loading title preference..."}):e("div",{className:Z["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:Z["toggle-button"],disabled:v,children:e("span",{ref:h,className:Z["toggle-label"],children:l})})]})},Pe="_settingsHeader_14a5d_1",Ae="_pageTitle_14a5d_6",Oe="_pageSubtitle_14a5d_14",Me="_settingsLayout_14a5d_20",Ge="_sidebar_14a5d_27",Ue="_sidebarIndicator_14a5d_35",Ee="_sidebarItem_14a5d_50",$e="_active_14a5d_72",ze="_mainContent_14a5d_80",qe="_tabContent_14a5d_85",Fe="_sectionCard_14a5d_103",Ke="_settingItem_14a5d_127",je="_settingRow_14a5d_132",He="_controls_14a5d_145",We="_status_14a5d_151",p={settingsHeader:Pe,pageTitle:Ae,pageSubtitle:Oe,settingsLayout:Me,sidebar:Ge,sidebarIndicator:Ue,sidebarItem:Ee,active:$e,mainContent:ze,tabContent:qe,sectionCard:Fe,settingItem:Ke,settingRow:je,controls:He,status:We},Be="_sectionCard_wt900_12",Ve="_title_wt900_22",Qe="_signIn_wt900_29",Ye="_userInfo_wt900_36",Je="_warning_wt900_58",Xe="_formGroup_wt900_65",Ze="_label_wt900_69",et="_inputWrapper_wt900_79",tt="_input_wt900_79",at="_select_wt900_103",nt="_actions_wt900_140",st="_hr_wt900_148",u={sectionCard:Be,title:Ve,signIn:Qe,userInfo:Ye,warning:Je,formGroup:Xe,label:Ze,inputWrapper:et,input:tt,select:at,actions:nt,hr:st},rt=()=>{const[t,r]=s(!0),[i,l]=s(!1),[o,v]=s(!1),[b,h]=s(null),[a,c]=s({status:"idle"}),[g,m]=s(!1),[d,S]=s(""),[y,k]=s(!1),R=H(null),[x,L]=s({show:!1,message:"",type:"info"}),D=()=>{R.current&&(window.clearInterval(R.current),R.current=null)},w=ae(f=>{v(f.authenticated),h(f.user||f.device.user||null),c(f.device),m(!!f.hasCustomClientId)},[]),C=ae(async()=>{const f=await _.auth.githubStatus.query();w(f)},[w]),A=async()=>{try{const f=await _.auth.githubPoll.query();c(f),f.status==="success"?(D(),await C(),L({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):f.status==="error"&&(D(),L({show:!0,message:f.error||"GitHub authentication failed.",type:"error"}))}catch{D(),L({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},U=(f=5)=>{D(),R.current=window.setInterval(A,Math.max(f,5)*1e3)};G(()=>(C().catch(()=>{L({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>r(!1)),D),[C]);const N=async()=>{l(!0);try{const f=await _.auth.githubStart.mutate();c(f),U(f.verification?.interval)}catch(f){L({show:!0,message:f instanceof Error?f.message:"Failed to start GitHub authentication.",type:"error"})}finally{l(!1)}},P=async()=>{try{await _.auth.githubLogout.mutate(),v(!1),h(null),c({status:"idle"}),L({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{L({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},O=async()=>{k(!0);try{await _.auth.saveGithubAuth.mutate({clientId:d}),S(""),await C(),L({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{L({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},q=async()=>{k(!0);try{await _.auth.saveGithubAuth.mutate({clientId:""}),S(""),await C(),L({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{L({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:u.sectionCard,children:[e("h3",{className:u.title,children:"GitHub Cloud Sync"}),e("p",{className:u.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),o&&b?e("div",{className:u.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:b.name||b.login})]}),e(T,{variant:"danger",onClick:P,children:"Sign Out"})]}):e("div",{className:u.signIn,children:e(T,{onClick:N,disabled:i||a.status==="pending",children:i||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(fe,{children:[e("hr",{className:u.hr}),e("div",{className:u.formGroup,children:[e("label",{className:u.label,children:"Verification URL"}),e("div",{className:u.inputWrapper,children:[e("input",{className:u.input,value:a.verification.verification_uri,readOnly:!0}),e(T,{onClick:()=>{const f=a.verification?.verification_uri;f&&/^https?:\/\//i.test(f)&&window.open(f,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:u.formGroup,children:[e("label",{className:u.label,children:"Device Code"}),e("input",{className:u.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:u.warning,children:a.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",g?"(override active)":""]}),e("div",{className:u.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:u.label,children:"Client ID (optional)"}),e("input",{className:u.input,value:d,onChange:f=>S(f.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:u.actions,children:[e(T,{onClick:O,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:q,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:x.show,onClose:()=>L(f=>({...f,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:x.message})}),e($.Actions,{children:e(T,{onClick:()=>L(f=>({...f,show:!1})),children:"OK"})})]})]})},it=()=>{const[t,r]=s(!0),[i,l]=s(null),[o,v]=s(!1),[b,h]=s(!1),[a,c]=s(""),[g,m]=s(""),[d,S]=s(""),[y,k]=s(!1),[R,x]=s({show:!1,message:"",type:"info"}),L=async()=>{try{const N=await _.auth.user.query();l(N?.email?N:null)}catch{l(null)}},D=async()=>{try{const[N,P]=await Promise.all([_.auth.configStatus.query(),_.auth.googleAuth.query()]);v(!!N.hasConfig),h(!!(P.hasCustomWorkerUrl||P.hasCustomClientId||P.hasClientSecret))}catch(N){console.error("Failed to fetch config status",N)}};G(()=>{(async()=>{r(!0),await Promise.all([L(),D()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await L(),window.history.replaceState(null,"",window.location.pathname))}catch{}r(!1)})();const P=O=>{O.origin===window.location.origin&&typeof O.data=="object"&&O.data!==null&&O.data.type==="GOOGLE_AUTH_SUCCESS"&&(l(O.data.user),window.location.reload())};return window.addEventListener("message",P),()=>window.removeEventListener("message",P)},[]);const w=async()=>{try{const N=await _.auth.googleLogin.mutate();if(N.authenticated){window.location.reload();return}if(N.url){if(typeof window.DangoBridge<"u"){window.location.href=N.url;return}const O=600,q=700,f=window.innerWidth/2-O/2,W=window.innerHeight/2-q/2;window.open(N.url,"GoogleAuth",`width=${O},height=${q},top=${W},left=${f}`)}else throw new Error("Auth URL not available")}catch{x({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},C=async()=>{try{await _.auth.logout.mutate(),l(null),x({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(N){console.error("Sign out failed",N),x({show:!0,message:"Failed to sign out.",type:"error"})}},A=async()=>{k(!0);try{await _.auth.saveGoogleAuth.mutate({workerUrl:a,clientId:g,clientSecret:d}),c(""),m(""),S(""),await D(),x({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{x({show:!0,message:"Failed to save override.",type:"error"})}finally{k(!1)}},U=async()=>{k(!0);try{await _.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),c(""),m(""),S(""),await D(),x({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{x({show:!0,message:"Failed to clear override.",type:"error"})}finally{k(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:u.sectionCard,children:[e("h3",{className:u.title,children:"Google Drive Sync"}),i?e("div",{className:u.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:i.name})," (",i.email,")"]}),e(T,{variant:"danger",onClick:C,children:"Sign Out"})]}):e("div",{className:u.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(T,{onClick:w,disabled:!o,children:"Sign in with Google"}),!o&&e("p",{className:u.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",b?"(override active)":""]}),e("div",{className:u.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:u.label,children:"Worker URL (optional)"}),e("input",{className:u.input,value:a,onChange:N=>c(N.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:u.formGroup,children:[e("label",{className:u.label,children:"Client ID (optional)"}),e("input",{className:u.input,value:g,onChange:N=>m(N.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:u.formGroup,children:[e("label",{className:u.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:u.input,value:d,onChange:N=>S(N.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:u.actions,children:[e(T,{onClick:A,disabled:y,children:"Save override"}),e(T,{variant:"secondary",onClick:U,disabled:y,children:"Use dango defaults"})]})]}),e($,{isOpen:R.show,onClose:()=>x(N=>({...N,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:R.message})}),e($.Actions,{children:e(T,{onClick:()=>x(N=>({...N,show:!1})),children:"OK"})})]})]})},ot="_sectionCard_1pqo4_1",lt="_settingItem_1pqo4_26",ct="_settingRow_1pqo4_31",dt="_modalOverlay_1pqo4_38",ut="_modal_1pqo4_38",ht="_modalActions_1pqo4_73",gt="_modalSecondary_1pqo4_79",mt="_modalPrimary_1pqo4_89",E={sectionCard:ot,settingItem:lt,settingRow:ct,modalOverlay:dt,modal:ut,modalActions:ht,modalSecondary:gt,modalPrimary:mt},pt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},yt=(t,r)=>{if(t==null)return r;const i=String(t);return i==="true"||i==="1"?!0:i==="false"||i==="0"?!1:r},le=(t,r,i)=>{const[l,o]=s(r),[v,b]=s(!1),h=ne();return G(()=>{(async()=>{try{const g=await _.settings.getByKey.query({key:t});o(yt(g.value,r))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,r]),{value:l,setValue:o,isUpdating:v,toggle:async()=>{if(v)return;b(!0);const c=!l;o(c);try{await _.settings.set.mutate({key:t,value:c});for(const g of i)h.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),o(!c)}finally{b(!1)}}}},ft=()=>{const{contentType:t}=ce(),r=pt[t],[i,l]=s(!1),[o,v]=s(!0),[b,h]=s(!1),a=le(r.ignoreKey,!0,r.invalidateKeys),c=le(r.listOnlyKey,!1,r.invalidateKeys),[g,m]=s(null),[d,S]=s(!1),y=ne(),k=Ce();G(()=>{v(!0),(async()=>{try{const C=await _.settings.getByKey.query({key:r.skipKey});String(C.value)==="true"||String(C.value)==="1"?l(!0):l(!1)}catch(C){console.error("Failed to fetch setting",C)}finally{v(!1)}})()},[r.skipKey]);const R=async()=>{if(b)return;h(!0);const w=!i;l(w);try{await _.settings.set.mutate({key:r.skipKey,value:w})}catch(C){console.error("Error saving setting:",C),l(!w)}finally{h(!1)}},x=async()=>{if(!a.isUpdating){if(a.value)try{let w;if(t==="anime"?w=(await _.continueWatching.adultCount.query()).count:t==="manga"?w=(await _.mangaProgress.adultCount.query()).count:t==="asmr"?w=(await _.asmrProgress.adultCount.query()).count:w=(await _.tvProgress.adultCount.query()).count,typeof w=="number"&&w>0){m(w);return}}catch(w){console.error("Failed to fetch adult count",w)}a.toggle()}},L=()=>{m(null),a.toggle()},D=async()=>{if(!d){S(!0);try{let w;t==="anime"?w=(await _.continueWatching.purgeAdult.mutate()).removed:t==="manga"?w=(await _.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?w=(await _.asmrProgress.purgeAdult.mutate()).removed:w=(await _.tvProgress.purgeAdult.mutate()).removed,ie.success(r.purgeDoneText(w??0));for(const C of r.invalidateKeys)y.invalidateQueries({queryKey:C});t==="anime"&&y.invalidateQueries(k.continueWatching.pathFilter()),t==="manga"&&y.invalidateQueries(k.mangaProgress.pathFilter()),t==="asmr"&&y.invalidateQueries(k.asmrProgress.pathFilter()),t==="tv"&&y.invalidateQueries(k.tvProgress.pathFilter())}catch(w){console.error("Failed to purge adult entries",w),ie.error("Failed to remove adult entries")}finally{S(!1),m(null)}a.toggle()}};return o?e("div",{children:"Loading settings..."}):e("div",{className:E.sectionCard,children:[e("h3",{children:r.heading}),e("p",{children:r.blurb}),e("div",{className:E.settingItem,children:e("div",{className:E.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:r.skipLabel}),e(K,{isChecked:i,onChange:R,id:"skip-confirmation-toggle",disabled:b})]})}),e("div",{className:E.settingItem,children:e("div",{className:E.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:r.ignoreLabel}),e(K,{isChecked:a.value,onChange:x,id:"ignore-adult-toggle",disabled:a.isUpdating})]})}),e("div",{className:E.settingItem,children:e("div",{className:E.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:r.listOnlyLabel}),e(K,{isChecked:c.value,onChange:c.toggle,id:"cw-watchlist-only-toggle",disabled:c.isUpdating})]})}),g!==null&&e("div",{className:E.modalOverlay,onClick:()=>m(null),children:e("div",{className:E.modal,onClick:w=>w.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[g," adult ",g===1?"entry":"entries"," not in your"," ",r.listNoun," ",g===1?"is":"are"," currently hidden from"," ",r.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:E.modalActions,children:[e("button",{type:"button",className:E.modalSecondary,onClick:L,disabled:d,children:"Show them"}),e("button",{type:"button",className:E.modalPrimary,onClick:D,disabled:d,children:d?"Purging...":`Purge ${g}`})]})]})})]})},vt="_sectionCard_jkggs_1",wt="_statsGrid_jkggs_26",bt="_statCard_jkggs_33",kt="_statLabel_jkggs_43",Ct="_statValue_jkggs_51",_t="_statMeta_jkggs_57",St="_statusBanner_jkggs_63",Nt="_statusSuccess_jkggs_74",Tt="_statusUpdating_jkggs_80",It="_statusError_jkggs_86",Rt="_sha_jkggs_92",xt="_settingItem_jkggs_99",Lt="_settingRow_jkggs_104",Dt="_settingTitle_jkggs_111",Pt="_settingSubtitle_jkggs_117",At="_actionsRow_jkggs_124",I={sectionCard:vt,statsGrid:wt,statCard:bt,statLabel:kt,statValue:Ct,statMeta:_t,statusBanner:St,statusSuccess:Nt,statusUpdating:Tt,statusError:It,sha:Rt,settingItem:xt,settingRow:Lt,settingTitle:Dt,settingSubtitle:Pt,actionsRow:At},Ot=()=>{const[t,r]=s(null),[i,l]=s(!0),[o,v]=s(!1),[b,h]=s(!1),a=H(null),c=async()=>{try{const y=await _.settings.offlineDbInfo.query();return r(y),y}catch(y){console.error("Failed to fetch offline DB info:",y)}finally{l(!1)}return null};G(()=>(c(),()=>{a.current&&window.clearInterval(a.current)}),[]),G(()=>{t?.isRefreshing?a.current||(a.current=window.setInterval(async()=>{const y=await c();y&&!y.isRefreshing&&a.current&&(window.clearInterval(a.current),a.current=null)},2e3)):a.current&&(window.clearInterval(a.current),a.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||o)return;const y=!t.autoUpdateEnabled;v(!0),r({...t,autoUpdateEnabled:y});try{await _.settings.setOfflineDbAutoUpdate.mutate({enabled:y})}catch(k){console.error("Failed to update auto update setting:",k),r({...t,autoUpdateEnabled:!y})}finally{v(!1)}},m=async()=>{if(!(t?.isRefreshing||b)){h(!0);try{await _.settings.triggerOfflineDbUpdate.mutate(),r(y=>y?{...y,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(y){console.error("Failed to trigger offline DB update:",y)}finally{h(!1)}}},d=y=>{if(!y)return"Never";try{return new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return y}},S=t?.isRefreshing||b;return e("div",{className:I.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:I.statsGrid,children:[e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"MAL Mapped"}),e("span",{className:I.statValue,children:i?"—":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Release"}),e("span",{className:I.statMeta,children:i?"—":t?.releaseTag??"Never"})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Checked"}),e("span",{className:I.statMeta,children:i?"—":d(t?.lastCheckedAt??null)})]}),e("div",{className:I.statCard,children:[e("span",{className:I.statLabel,children:"Last Updated"}),e("span",{className:I.statMeta,children:i?"—":d(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${I.statusBanner} ${t.lastStatus==="failed"?I.statusError:t.lastStatus==="updating"?I.statusUpdating:I.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:I.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:I.settingItem,children:e("div",{className:I.settingRow,children:[e("div",{children:[e("span",{className:I.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:I.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(K,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:g,disabled:i||o})]})}),e("div",{className:I.actionsRow,children:e(T,{onClick:m,disabled:i||S,children:S?"Updating Database...":"Update Offline Database Now"})})]})},Mt="_sectionCard_1g4qx_1",Gt="_dangerCard_1g4qx_26",Ut="_status_1g4qx_34",Et="_warningText_1g4qx_40",$t="_ackLabel_1g4qx_44",Q={sectionCard:Mt,dangerCard:Gt,status:Ut,warningText:Et,ackLabel:$t},zt=()=>{const t=ne(),[r,i]=s(!1),[l,o]=s(!1),[v,b]=s(!1),[h,a]=s(""),c=()=>{o(!1),a(""),i(!0)},g=()=>{v||(i(!1),o(!1))},m=async()=>{if(!(!l||v)){b(!0),a("");try{const d=await fetch("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),S=await d.json();if(!d.ok)throw new Error(S.error||"Failed to clear database");const y=S.deleted,k=S.deletedManga,R=S.deletedTv,x=S.deletedAsmr,L=Object.values(y).reduce((A,U)=>A+(U||0),0)+Object.values(k??{}).reduce((A,U)=>A+(U||0),0)+Object.values(R??{}).reduce((A,U)=>A+(U||0),0)+Object.values(x??{}).reduce((A,U)=>A+(U||0),0),D=(k?.manga_library??0)+(k?.manga_progress??0),w=(R?.tv_library??0)+(R?.tv_progress??0),C=(x?.asmr_library??0)+(x?.asmr_progress??0);a(`Library cleared — ${y.watchlist??0} watchlist entries, ${D} manga rows, ${w} TV rows, ${C} ASMR rows and ${L} total rows removed.`),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]}),t.invalidateQueries({queryKey:["manga-library"]}),t.invalidateQueries({queryKey:["manga-continue-reading"]}),t.invalidateQueries({queryKey:["tv-library"]}),t.invalidateQueries({queryKey:["tv-continue-watching"]}),t.invalidateQueries({queryKey:["asmr-library"]}),t.invalidateQueries({queryKey:["asmr-continue-listening"]}),i(!1)}catch(d){a(d.message)}finally{b(!1),o(!1)}}};return e("div",{className:`${Q.sectionCard} ${Q.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(T,{variant:"danger",onClick:c,children:"Clear Library Data"}),h&&e("p",{className:Q.status,children:h}),e($,{isOpen:r,onClose:g,title:"Clear library data?",width:"sm",children:[e($.Body,{children:[e("p",{className:Q.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:Q.ackLabel,children:[e("input",{type:"checkbox",checked:l,onChange:d=>o(d.target.checked),disabled:v}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e($.Actions,{children:[e(T,{variant:"secondary",onClick:g,disabled:v,children:"Cancel"}),e(T,{variant:"danger",onClick:m,disabled:!l||v,children:v?"Clearing...":"Yes, delete everything"})]})]})]})},qt=()=>{const[t,r]=s(""),[i,l]=s([]),[o,v]=s(null),[b,h]=s(!0),[a,c]=s({show:!1,message:"",type:"info"}),g=async()=>{try{h(!0);const S=await(await fetch("/api/auth/settings/rclone")).json();r(S.remote||""),l(S.availableRemotes||[]),v(S.activeRemote||null)}catch(d){console.error("Failed to fetch Rclone settings",d)}finally{h(!1)}};G(()=>{g()},[]);const m=async()=>{try{if((await fetch("/api/auth/settings/rclone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:t})})).ok)c({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),g();else throw new Error("Failed to save")}catch{c({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return b?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:u.sectionCard,children:[e("h3",{className:u.title,children:"Rclone Cloud Sync"}),e("p",{className:u.signIn,children:"Configure which Rclone remote to use for database synchronization."}),o?e("div",{className:u.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:o})]})}):e("p",{className:u.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:u.formGroup,children:[e("label",{className:u.label,children:"Remote Name"}),e("div",{className:u.inputWrapper,children:e("select",{className:u.select,value:t,onChange:d=>r(d.target.value),children:[e("option",{value:"",children:"(Disabled / None)"}),i.map(d=>e("option",{value:d,children:d},d)),t&&!i.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:u.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:u.actions,children:e(T,{onClick:m,children:"Save Rclone Settings"})}),e($,{isOpen:a.show,onClose:()=>c(d=>({...d,show:!1})),width:"sm",children:[e($.Body,{children:e("p",{children:a.message})}),e($.Actions,{children:e(T,{onClick:()=>c(d=>({...d,show:!1})),children:"OK"})})]})]})},Ft=()=>{const[t,r]=s(null),[i,l]=s(!0),o=async()=>{try{const c=await(await fetch("/api/auth/settings/sync")).json();r(c)}catch(a){console.error("Failed to fetch sync settings",a)}finally{l(!1)}};G(()=>{o()},[]);const v=async a=>{const c=a.target.value;try{const g=await fetch("/api/auth/settings/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:c})});if(g.ok){const m=await g.json();r(d=>d?{...d,activeProvider:m.activeProvider}:null),await o(),X.success(`Sync provider updated to ${c==="default"?"Default Order":c}`)}else X.error("Failed to update sync provider")}catch{X.error("Error updating sync provider")}};if(i||!t)return null;const b=[{value:"default",label:"Default (Priority Based)"}];t.authenticatedProviders.github&&b.push({value:"github",label:"GitHub"}),t.authenticatedProviders.google&&b.push({value:"google",label:"Google Drive"}),t.authenticatedProviders.rclone&&b.push({value:"rclone",label:"Rclone"}),b.push({value:"none",label:"None (Local Only)"});const h=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:p.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:h(t.actualActiveProvider)})]}),e("div",{className:p.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:t.activeProvider,onChange:v,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:b.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function Kt(){return"javascript:"+encodeURIComponent(`(function(){
|
|
2
|
-
if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
|
|
3
|
-
var t=null;
|
|
4
|
-
try{
|
|
5
|
-
window.webpackChunkdiscord_app.push([[Symbol()],{},function(req){
|
|
6
|
-
if(!req.c)return;
|
|
7
|
-
var ms=Object.values(req.c);
|
|
8
|
-
for(var i=0;i<ms.length;i++){var m=ms[i];
|
|
9
|
-
try{
|
|
10
|
-
if(!m.exports||m.exports===window)continue;
|
|
11
|
-
if(typeof m.exports.getToken==='function'){var x=m.exports.getToken();if(x){t=x;return}}
|
|
12
|
-
for(var k in m.exports){try{var ex=m.exports[k];if(ex&&typeof ex.getToken==='function'&&ex[Symbol.toStringTag]!=='IntlMessagesProxy'){var y=ex.getToken();if(y){t=y;return}}}catch(e1){}}
|
|
13
|
-
}catch(e2){}}
|
|
14
|
-
}]);
|
|
15
|
-
window.webpackChunkdiscord_app.pop();
|
|
16
|
-
}catch(e3){}
|
|
17
|
-
if(!t){alert('Dango: could not grab your token. Make sure you are logged in to Discord in this tab, then run the bookmarklet again.');return}
|
|
18
|
-
function copyFallback(){var a=document.createElement('textarea');a.value=t;a.style.position='fixed';a.style.opacity='0';document.body.appendChild(a);a.select();try{document.execCommand('copy')}catch(e4){}document.body.removeChild(a)}
|
|
19
|
-
var done=function(){window.close();setTimeout(function(){if(!window.closed){alert('Dango: token copied to clipboard! Could not close this tab, so just close it, go back to Dango Settings, paste the token and press Save.')}},250)};
|
|
20
|
-
if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t).then(done,function(){copyFallback();done()})}else{copyFallback();done()}
|
|
21
|
-
})()`)}const jt=()=>{const t=ve(Kt,[]);return e("div",{style:{marginTop:"0.9rem",paddingTop:"0.9rem",borderTop:"1px dashed var(--border-color)"},children:[e("h4",{style:{margin:"0 0 0.35rem",fontSize:"0.95rem"},children:"Grab the token automatically (bookmarklet)"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Set this up once and you never have to dig through DevTools: the bookmarklet copies your Discord token to the clipboard and closes the Discord tab — then you just paste it above and press Save."}),e("ol",{style:{margin:"0 0 0.75rem",paddingLeft:"1.25rem",fontSize:"0.85rem",color:"var(--text-secondary)",display:"grid",gap:"0.3rem"},children:[e("li",{children:["Drag the ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," ","button below onto your bookmarks bar (press ",e("kbd",{children:"Ctrl"}),"+",e("kbd",{children:"Shift"}),"+",e("kbd",{children:"B"})," ","first if the bar is hidden)."]}),e("li",{children:["Click ",e("strong",{style:{color:"var(--text-primary)"},children:"Open Discord"})," and log in (skip this if you are already logged in)."]}),e("li",{children:["On the Discord tab, click the"," ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," bookmark. The token lands in your clipboard and the tab closes on its own — come back here, paste it above and press ",e("strong",{children:"Save"}),"."]})]}),e("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("a",{href:t,onClick:l=>{l.preventDefault(),alert("Drag this button onto your bookmarks bar instead of clicking it, then click it while you are on discord.com.")},title:"Drag me to your bookmarks bar",draggable:!0,style:{display:"inline-flex",alignItems:"center",padding:"0.4rem 0.8rem",borderRadius:"999px",border:"1px dashed var(--accent)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"0.85rem",textDecoration:"none",cursor:"grab",userSelect:"none"},children:[e(Y,{name:"bookmark",style:{marginRight:"0.45rem",color:"var(--accent)"}}),"Dango Token Grabber"]}),e("a",{className:"btn btn-secondary btn-sm",href:"https://discord.com/channels/@me",target:"_blank",rel:"noopener noreferrer",children:"Open Discord"}),e(T,{variant:"ghost",size:"sm",onClick:async()=>{try{await navigator.clipboard.writeText(t),alert('Bookmarklet code copied. Create a new bookmark on your bookmarks bar, name it "Dango Token" and paste the code as its URL.')}catch{alert(`Could not copy automatically. Right-click the "Dango Token Grabber" button and choose "Copy link address" instead, then paste that into a new bookmark's URL.`)}},children:"Copy code"})]}),e("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:`"Copy code" is a fallback for browsers that won't drag bookmarklets: create any bookmark, then paste the copied code as its URL.`})]})},Ht="_sectionCard_1ag4p_1",Wt="_settingItem_1ag4p_25",Bt="_field_1ag4p_30",Vt="_input_1ag4p_43",Qt="_actions_1ag4p_63",Yt="_status_1ag4p_69",F={sectionCard:Ht,settingItem:Wt,field:Bt,input:Vt,actions:Qt,status:Yt},Jt=()=>{const[t,r]=s(!1),[i,l]=s(""),[o,v]=s(""),[b,h]=s(!0),[a,c]=s(!1),[g,m]=s("");G(()=>{(async()=>{try{const x=await(await fetch("/api/auth/app-status")).json();r(x.hasPassword)}catch{console.error("Failed to fetch LAN auth status")}finally{h(!1)}})()},[]);const d=async()=>{if(m(""),i!==o){m("Passwords do not match");return}if(i.length<4){m("Password must be at least 4 characters");return}c(!0);try{const k=await fetch("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})}),R=await k.json();if(!k.ok){m(R.error||"Failed to update password");return}r(R.hasPassword),l(""),v(""),m(R.hasPassword?"Password set successfully":"Password removed")}catch{m("Network error")}finally{c(!1)}},S=async()=>{c(!0);try{const k=await fetch("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:""})}),R=await k.json();if(!k.ok){m(R.error||"Failed to remove password");return}r(!1),l(""),v(""),m("Password removed")}catch{m("Network error")}finally{c(!1)}},y=async()=>{c(!0);try{await fetch("/api/auth/app-logout",{method:"POST"}),m("Logged out"),window.location.reload()}catch{m("Logout failed")}finally{c(!1)}};return b?e("div",{className:F.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:F.sectionCard,children:[e("h3",{children:"LAN Lock"}),e("p",{children:"Require a password to access this instance from any device, including this one. Sessions persist across server restarts until logout or password change."}),e("div",{className:F.settingItem,children:[e("div",{className:F.field,children:[e("label",{htmlFor:"lan-password",children:"New Password"}),e("input",{id:"lan-password",type:"password",value:i,onChange:k=>l(k.target.value),placeholder:t?"Leave empty to keep current password":"Enter a password...",className:F.input})]}),e("div",{className:F.field,children:[e("label",{htmlFor:"lan-confirm-password",children:"Confirm Password"}),e("input",{id:"lan-confirm-password",type:"password",value:o,onChange:k=>v(k.target.value),placeholder:"Confirm password...",className:F.input})]}),e("div",{className:F.actions,children:[e(T,{variant:"primary",onClick:d,loading:a,disabled:a,children:t?"Update Password":"Set Password"}),t&&e(T,{variant:"danger",onClick:y,loading:a,disabled:a,children:"Logout"}),t&&e(T,{variant:"secondary",onClick:S,loading:a,disabled:a,children:"Remove Password"})]}),g&&e("p",{className:F.status,children:g})]})]})},Xt=()=>{const{theme:t,setTheme:r,loading:i}=_e();return e("div",{children:[e("h4",{style:{margin:"0 0 0.25rem",fontSize:"1rem"},children:"Palette"}),e("p",{style:{margin:"0 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Taro is the default. Pick a palette that suits you."}),e("div",{role:"radiogroup","aria-label":"Palette",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"0.6rem"},children:Se.map(l=>{const o=t===l.id;return e("button",{role:"radio","aria-checked":o,disabled:i,onClick:()=>r(l.id),style:{display:"flex",gap:"0.6rem",alignItems:"center",textAlign:"left",padding:"0.65rem 0.75rem",borderRadius:"10px",cursor:"pointer",background:o?"var(--accent-subtle)":"var(--bg-tertiary)",border:o?"1px solid var(--accent)":"1px solid var(--border-primary)",color:"var(--text-primary)"},children:[e("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",background:l.swatch,border:"1px solid rgba(0,0,0,0.35)"}}),e("span",{style:{minWidth:0},children:[e("span",{style:{display:"block",fontSize:"0.85rem",fontWeight:700},children:l.label}),e("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.blurb})]})]},l.id)})})]})};function Zt({variant:t="info",children:r,className:i=""}){return e("div",{className:`alert alert-${t} ${i}`,children:r})}const ea={anime:"Watchlist",manga:"Reading List",tv:"TV Watchlist",asmr:"Listening List"},ia=()=>{const[t,r]=we(),{contentType:i}=ce(),l=t.get("tab"),[o,v]=s(l&&["general","sync","watchlist","database"].includes(l)?l:"general"),[b,h]=s(""),a=H(null),c=H(null),g=H(new Map),[m,d]=s({top:0,height:0,left:0,width:0}),{lowEndMode:S,setLowEndMode:y}=Ne(),{hasConsent:k,revoke:R}=Te(),[x,L]=s(Ie),[D,w]=s(!0),{data:C}=oe("discordRPCEnabled"),A=Re(),[U,N]=s(!0),{data:P}=oe("discordRPCHideMature"),[O,q]=s(""),[f,W]=s(null);G(()=>{_.discord.gatewayStatus.query().then(n=>{W(n),n.masked&&n.masked!=="none"&&q(n.masked)}).catch(()=>{})},[]),G(()=>{C!==void 0&&w(C==="true"||C===!0||C===null)},[C]),G(()=>{P!==void 0&&N(P==="true"||P===!0||P===null)},[P]);const de=n=>{w(n),A.mutate({key:"discordRPCEnabled",value:String(n)})},ue=n=>{N(n),A.mutate({key:"discordRPCHideMature",value:String(n)})},he=n=>{L(n),localStorage.setItem(xe,String(n)),window.dispatchEvent(new CustomEvent(Le))};re.useEffect(()=>{document.title="Settings - dango"},[]),re.useEffect(()=>{const n=t.get("tab");n&&["general","sync","watchlist","database"].includes(n)&&v(n)},[t]);const J=n=>{v(n),r(n==="general"?{}:{tab:n})},B=ae(()=>{const n=g.current.get(o),M=c.current;if(n&&M){const j=M.getBoundingClientRect(),z=n.getBoundingClientRect(),V=window.matchMedia("(max-width: 900px)").matches;d(V?{top:z.top-j.top,height:z.height,left:z.left-j.left,width:z.width}:{top:z.top-j.top,height:z.height,left:0,width:0})}},[o]);be(()=>{B()},[o,B]),G(()=>{const n=()=>B();window.addEventListener("resize",n);let M=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{M||B()}),()=>{M=!0,window.removeEventListener("resize",n)}},[o,B]);const ge=()=>{h("Exporting databases...");const n=window.DangoBridge;if(n?.downloadFile){n.downloadFile("/api/backup-db","dango-backup.json"),setTimeout(()=>{h("Databases exported successfully!")},1500);return}const M=document.createElement("a");M.href="/api/backup-db",M.download="dango-backup.json",document.body.appendChild(M),M.click(),M.remove(),setTimeout(()=>{h("Databases exported successfully!")},1500)},me=async n=>{const M=n.target.files?.[0];if(!M)return;h("Importing databases...");const j=new FormData;j.append("dbfile",M);try{const z=await fetch("/api/restore-db",{method:"POST",body:j}),V=await z.json();if(z.ok){const se=Array.isArray(V.restored)?V.restored.join(", "):null;h(se?`Databases imported successfully (${se})!`:"Database imported successfully!"),setTimeout(()=>window.location.reload(),2e3)}else h(`Import failed: ${V.error}`)}catch{h("Import failed: An unexpected error occurred.")}finally{n.target.value=""}},pe=()=>{a.current?.click()},ye=()=>{switch(o){case"general":return e("div",{className:p.tabContent,children:e("div",{className:p.sectionCard,children:[e("h3",{children:"Appearance & Preferences"}),e("p",{children:"Configure how titles are displayed and other general preferences."}),e("div",{className:p.settingItem,children:e(De,{})}),e("div",{className:p.settingItem,style:{marginTop:"1.5rem"},children:e(Xt,{})}),e("div",{className:p.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:p.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Low End Mode"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Disables animations and heavy visual effects for better performance on older hardware."})]}),e(K,{isChecked:S,onChange:n=>y(n.target.checked),id:"low-end-mode"})]})}),e("div",{className:p.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:p.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Virtual Keyboard"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows an on-screen keyboard when text search fields are focused."})]}),e(K,{isChecked:x,onChange:n=>he(n.target.checked),id:"virtual-keyboard-enabled"})]})}),e("div",{className:p.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:p.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Rich Presence"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Show your current anime and watch progress on your Discord profile status."})]}),e(K,{isChecked:D,onChange:n=>de(n.target.checked),id:"discord-rpc-enabled"})]})}),e("div",{style:{marginTop:"2rem"},children:e(Jt,{})}),D&&e("div",{className:p.settingItem,style:{marginTop:"1rem"},children:e("div",{className:p.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Hide Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Hide mature content (18+) from Discord Rich Presence."})]}),e(K,{isChecked:U,onChange:n=>ue(n.target.checked),id:"discord-hide-mature"})]})}),e("div",{className:p.settingItem,style:{marginTop:"1.5rem",background:"var(--bg-tertiary)",padding:"1rem",borderRadius:"8px",border:"1px solid var(--border-color)"},children:[e("div",{className:p.settingRow,children:e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Mobile Presence (Gateway)"}),e("p",{style:{margin:"0.25rem 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Paste your Discord authentication token to enable presence on mobile devices. If no token is saved, the default desktop Rich Presence is used. The token is stored locally in your configuration and never shared."})]})}),e(Zt,{variant:"warning",style:{marginTop:"1.25rem",paddingTop:"1.25rem"},children:[e("strong",{children:"Use at your own risk."})," This feature uses the Discord Gateway API with your user token, which violates Discord's Terms of Service. Discord may detect this usage and take action against your account, including phone number locks, temporary suspensions, or permanent bans. While the risk is generally low, it is not zero. Only use this if you understand and accept the risks."]}),e("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("input",{type:"password",value:O,onChange:n=>q(n.target.value),placeholder:"Paste Discord token here...",style:{flex:"1 1 200px",padding:"0.5rem",borderRadius:"4px",border:"1px solid var(--border-color)",background:"var(--bg-primary)",color:"var(--text-primary)",fontFamily:"monospace",minWidth:0}}),e(T,{variant:"primary",size:"sm",onClick:async()=>{try{const n=await _.discord.gatewaySave.mutate({token:O});W({hasToken:!0,masked:n.masked,enabled:!0}),q(n.masked)}catch(n){alert(n instanceof Error?n.message:"Failed to save token")}},children:"Save"}),e(T,{variant:"secondary",size:"sm",onClick:async()=>{await _.discord.gatewayRemove.mutate().catch(()=>{}),q(""),W({hasToken:!1,masked:null,enabled:!1})},children:"Remove"})]}),f&&e("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",color:f.hasToken?"green":"var(--text-secondary)"},children:["Status:"," ",f.hasToken?`Token saved (${f.masked})`:"No token saved",f.enabled?" - Gateway active":""]}),e(jt,{})]}),k&&e("div",{className:p.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:p.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"You have previously agreed to view 18+ content. Toggle this off to re-enable the blur gate and filtering."})]}),e(K,{isChecked:!0,onChange:n=>{n.target.checked||(R(),window.location.reload())},id:"mature-content-enabled"})]})})]})});case"sync":return e("div",{className:p.tabContent,children:[e(Ft,{}),e(rt,{}),e(it,{}),e(qt,{})]});case"watchlist":return e("div",{className:p.tabContent,children:e(ft,{})});case"database":return e("div",{className:p.tabContent,children:[e("div",{className:p.sectionCard,children:[e("h3",{children:"Database Management"}),e("p",{children:"Download a backup of all databases (anime, manga, TV and ASMR) or restore from a backup file. Legacy single-file anime (.db) backups can still be restored."}),e("div",{className:p.controls,children:[e(T,{onClick:ge,children:"Backup Database"}),e(T,{variant:"secondary",onClick:pe,children:"Restore Database"})]}),e("input",{type:"file",ref:a,onChange:me,style:{position:"absolute",width:1,height:1,opacity:0,overflow:"hidden"},accept:".json,.db,application/octet-stream"}),b&&e("p",{className:p.status,children:b})]}),e(Ot,{}),e(zt,{})]});default:return null}};return e("div",{className:"page-container",children:[e("div",{className:p.settingsHeader,children:[e("h1",{className:p.pageTitle,children:"Settings"}),e("p",{className:p.pageSubtitle,children:"Manage your preferences and data synchronization"})]}),e("div",{className:p.settingsLayout,children:[e("aside",{className:p.sidebar,ref:c,children:[e("div",{className:p.sidebarIndicator,style:{top:m.top,height:m.height,left:m.left,...m.width?{width:m.width}:{}}}),e("button",{ref:n=>{n&&g.current.set("general",n)},className:`${p.sidebarItem} ${o==="general"?p.active:""}`,onClick:()=>J("general"),children:[e(Y,{name:"cog"})," ",e("span",{children:"General"})]}),e("button",{ref:n=>{n&&g.current.set("sync",n)},className:`${p.sidebarItem} ${o==="sync"?p.active:""}`,onClick:()=>J("sync"),children:[e(Y,{name:"cloud"})," ",e("span",{children:"Synchronization"})]}),e("button",{ref:n=>{n&&g.current.set("watchlist",n)},className:`${p.sidebarItem} ${o==="watchlist"?p.active:""}`,onClick:()=>J("watchlist"),children:[e(Y,{name:"list"})," ",e("span",{children:ea[i]})]}),e("button",{ref:n=>{n&&g.current.set("database",n)},className:`${p.sidebarItem} ${o==="database"?p.active:""}`,onClick:()=>J("database"),children:[e(Y,{name:"database"})," ",e("span",{children:"Database"})]})]}),e("main",{className:p.mainContent,children:e("div",{className:p.tabContent,children:ye()},o)})]})]})};export{ia as default};
|