@serifpersia/dango 4.0.7 → 4.0.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 +1 -1
- package/client/dist/assets/AmbientLightMenu-JmM55s7j.js +1 -0
- package/client/dist/assets/{AnimeCard-CcvD-9Bi.js → AnimeCard-b-53YtWg.js} +1 -1
- package/client/dist/assets/{AnimeInfo-t3qfap0B.js → AnimeInfo-nkc_dqNh.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-D3vtcWL7.js → AnimeInfoPage-6Ee5ZHLo.js} +2 -2
- package/client/dist/assets/{Asmr-GHxClLoM.js → Asmr-DKguNIXd.js} +1 -1
- package/client/dist/assets/{AsmrPopup-Bt7wZkV8.js → AsmrPopup-CGEB-Kvs.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Di6VgAZx.js → AsmrResetProgressModal-BeFdF9K3.js} +1 -1
- package/client/dist/assets/Home-CoBFY-dI.css +1 -0
- package/client/dist/assets/Home-DkqyQNvN.js +1 -0
- package/client/dist/assets/{Insights-B-jf5_UY.js → Insights-BuRpXDDL.js} +1 -1
- package/client/dist/assets/{LibraryListPage-B5q00Vno.js → LibraryListPage-DZFS8rVq.js} +1 -1
- package/client/dist/assets/{ListeningList-BNUrMPyA.js → ListeningList-VVvcvQlT.js} +1 -1
- package/client/dist/assets/{Manga-SYhXSYV_.js → Manga-CW8EcY5b.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-CsGcpQ4g.js → MangaInfoPage-NoGbmyMn.js} +1 -1
- package/client/dist/assets/{MangaReadPage-B0BKdQeU.js → MangaReadPage-D5iydDmy.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-8Q_Jp8Tk.js → MangaResetProgressModal-DzUFivte.js} +1 -1
- package/client/dist/assets/Mature-DciBmGdw.js +1 -0
- package/client/dist/assets/{MatureConsentModal-DoPl5ONK.js → MatureConsentModal-CJcnA2Uj.js} +1 -1
- package/client/dist/assets/{MediaCard-Ce90T0yC.js → MediaCard-CVcMufm7.js} +1 -1
- package/client/dist/assets/{Player-CYrY9dNs.js → Player-oPxiL_OZ.js} +6 -6
- package/client/dist/assets/{PlayerProvider-CjctET1A.js → PlayerProvider-Xhw7H58n.js} +1 -1
- package/client/dist/assets/PlayerSettings-BBy5U9hv.js +1 -0
- package/client/dist/assets/{PlayerSurface-B_rgFBYD.js → PlayerSurface-DfHO6_SI.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-BHkP1DB_.js → QueueOptionsButton-BY-l4POc.js} +1 -1
- package/client/dist/assets/{QueueRail-CxtCW4xn.js → QueueRail-cLqEp8MD.js} +1 -1
- package/client/dist/assets/{ReadingList-C0hu5BhB.js → ReadingList-Dumcsksm.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CncQLVw1.js → ResetProgressModal-BLU57mHM.js} +1 -1
- package/client/dist/assets/{Search-J3jIU8gd.js → Search-Cad-umPS.js} +1 -1
- package/client/dist/assets/{Settings-B8jClutS.js → Settings-BJgbyHSZ.js} +2 -2
- package/client/dist/assets/{SkeletonGrid-zCAxRZIz.js → SkeletonGrid-xe5EDdzV.js} +1 -1
- package/client/dist/assets/{Trackers-DTlCK6Gw.js → Trackers-FBVYcCT_.js} +1 -1
- package/client/dist/assets/Tv-B_EUjRAA.js +4 -0
- package/client/dist/assets/{TvInfo-Co-CnIbQ.js → TvInfo-Dp7dfUP2.js} +1 -1
- package/client/dist/assets/TvPopup-DuSXRbpD.js +1 -0
- package/client/dist/assets/{TvSearch-dkkP831q.js → TvSearch-Ye7Hj_un.js} +1 -1
- package/client/dist/assets/{TvWatchlist-CTxHqUB9.js → TvWatchlist-BvT_bqhG.js} +1 -1
- package/client/dist/assets/{VirtualKeyboard-ClY9H0vl.js → VirtualKeyboard-CzGcfsAk.js} +1 -1
- package/client/dist/assets/{WatchAlong-RAJe62YS.js → WatchAlong-DsPGvRNW.js} +1 -1
- package/client/dist/assets/{WatchAlongPanel-G2j2eopw.js → WatchAlongPanel-Pc2hYO_v.js} +1 -1
- package/client/dist/assets/{Watchlist-D8prt4l1.js → Watchlist-G-sHVKs0.js} +1 -1
- package/client/dist/assets/atkinson-hyperlegible-latin-400-normal-BbWidj28.woff +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-400-normal-BrHNak5F.woff2 +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-700-normal-BK6Glc0m.woff +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-700-normal-GZI4o3u0.woff2 +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-ext-400-normal-Bbz-b3yf.woff +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-ext-400-normal-DRk46D-x.woff2 +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-ext-700-normal-BoVPHkS0.woff2 +0 -0
- package/client/dist/assets/atkinson-hyperlegible-latin-ext-700-normal-CKkU2Dpt.woff +0 -0
- package/client/dist/assets/bangers-latin-400-normal-BAEm-Pv0.woff +0 -0
- package/client/dist/assets/bangers-latin-400-normal-DeHY8Ncq.woff2 +0 -0
- package/client/dist/assets/bangers-latin-ext-400-normal-7BLmjjiv.woff2 +0 -0
- package/client/dist/assets/bangers-latin-ext-400-normal-CzVt_Cgx.woff +0 -0
- package/client/dist/assets/bangers-vietnamese-400-normal-BbvBhFjQ.woff2 +0 -0
- package/client/dist/assets/bangers-vietnamese-400-normal-Ll9rymNv.woff +0 -0
- package/client/dist/assets/bree-serif-latin-400-normal-DFKDEHQE.woff2 +0 -0
- package/client/dist/assets/bree-serif-latin-400-normal-Dbaz2OwO.woff +0 -0
- package/client/dist/assets/bree-serif-latin-ext-400-normal-CnorAOA2.woff +0 -0
- package/client/dist/assets/bree-serif-latin-ext-400-normal-amfO-E0k.woff2 +0 -0
- package/client/dist/assets/chakra-petch-latin-400-normal-D7EtbySE.woff +0 -0
- package/client/dist/assets/chakra-petch-latin-400-normal-SafcrIr2.woff2 +0 -0
- package/client/dist/assets/chakra-petch-latin-700-normal-CnDBPjkL.woff2 +0 -0
- package/client/dist/assets/chakra-petch-latin-700-normal-D1s_c2du.woff +0 -0
- package/client/dist/assets/chakra-petch-latin-ext-400-normal-C8u6EFkq.woff2 +0 -0
- package/client/dist/assets/chakra-petch-latin-ext-400-normal-MNNNbyh_.woff +0 -0
- package/client/dist/assets/chakra-petch-latin-ext-700-normal-BeviJPUl.woff +0 -0
- package/client/dist/assets/chakra-petch-latin-ext-700-normal-DAkvJhej.woff2 +0 -0
- package/client/dist/assets/chakra-petch-thai-400-normal-Bw1Q-fVY.woff2 +0 -0
- package/client/dist/assets/chakra-petch-thai-400-normal-KdzBjiWs.woff +0 -0
- package/client/dist/assets/chakra-petch-thai-700-normal-B7WL5pBr.woff2 +0 -0
- package/client/dist/assets/chakra-petch-thai-700-normal-vZLZ_5L8.woff +0 -0
- package/client/dist/assets/chakra-petch-vietnamese-400-normal-Cn7ya5On.woff +0 -0
- package/client/dist/assets/chakra-petch-vietnamese-700-normal-gQuUA8Wu.woff +0 -0
- package/client/dist/assets/comic-neue-latin-400-normal-BdhG8RSD.woff2 +0 -0
- package/client/dist/assets/comic-neue-latin-400-normal-CU7kPFAv.woff +0 -0
- package/client/dist/assets/comic-neue-latin-700-normal-NE4Vcoll.woff2 +0 -0
- package/client/dist/assets/comic-neue-latin-700-normal-yR9qu__P.woff +0 -0
- package/client/dist/assets/{index-BOJFs4B4.js → index-CaTGvWwZ.js} +2 -2
- package/client/dist/assets/{libraryInvalidation-1xwHWgGv.js → libraryInvalidation-Bn7rPtR2.js} +1 -1
- package/client/dist/assets/oswald-cyrillic-ext-wght-normal-DLWmRmaW.woff2 +0 -0
- package/client/dist/assets/oswald-cyrillic-wght-normal-C8sJyxwB.woff2 +0 -0
- package/client/dist/assets/oswald-latin-ext-wght-normal-Dj_1K-Kw.woff2 +0 -0
- package/client/dist/assets/oswald-latin-wght-normal-CzS3kehr.woff2 +0 -0
- package/client/dist/assets/oswald-vietnamese-wght-normal-Tdf5mmdl.woff2 +0 -0
- package/client/dist/assets/{playbackCompletion-BpEGpC-Z.js → playbackCompletion-Cv5b1X7P.js} +1 -1
- package/client/dist/assets/russo-one-cyrillic-400-normal-BXZIn0h3.woff2 +0 -0
- package/client/dist/assets/russo-one-cyrillic-400-normal-rRbrNFRA.woff +0 -0
- package/client/dist/assets/russo-one-latin-400-normal-BfOuQF9V.woff2 +0 -0
- package/client/dist/assets/russo-one-latin-400-normal-CosRecV9.woff +0 -0
- package/client/dist/assets/russo-one-latin-ext-400-normal-BssN3Pxm.woff +0 -0
- package/client/dist/assets/russo-one-latin-ext-400-normal-CezFp_e4.woff2 +0 -0
- package/client/dist/assets/useAnimeInfoData-labdig-v.js +1 -0
- package/client/dist/assets/{useMangaLibrary-OgS0RRdO.js → useMangaLibrary-azB3VMor.js} +1 -1
- package/client/dist/assets/{useMangaPopup-Eyed-Gg3.js → useMangaPopup-CS9sxdTY.js} +1 -1
- package/client/dist/assets/{useTv-SLXsIWFQ.js → useTv-DtCO9m0I.js} +1 -1
- package/client/dist/assets/{useTvLibrary-F0S6WnwD.js → useTvLibrary-ByqbivhY.js} +1 -1
- package/client/dist/assets/useWatchAlongPlayer-BksJHCzs.css +1 -0
- package/client/dist/assets/useWatchAlongPlayer-CPxdEuB8.js +11 -0
- package/client/dist/index.html +1 -1
- package/client/dist/subtitle-font-licenses.txt +113 -0
- package/package.json +2 -2
- package/server/dist/server.js +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/Home-Bmc4hGfd.css +0 -1
- package/client/dist/assets/Home-C9caLBqU.js +0 -1
- package/client/dist/assets/Mature-DtyWIW42.js +0 -1
- package/client/dist/assets/OptionListMenu-CHqo2pTO.js +0 -1
- package/client/dist/assets/PlayerSettings-uDMPYAlP.js +0 -1
- package/client/dist/assets/Tv-CnahgiVt.js +0 -4
- package/client/dist/assets/TvPopup-Ci4SXMWf.js +0 -1
- package/client/dist/assets/useAnimeInfoData-CvV6vRjn.js +0 -1
- package/client/dist/assets/useWatchAlongPlayer-BsaopdPw.css +0 -1
- package/client/dist/assets/useWatchAlongPlayer-D-fPdbp2.js +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as s,u as n,a as G}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-C1Pj_eSX.js";import{
|
|
1
|
+
import{g as s,u as n,a as G}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-C1Pj_eSX.js";import{e as X,F as Y,f as L}from"./index-CaTGvWwZ.js";const z="_section_5peha_1",O="_header_5peha_10",j="_headerToggle_5peha_20",J="_headerActions_5peha_34",K="_title_5peha_40",V="_badge_5peha_50",W="_clearBtn_5peha_65",Z="_nextBtn_5peha_83",ee="_list_5peha_101",ne="_item_5peha_115",te="_active_5peha_135",ae="_dragging_5peha_143",re="_dragHandle_5peha_150",oe="_thumbnail_5peha_168",ce="_meta_5peha_176",se="_name_5peha_183",le="_episode_5peha_205",ie="_iconBtn_5peha_211",ue="_metaGap_5peha_257",a={section:z,header:O,headerToggle:j,headerActions:J,title:K,badge:V,clearBtn:W,nextBtn:Z,list:ee,item:ne,active:te,dragging:ae,dragHandle:re,thumbnail:oe,meta:ce,name:se,episode:le,iconBtn:ie,metaGap:ue},de=({item:r,isActive:I,index:g,onRemove:v,onTouchPointerDown:x,onTouchPointerMove:B,onTouchPointerUp:w,onTouchPointerCancel:y,shouldIgnoreClick:_,onDragStart:R,onDragEnter:f,onDragEnd:c,isDragging:b})=>{const o=G(),{titlePreference:l}=X(),i=r[l]||r.name||"Unknown show";return n("div",{"data-queue-index":g,className:`${a.item} ${I?a.active:""} ${b?a.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>x(g,u),onPointerMove:B,onPointerUp:w,onPointerCancel:y,children:[n("button",{className:a.dragHandle,type:"button","aria-label":"Drag queue item",children:n(D,{name:"bars"})}),n(Y,{className:a.thumbnail,src:L(r.thumbnail||"",72,96),alt:i,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:a.meta,children:[n("button",{className:a.name,type:"button",onClick:()=>{_()||o(`/watch/${r.showId}/${r.episodeNumber}`)},children:i}),n("div",{className:a.episode,children:["Episode ",r.episodeNumber]})]}),n("button",{className:a.iconBtn,type:"button",onClick:()=>{_()||v(r)},"aria-label":`Remove ${i} episode ${r.episodeNumber} from queue`,children:n(D,{name:"times"})})]})},ge=({title:r="Queue",eyebrow:I,items:g,currentShowId:v,currentEpisode:x,onRemove:B,onReorder:w,onNextQueue:y,onClear:_,showClearAll:R=!1,defaultExpanded:f=!0})=>{const[c,b]=s.useState([]),[o,l]=s.useState(null),[i,u]=s.useState(f),N=s.useRef(null),T=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(g)},[g]),s.useEffect(()=>{u(f)},[f]);const $=e=>{l(e)},k=e=>{if(o===null||o===e)return;const t=[...c],p=t[o];t.splice(o,1),t.splice(e,0,p),l(e),b(t)},A=()=>{o!==null&&w(c.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),l(null)},E=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&h.current&&(w(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,T.current=null,h.current=!1,l(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const p=t.currentTarget,m=t.pointerId;N.current=t.pointerId,T.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,l(e);try{p.setPointerCapture(m)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&T.current){const H=Math.abs(e.clientX-T.current.x),F=Math.abs(e.clientY-T.current.y);(H>8||F>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const p=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),m=p?Number(p.dataset.queueIndex):NaN;if(Number.isNaN(m)||o===null||m===o)return;const P=[...c],U=P[o];P.splice(o,1),P.splice(m,0,U),l(m),b(P)},q=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(h.current)},M=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(!1)};return c.length===0?null:n("section",{className:a.section,children:[n("div",{className:a.header,children:[n("button",{className:a.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":i,"aria-label":i?`Collapse ${r}`:`Expand ${r}`,children:[n("span",{className:a.title,children:[n("span",{className:"title-stack",children:[I&&n("div",{className:"section-eyebrow",children:I}),n("span",{children:r})]}),n("span",{className:a.badge,children:c.length})]}),i?n(D,{name:"chevron-up"}):n(D,{name:"chevron-down"})]}),R&&_&&n("div",{className:a.headerActions,children:[y&&c.length>1&&n("button",{className:a.nextBtn,type:"button",onClick:y,children:"Next"}),n("button",{className:a.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),i&&n("div",{className:a.list,children:c.map((e,t)=>n(de,{item:e,isActive:e.showId===v&&e.episodeNumber===x,index:t,onRemove:B,onTouchPointerDown:Q,onTouchPointerMove:S,onTouchPointerUp:q,onTouchPointerCancel:M,shouldIgnoreClick:()=>C.current,onDragStart:()=>$(t),onDragEnter:()=>k(t),onDragEnd:A,isDragging:o===t},e.id))})]})};export{ge as Q,a as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-
|
|
1
|
+
import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-CVcMufm7.js";import{L as F}from"./LibraryListPage-DZFS8rVq.js";import{u as _,M as q}from"./useMangaPopup-CS9sxdTY.js";import{M as D}from"./MangaResetProgressModal-DzUFivte.js";import{m as G}from"./index-CaTGvWwZ.js";import{n as O,b as Q,h as Y,j,u as z,o as H,q as K,s as V,M as R,m as Z,i as J,a as W}from"./useMangaLibrary-azB3VMor.js";import"./vendor-icons-C1Pj_eSX.js";import"./MediaPopupShell-BewMMT93.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-CJcnA2Uj.js";import"./SkeletonGrid-xe5EDdzV.js";import"./ErrorMessage-hMt90aG4.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-BLU57mHM.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-Bn7rPtR2.js";const X=["All","Continue Reading",...R],h=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function Ia(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,h),s=Q(100),I=Y(),T=j(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:f}=_(),M=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.watchlistStatus??"",contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...R],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:h,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>M.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate({ids:a}):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:G(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:J(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(q,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:f}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ia as default};
|
package/client/dist/assets/{ResetProgressModal-CncQLVw1.js → ResetProgressModal-BLU57mHM.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{S as a,B as c}from"./index-
|
|
1
|
+
import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{S as a,B as c}from"./index-CaTGvWwZ.js";const g=({isOpen:o,itemName:n,progressKind:d,listLabel:i,onClose:s,onConfirm:h})=>{const[l,r]=f(!1);return u(()=>{o&&r(!1)},[o]),e(a,{isOpen:o,onClose:()=>{r(!1),s()},title:"Reset Progress",children:[e(a.Body,{children:[e("p",{children:["Are you sure you want to remove your ",d,' progress for "',n,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:l,onChange:t=>r(t.currentTarget.checked)}),"Also remove from ",i]})]}),e(a.Actions,{children:[e(c,{variant:"secondary",onClick:()=>{r(!1),s()},children:"No"}),e(c,{variant:"danger",onClick:()=>{const t=l;r(!1),h(t),s()},children:"Yes"})]})]})};export{g as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as G,p as pe,a as fe,d as c,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-C1Pj_eSX.js";import{P as te}from"./MediaCard-
|
|
1
|
+
import{h as G,p as pe,a as fe,d as c,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-C1Pj_eSX.js";import{P as te}from"./MediaCard-CVcMufm7.js";import{A as Ae}from"./AnimeCard-b-53YtWg.js";import{S as Se}from"./SkeletonGrid-xe5EDdzV.js";import{t as ye,a as be,J as Ce,a8 as le,B as U,a9 as Ne}from"./index-CaTGvWwZ.js";import{E as Te}from"./ErrorMessage-hMt90aG4.js";import{A as Ee}from"./ActiveFilterChips-olGfwxle.js";import{s as t}from"./Search.module-DjQZ0jox.js";import"./MediaPopupShell-BewMMT93.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-CJcnA2Uj.js";import"./useAnimeInfoData-labdig-v.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-BY-l4POc.js";import"./playbackCompletion-Cv5b1X7P.js";const Re=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Pe=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Oe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function Je(){G(()=>{document.title="Search - dango"},[]);const[r,se]=pe(),k=fe(),[d,$]=c(r.get("query")||""),[v,F]=c(parseInt(r.get("page")||"1")),[h,g]=c(r.get("type")||"ALL"),[L,A]=c(r.get("season")||"ALL"),[S,y]=c(r.get("year")||"ALL"),[M,D]=c(r.get("country")||"ALL"),[V,re]=c(r.get("provider")||"anilist"),[j,O]=c(r.get("sortBy")||"POPULARITY_DESC"),[q,w]=c(r.get("status")||""),[b,ne]=c(!1),[ie,z]=c(null);G(()=>{let e=!1;return ye.data.anilistStatus.query().then(s=>{e||z(s.available)}).catch(()=>{e||z(!0)}),()=>{e=!0}},[]);const{lowEndMode:oe}=be(),_=ge(null),{data:ce}=Ce(),H=ce?.genres||[],[C,N]=c(()=>{const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),e}),W=new URLSearchParams(r);W.delete("page");const J=W.toString(),{data:p=[],isLoading:T,isError:ue,error:de}=le(J,v,14),{data:K}=le(J,v+1,14),[x,he]=c(!1),E=Le.useMemo(()=>V==="anilist"&&h==="ADULT"||x?p:p.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[p,x,V,h]);G(()=>{$(r.get("query")||""),g(r.get("type")||"ALL"),A(r.get("season")||"ALL"),y(r.get("year")||"ALL"),D(r.get("country")||"ALL"),re(r.get("provider")||"anilist"),O(r.get("sortBy")||"POPULARITY_DESC"),w(r.get("status")||""),F(parseInt(r.get("page")||"1"));const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],i=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];s.forEach(l=>l&&(e[l]="include")),i.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const u=(e=1,s={})=>{Ne();const i=s.type??h,l=s.status??q,R=s.season??L,P=s.year??S,Z=s.country??M,I=s.sort??j,ee=s.genreState??C,ve=s.showMature??x,o=new URLSearchParams;d.trim()&&o.set("query",d.trim()),i!=="ALL"&&o.set("type",i),l&&o.set("status",l),R!=="ALL"&&o.set("season",R),P!=="ALL"&&o.set("year",P),Z!=="ALL"&&o.set("country",Z),I!=="POPULARITY_DESC"&&o.set("sortBy",I);const Y=Object.entries(ee).filter(([,n])=>n==="include").map(([n])=>n),ae=Object.entries(ee).filter(([,n])=>n==="exclude").map(([n])=>n);if(Y.some(n=>n.toLowerCase()==="hentai")){const n=new URLSearchParams;n.set("provider","anilist"),d.trim()&&n.set("query",d.trim()),l&&n.set("status",l),R!=="ALL"&&n.set("season",R),P!=="ALL"&&n.set("year",P),I!=="POPULARITY_DESC"&&n.set("sortBy",I),k(`/mature?${n.toString()}`);return}Y.length>0&&o.set("genres",Y.join(",")),ae.length>0&&o.set("excludeGenres",ae.join(",")),i!=="ADULT"&&!ve&&o.set("adult","false"),o.set("provider","anilist"),e>1&&o.set("page",e.toString()),se(o),e!==v&&F(e)},Q=e=>{if(u(e),_.current){const s=_.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:s,behavior:"smooth"})}},B=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:B-1980+1},(e,s)=>({value:String(B-s),label:String(B-s)}))],X=p.length>=14&&K&&K.length>0,m=[];h!=="ALL"&&m.push({key:"type",label:`Type: ${h}`,onRemove:()=>{g("ALL"),u(1,{type:"ALL"})}}),L!=="ALL"&&m.push({key:"season",label:`Season: ${L}`,onRemove:()=>{A("ALL"),u(1,{season:"ALL"})}}),S!=="ALL"&&m.push({key:"year",label:`Year: ${S}`,onRemove:()=>{y("ALL"),u(1,{year:"ALL"})}});for(const[e,s]of Object.entries(C))m.push({key:e,label:s==="include"?`+ ${e}`:`-${e}`,tone:s==="include"?"primary":"danger",onRemove:()=>{const i={...C};delete i[e],N(i),u(1,{genreState:i})}});return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(f,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:d,onInput:e=>$(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&u()})]}),a("div",{className:t.searchActions,children:[a(U,{onClick:()=>u(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${b?t.active:""}`,onClick:()=>ne(!b),children:[a(f,{name:"filter",size:14}),a("span",{children:"Filters"}),b?a(f,{name:"chevron-up",size:12}):a(f,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${b?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:h,onChange:e=>{if(e.currentTarget.value==="ADULT"){k("/mature?provider=mal");return}g(e.currentTarget.value)},children:Re.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:q,onChange:e=>w(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Oe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:L,onChange:e=>A(e.currentTarget.value),children:Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:S,onChange:e=>y(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",ie===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only - ignored by fallback providers"})]}),a("select",{value:M,onChange:e=>D(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:j,onChange:e=>O(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),H.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:H.map(e=>a("button",{className:`${t.genreButton} ${t[C[e]||""]}`,onClick:()=>{N(s=>{const i=s[e],l={...s};return i==="include"?l[e]="exclude":i==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(U,{variant:"secondary",onClick:()=>{N({}),g("ALL"),A("ALL"),y("ALL"),D("ALL"),O("POPULARITY_DESC"),w(""),he(!1),u(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(U,{onClick:()=>u(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ue&&a(Te,{message:de?.message||"Error"}),m.length>0&&a(Ee,{chips:m}),a("div",{className:t.resultsHeader,ref:_,children:[a("h2",{className:t.resultsTitle,children:d?`Search Results for "${d}"`:"Discover Anime"}),E.length>0&&a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:T?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!T&&E.length===0&&a("div",{className:t.noResults,children:[a(f,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),E.length>0&&a("div",{className:t.bottomPagination,children:a(te,{page:v,canGoNext:X,onChange:Q,isLoading:T,variant:"labeled"})})]})}export{Je as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as r,u as e,S as le,A as X,h as z,q as pe,T as qe,p as ze,g as be,_ as Ue}from"./vendor-core-DfaOB3Rn.js";import{b as fe,u as ee}from"./vendor-query-BBT5_sHx.js";import{U as Z,V as Q,W as U,X as Ce,B as C,Y as Ee,S as K,d as Ke,O as Te,t as k,w as Fe,r as $e,L as ke,Z as J,q as H,_ as Se,$ as We,a0 as He,u as Be,g as je,a1 as Qe,N as de,p as Ve,a2 as Ye,a3 as Je}from"./index-BOJFs4B4.js";import{I as j}from"./vendor-icons-C1Pj_eSX.js";import{T as F}from"./ToggleSwitch-CN_ppEc9.js";import{l as Xe,s as Ze}from"./playbackCompletion-BpEGpC-Z.js";import{M as et}from"./MatureConsentModal-DoPl5ONK.js";const tt="_sectionCard_1vuib_1",at="_dangerCard_1vuib_20",nt="_settingRow_1vuib_31",_={sectionCard:tt,dangerCard:at,settingRow:nt};function rt(){const{data:t}=fe(Z),{data:s}=fe({queryKey:["profiles"],queryFn:()=>Q("/api/profiles/status"),enabled:!!t?.owner}),c=ee(),[p,d]=r(null),[y,S]=r(""),[h,o]=r(""),[a,g]=r(""),[v,m]=r(""),[x,l]=r(""),[f,T]=r(!1),[I,G]=r(null),[P,w]=r(null),[L,A]=r(""),M=async i=>{T(!0),l("");try{await Q("/api/profiles/update",{method:"POST",body:JSON.stringify(i)}),await c.invalidateQueries({queryKey:Z.queryKey}),S(""),o(""),l("Profile saved")}catch(R){l(R.message)}finally{T(!1)}};return t?e("section",{className:_.sectionCard,children:[e("h3",{children:"Your profile"}),e("p",{children:"Keep using this profile, rename it, or add another person with their own library and connections."}),e("div",{className:U.avatarRow,children:[e(Ce,{image:t.image,name:t.name}),e("label",{className:U.uploadButton,children:[e(j,{name:"upload"}),e("span",{children:"Upload image"}),e("input",{className:U.fileInput,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:f,onChange:async i=>{const R=i.currentTarget.files?.[0];if(i.currentTarget.value="",!R)return;if(R.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const D=new FileReader;D.onerror=()=>l("Could not read image"),D.onload=()=>{M({avatar:D.result})},D.readAsDataURL(R)}})]}),t.avatar&&e(C,{variant:"secondary",disabled:f,onClick:()=>M({avatar:null}),children:"Clear uploaded image"})]}),e("p",{children:"Your uploaded image takes priority, followed by your active cloud account image, then the default user icon."}),e("form",{className:U.form,onSubmit:i=>{i.preventDefault(),M({name:p??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:p??t.name,maxLength:60,required:!0,onChange:i=>d(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f,children:"Save name"})]}),e("form",{className:U.form,onSubmit:i=>{i.preventDefault(),M({password:y,currentPassword:h})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:h,required:!0,maxLength:256,onChange:i=>o(i.currentTarget.value)})]}),e("label",{className:U.field,children:[t.protected?"New password (empty removes protection)":"Protect this profile",e("input",{type:"password",autoComplete:"new-password",value:y,minLength:8,maxLength:256,onChange:i=>S(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f,children:"Save password"})]}),e(C,{variant:"secondary",disabled:f,onClick:async()=>{T(!0);try{await Q("/api/profiles/logout",{method:"POST"}),Ee()}catch(i){l(i.message),T(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async i=>{i.preventDefault(),T(!0),l("");try{await Q("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:v})}),g(""),m(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(R){l(R.message)}finally{T(!1)}},children:[e("h3",{children:"Add another profile"}),e("p",{children:"Protect your owner profile first. New profiles start empty and do not inherit your accounts. A profile without a password is accessible to anyone who passes the LAN lock."}),e("label",{className:U.field,children:["Name",e("input",{required:!0,maxLength:60,value:a,onChange:i=>g(i.currentTarget.value)})]}),e("label",{className:U.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:v,onChange:i=>m(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f||!t.protected,children:"Create profile"})]}),t.owner&&s?.profiles.some(i=>!i.owner)&&e(le,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:s.profiles.filter(i=>!i.owner).map(i=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(Ce,{image:i.avatar??i.cloudAvatar,name:i.name})}),e("span",{className:U.profileName,children:i.name}),e(C,{variant:"secondary",size:"sm",disabled:f,onClick:()=>{l(""),A(""),w(i)},children:"Reset password"}),e(C,{variant:"danger",size:"sm",disabled:f,onClick:()=>{l(""),G(i)},children:"Delete"})]},i.id))})]}),e(K,{isOpen:!!P,onClose:f?void 0:()=>w(null),title:"Reset password",width:"sm",footer:e(le,{children:[e(C,{variant:"secondary",disabled:f,onClick:()=>w(null),children:"Cancel"}),e(C,{loading:f,onClick:async()=>{if(P){T(!0),l("");try{await Q("/api/profiles/reset-password",{method:"POST",body:JSON.stringify({id:P.id,password:L})}),await c.invalidateQueries({queryKey:["profiles"]}),w(null),A(""),l("Password updated. The profile has been signed out.")}catch(i){l(i.message)}finally{T(!1)}}},children:"Save password"})]}),children:[e("p",{children:["Set a new password for ",e("strong",{children:P?.name}),". They will be signed out and must use the new password next time."]}),e("label",{className:U.field,children:["New password",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,placeholder:"Leave empty to remove their password",value:L,onChange:i=>A(i.currentTarget.value)})]})]}),e(K,{isOpen:!!I,onClose:f?void 0:()=>G(null),title:"Delete profile?",width:"sm",footer:e(le,{children:[e(C,{variant:"secondary",disabled:f,onClick:()=>G(null),children:"Cancel"}),e(C,{variant:"danger",loading:f,onClick:async()=>{if(I){T(!0);try{await Q("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:I.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),G(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(i){l(i.message),G(null)}finally{T(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:I?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),x&&e("p",{role:"status",children:x})]}):null}const ue={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},he=["name","nativeName","englishName"],ge={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},st=()=>{const{titlePreference:t,setTitlePreference:s,loading:c}=Ke(),p=Te(),[d,y]=r(ge[t]),[S,h]=r(!1),o=X(null);z(()=>{c||y(ge[t])},[t,c]);const a=async()=>{if(S)return;h(!0);const v=(he.indexOf(t)+1)%he.length,m=he[v],x=ge[m];o.current&&(o.current.style.transform="translateX(-100%)",o.current.style.opacity="0"),setTimeout(async()=>{y(x),s(m),o.current&&(o.current.style.transition="none",o.current.style.transform="translateX(100%)",o.current.style.opacity="0",o.current.offsetWidth,o.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",o.current.style.transform="translateX(0)",o.current.style.opacity="1");try{await p.mutateAsync({key:"titlePreference",value:m})}catch(l){console.error("Error saving title preference:",l)}finally{h(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:ue["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ue["toggle-button"],disabled:S,children:e("span",{ref:o,className:ue["toggle-label"],children:d})})]})},it="_settingsHeader_gfwoa_1",ot="_pageTitle_gfwoa_6",lt="_pageSubtitle_gfwoa_14",ct="_settingsLayout_gfwoa_20",dt="_sidebar_gfwoa_27",ut="_sidebarIndicator_gfwoa_35",ht="_sidebarItem_gfwoa_50",gt="_active_gfwoa_72",mt="_mainContent_gfwoa_80",pt="_tabContent_gfwoa_85",ft="_settingItem_gfwoa_103",yt="_shortcutContainer_gfwoa_108",vt="_shortcutGroup_gfwoa_115",wt="_shortcutGroupTitle_gfwoa_121",bt="_shortcutGrid_gfwoa_130",Ct="_shortcutCard_gfwoa_136",kt="_controls_gfwoa_170",St="_status_gfwoa_176",u={settingsHeader:it,pageTitle:ot,pageSubtitle:lt,settingsLayout:ct,sidebar:dt,sidebarIndicator:ut,sidebarItem:ht,active:gt,mainContent:mt,tabContent:pt,settingItem:ft,shortcutContainer:yt,shortcutGroup:vt,shortcutGroupTitle:wt,shortcutGrid:bt,shortcutCard:Ct,controls:kt,status:St},Nt="_title_tm30b_11",_t="_signIn_tm30b_18",Tt="_userInfo_tm30b_25",Pt="_warning_tm30b_47",It="_formGroup_tm30b_54",Lt="_label_tm30b_58",xt="_inputWrapper_tm30b_68",Rt="_input_tm30b_68",Dt="_select_tm30b_92",Ot="_actions_tm30b_109",At="_hr_tm30b_117",b={title:Nt,signIn:_t,userInfo:Tt,warning:Pt,formGroup:It,label:Lt,inputWrapper:xt,input:Rt,select:Dt,actions:Ot,hr:At},Mt=()=>{const t=ee(),[s,c]=r(!0),[p,d]=r(!1),[y,S]=r(!1),[h,o]=r(null),[a,g]=r({status:"idle"}),[v,m]=r(!1),[x,l]=r(""),[f,T]=r(!1),I=X(null),[G,P]=r({show:!1,message:"",type:"info"}),w=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},L=pe(N=>{S(N.authenticated),o(N.user||N.device.user||null),g(N.device),m(!!N.hasCustomClientId)},[]),A=pe(async()=>{const N=await k.auth.githubStatus.query();L(N)},[L]),M=async()=>{try{const N=await k.auth.githubPoll.query();g(N),N.status==="success"?(w(),await t.invalidateQueries({queryKey:Z.queryKey}),await A(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):N.status==="error"&&(w(),P({show:!0,message:N.error||"GitHub authentication failed.",type:"error"}))}catch{w(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},i=(N=5)=>{w(),I.current=window.setInterval(M,Math.max(N,5)*1e3)};z(()=>(A().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),w),[A]);const R=async()=>{d(!0);try{const N=await k.auth.githubStart.mutate();g(N),i(N.verification?.interval)}catch(N){P({show:!0,message:N instanceof Error?N.message:"Failed to start GitHub authentication.",type:"error"})}finally{d(!1)}},D=async()=>{try{await k.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:Z.queryKey}),S(!1),o(null),g({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},W=async()=>{T(!0);try{await k.auth.saveGithubAuth.mutate({clientId:x}),l(""),await A(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{T(!1)}},te=async()=>{T(!0);try{await k.auth.saveGithubAuth.mutate({clientId:""}),l(""),await A(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{T(!1)}};return s?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"GitHub Cloud Sync"}),e("p",{className:b.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),y&&h?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:h.name||h.login})]}),e(C,{variant:"danger",onClick:D,children:"Sign Out"})]}):e("div",{className:b.signIn,children:e(C,{onClick:R,disabled:p||a.status==="pending",children:p||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(le,{children:[e("hr",{className:b.hr}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Verification URL"}),e("div",{className:b.inputWrapper,children:[e("input",{className:b.input,value:a.verification.verification_uri,readOnly:!0}),e(C,{onClick:()=>{const N=a.verification?.verification_uri;N&&/^https?:\/\//i.test(N)&&window.open(N,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Device Code"}),e("input",{className:b.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:b.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 ",v?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:x,onChange:N=>l(N.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:b.actions,children:[e(C,{onClick:W,disabled:f,children:"Save override"}),e(C,{variant:"secondary",onClick:te,disabled:f,children:"Use dango defaults"})]})]}),e(K,{isOpen:G.show,onClose:()=>P(N=>({...N,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:G.message})}),e(K.Actions,{children:e(C,{onClick:()=>P(N=>({...N,show:!1})),children:"OK"})})]})]})},Gt=()=>{const[t,s]=r(!0),[c,p]=r(null),[d,y]=r(!1),[S,h]=r(!1),[o,a]=r(""),[g,v]=r(""),[m,x]=r(""),[l,f]=r(!1),[T,I]=r({show:!1,message:"",type:"info"}),G=async()=>{try{const R=await k.auth.user.query();p(R?.email?R:null)}catch{p(null)}},P=async()=>{try{const[i,R]=await Promise.all([k.auth.configStatus.query(),k.auth.googleAuth.query()]);y(!!i.hasConfig),h(!!(R.hasCustomWorkerUrl||R.hasCustomClientId||R.hasClientSecret))}catch(i){console.error("Failed to fetch config status",i)}};z(()=>{(async()=>{s(!0),await Promise.all([G(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await G(),window.history.replaceState(null,"",window.location.pathname))}catch{}s(!1)})();const R=D=>{D.origin===window.location.origin&&typeof D.data=="object"&&D.data!==null&&D.data.type==="GOOGLE_AUTH_SUCCESS"&&(p(D.data.user),window.location.reload())};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[]);const w=async()=>{try{const i=await k.auth.googleLogin.mutate();if(i.authenticated){window.location.reload();return}if(i.url){if(typeof window.DangoBridge<"u"){window.location.href=i.url;return}const D=600,W=700,te=window.innerWidth/2-D/2,N=window.innerHeight/2-W/2;window.open(i.url,"GoogleAuth",`width=${D},height=${W},top=${N},left=${te}`)}else throw new Error("Auth URL not available")}catch{I({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},L=async()=>{try{await k.auth.logout.mutate(),p(null),I({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(i){console.error("Sign out failed",i),I({show:!0,message:"Failed to sign out.",type:"error"})}},A=async()=>{f(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:o,clientId:g,clientSecret:m}),a(""),v(""),x(""),await P(),I({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},M=async()=>{f(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),v(""),x(""),await P(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"Google Drive Sync"}),c?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(C,{variant:"danger",onClick:L,children:"Sign Out"})]}):e("div",{className:b.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(C,{onClick:w,disabled:!d,children:"Sign in with Google"}),!d&&e("p",{className:b.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 ",S?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Worker URL (optional)"}),e("input",{className:b.input,value:o,onChange:i=>a(i.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:g,onChange:i=>v(i.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:b.input,value:m,onChange:i=>x(i.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:b.actions,children:[e(C,{onClick:A,disabled:l,children:"Save override"}),e(C,{variant:"secondary",onClick:M,disabled:l,children:"Use dango defaults"})]})]}),e(K,{isOpen:T.show,onClose:()=>I(i=>({...i,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:T.message})}),e(K.Actions,{children:e(C,{onClick:()=>I(i=>({...i,show:!1})),children:"OK"})})]})]})},qt="_settingItem_3qq0n_1",zt="_modalOverlay_3qq0n_6",Ut="_modal_3qq0n_6",Et="_modalActions_3qq0n_41",Kt="_modalSecondary_3qq0n_47",Ft="_modalPrimary_3qq0n_57",B={settingItem:qt,modalOverlay:zt,modal:Ut,modalActions:Et,modalSecondary:Kt,modalPrimary:Ft},$t={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"]]}},Wt=(t,s)=>{if(t==null)return s;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:s},Ne=(t,s,c)=>{const[p,d]=r(s),[y,S]=r(!1),h=ee();return z(()=>{(async()=>{try{const g=await k.settings.getByKey.query({key:t});d(Wt(g.value,s))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,s]),{value:p,setValue:d,isUpdating:y,toggle:async()=>{if(y)return;S(!0);const a=!p;d(a);try{await k.settings.set.mutate({key:t,value:a});for(const g of c)h.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),d(!a)}finally{S(!1)}}}},Ht=()=>{const{contentType:t}=Fe(),s=$t[t],[c,p]=r(!1),[d,y]=r(!0),[S,h]=r(!1),o=Ne(s.ignoreKey,!0,s.invalidateKeys),a=Ne(s.listOnlyKey,!1,s.invalidateKeys),[g,v]=r(null),[m,x]=r(!1),l=ee(),f=$e();z(()=>{y(!0),(async()=>{try{const L=await k.settings.getByKey.query({key:s.skipKey});String(L.value)==="true"||String(L.value)==="1"?p(!0):p(!1)}catch(L){console.error("Failed to fetch setting",L)}finally{y(!1)}})()},[s.skipKey]);const T=async()=>{if(S)return;h(!0);const w=!c;p(w);try{await k.settings.set.mutate({key:s.skipKey,value:w})}catch(L){console.error("Error saving setting:",L),p(!w)}finally{h(!1)}},I=async()=>{if(!o.isUpdating){if(o.value)try{let w;if(t==="anime"?w=(await k.continueWatching.adultCount.query()).count:t==="manga"?w=(await k.mangaProgress.adultCount.query()).count:t==="asmr"?w=(await k.asmrProgress.adultCount.query()).count:w=(await k.tvProgress.adultCount.query()).count,typeof w=="number"&&w>0){v(w);return}}catch(w){console.error("Failed to fetch adult count",w)}o.toggle()}},G=()=>{v(null),o.toggle()},P=async()=>{if(!m){x(!0);try{let w;t==="anime"?w=(await k.continueWatching.purgeAdult.mutate()).removed:t==="manga"?w=(await k.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?w=(await k.asmrProgress.purgeAdult.mutate()).removed:w=(await k.tvProgress.purgeAdult.mutate()).removed,ke.success(s.purgeDoneText(w??0));for(const L of s.invalidateKeys)l.invalidateQueries({queryKey:L});t==="anime"&&l.invalidateQueries(f.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(f.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(f.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(f.tvProgress.pathFilter())}catch(w){console.error("Failed to purge adult entries",w),ke.error("Failed to remove adult entries")}finally{x(!1),v(null)}o.toggle()}};return d?e("div",{children:"Loading settings..."}):e("div",{className:_.sectionCard,children:[e("h3",{children:s.heading}),e("p",{children:s.blurb}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:s.skipLabel}),e(F,{isChecked:c,onChange:T,id:"skip-confirmation-toggle",disabled:S})]})}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:s.ignoreLabel}),e(F,{isChecked:o.value,onChange:I,id:"ignore-adult-toggle",disabled:o.isUpdating})]})}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:s.listOnlyLabel}),e(F,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),g!==null&&e("div",{className:B.modalOverlay,onClick:()=>v(null),children:e("div",{className:B.modal,onClick:w=>w.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[g," adult ",g===1?"entry":"entries"," not in your"," ",s.listNoun," ",g===1?"is":"are"," currently hidden from"," ",s.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:B.modalActions,children:[e("button",{type:"button",className:B.modalSecondary,onClick:G,disabled:m,children:"Show them"}),e("button",{type:"button",className:B.modalPrimary,onClick:P,disabled:m,children:m?"Purging...":`Purge ${g}`})]})]})})]})},Bt="_statsGrid_o4nf0_1",jt="_statCard_o4nf0_8",Qt="_statLabel_o4nf0_18",Vt="_statValue_o4nf0_26",Yt="_statMeta_o4nf0_32",Jt="_statusBanner_o4nf0_38",Xt="_statusSuccess_o4nf0_49",Zt="_statusUpdating_o4nf0_55",ea="_statusError_o4nf0_61",ta="_sha_o4nf0_67",aa="_settingItem_o4nf0_74",na="_settingTitle_o4nf0_79",ra="_settingSubtitle_o4nf0_85",sa="_actionsRow_o4nf0_92",O={statsGrid:Bt,statCard:jt,statLabel:Qt,statValue:Vt,statMeta:Yt,statusBanner:Jt,statusSuccess:Xt,statusUpdating:Zt,statusError:ea,sha:ta,settingItem:aa,settingTitle:na,settingSubtitle:ra,actionsRow:sa},ia=()=>{const[t,s]=r(null),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r(!1),o=X(null),a=async()=>{try{const l=await k.settings.offlineDbInfo.query();return s(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{p(!1)}return null};z(()=>(a(),()=>{o.current&&window.clearInterval(o.current)}),[]),z(()=>{t?.isRefreshing?o.current||(o.current=window.setInterval(async()=>{const l=await a();l&&!l.isRefreshing&&o.current&&(window.clearInterval(o.current),o.current=null)},2e3)):o.current&&(window.clearInterval(o.current),o.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||d)return;const l=!t.autoUpdateEnabled;y(!0),s({...t,autoUpdateEnabled:l});try{await k.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(f){console.error("Failed to update auto update setting:",f),s({...t,autoUpdateEnabled:!l})}finally{y(!1)}},v=async()=>{if(!(t?.isRefreshing||S)){h(!0);try{await k.settings.triggerOfflineDbUpdate.mutate(),s(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{h(!1)}}},m=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},x=t?.isRefreshing||S;return e("div",{className:_.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:O.statsGrid,children:[e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"MAL Mapped"}),e("span",{className:O.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Release"}),e("span",{className:O.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Last Checked"}),e("span",{className:O.statMeta,children:c?"-":m(t?.lastCheckedAt??null)})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Last Updated"}),e("span",{className:O.statMeta,children:c?"-":m(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${O.statusBanner} ${t.lastStatus==="failed"?O.statusError:t.lastStatus==="updating"?O.statusUpdating:O.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:O.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:O.settingItem,children:e("div",{className:_.settingRow,children:[e("div",{children:[e("span",{className:O.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:O.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(F,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:g,disabled:c||d})]})}),e("div",{className:O.actionsRow,children:e(C,{onClick:v,disabled:c||x,children:x?"Updating Database...":"Update Offline Database Now"})})]})},oa="_status_1wbo0_1",la="_warningText_1wbo0_7",ca="_ackLabel_1wbo0_11",me={status:oa,warningText:la,ackLabel:ca},da=()=>{const t=ee(),[s,c]=r(!1),[p,d]=r(!1),[y,S]=r(!1),[h,o]=r(""),a=()=>{d(!1),o(""),c(!0)},g=()=>{y||(c(!1),d(!1))},v=async()=>{if(!(!p||y)){S(!0),o("");try{const m=await J("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),x=await m.json();if(!m.ok)throw new Error(x.error||"Failed to clear database");const l=x.deleted,f=x.deletedManga,T=x.deletedTv,I=x.deletedAsmr,G=Object.values(l).reduce((A,M)=>A+(M||0),0)+Object.values(f??{}).reduce((A,M)=>A+(M||0),0)+Object.values(T??{}).reduce((A,M)=>A+(M||0),0)+Object.values(I??{}).reduce((A,M)=>A+(M||0),0),P=(f?.manga_library??0)+(f?.manga_progress??0),w=(T?.tv_library??0)+(T?.tv_progress??0),L=(I?.asmr_library??0)+(I?.asmr_progress??0);o(`Library cleared - ${l.watchlist??0} watchlist entries, ${P} manga rows, ${w} TV rows, ${L} ASMR rows and ${G} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(m){o(m.message)}finally{S(!1),d(!1)}}};return e("div",{className:`${_.sectionCard} ${_.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(C,{variant:"danger",onClick:a,children:"Clear Library Data"}),h&&e("p",{className:me.status,children:h}),e(K,{isOpen:s,onClose:g,title:"Clear library data?",width:"sm",children:[e(K.Body,{children:[e("p",{className:me.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:me.ackLabel,children:[e("input",{type:"checkbox",checked:p,onChange:m=>d(m.currentTarget.checked),disabled:y}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(K.Actions,{children:[e(C,{variant:"secondary",onClick:g,disabled:y,children:"Cancel"}),e(C,{variant:"danger",onClick:v,disabled:!p||y,children:y?"Clearing...":"Yes, delete everything"})]})]})]})},ua=()=>{const[t,s]=r(""),[c,p]=r([]),[d,y]=r(null),[S,h]=r(!0),[o,a]=r({show:!1,message:"",type:"info"}),g=async()=>{try{h(!0);const m=await k.auth.rcloneSettings.query();s(m.remote||""),p(m.availableRemotes||[]),y(m.activeRemote||null)}catch(m){console.error("Failed to fetch Rclone settings",m)}finally{h(!1)}};z(()=>{g()},[]);const v=async()=>{try{await k.auth.saveRclone.mutate({remote:t}),a({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),g()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return S?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"Rclone Cloud Sync"}),e("p",{className:b.signIn,children:"Configure which Rclone remote to use for database synchronization."}),d?e("div",{className:b.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:d})]})}):e("p",{className:b.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Remote Name"}),e("div",{className:b.inputWrapper,children:e("select",{className:b.select,value:t,onChange:m=>s(m.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(m=>e("option",{value:m,children:m},m)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:b.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:b.actions,children:e(C,{onClick:v,children:"Save Rclone Settings"})}),e(K,{isOpen:o.show,onClose:()=>a(m=>({...m,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:o.message})}),e(K.Actions,{children:e(C,{onClick:()=>a(m=>({...m,show:!1})),children:"OK"})})]})]})},ha=()=>{const t=ee(),[s,c]=r(null),[p,d]=r(!0),y=async()=>{try{const a=await k.auth.syncSettings.query();c(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{d(!1)}};z(()=>{y()},[]);const S=async a=>{const g=a.currentTarget.value;try{const v=await k.auth.saveSyncProvider.mutate({provider:g});c(m=>m?{...m,activeProvider:v.activeProvider}:null),await y(),await t.invalidateQueries({queryKey:Z.queryKey}),Se.success(`Sync provider updated to ${g==="default"?"Default Order":g}`)}catch{Se.error("Failed to update sync provider")}};if(p||!s)return null;const h=[{value:"default",label:"Default (Priority Based)"}];s.authenticatedProviders.github&&h.push({value:"github",label:"GitHub"}),s.authenticatedProviders.google&&h.push({value:"google",label:"Google Drive"}),s.authenticatedProviders.rclone&&h.push({value:"rclone",label:"Rclone"}),h.push({value:"none",label:"None (Local Only)"});const o=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:_.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:o(s.actualActiveProvider)})]}),e("div",{className:_.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:s.activeProvider,onChange:S,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:h.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function ga(){return"javascript:"+encodeURIComponent(`(function(){
|
|
1
|
+
import{d as r,u as e,S as de,A as X,h as M,q as fe,T as Ke,p as Fe,g as ke,_ as $e}from"./vendor-core-DfaOB3Rn.js";import{b as ye,u as ee}from"./vendor-query-BBT5_sHx.js";import{U as Z,V as Q,W as E,X as Se,B as C,Y as We,S as K,e as He,O as Ie,t as k,x as Be,v as je,N as Ne,Z as J,q as H,_ as _e,$ as Qe,a0 as Ve,a as Ye,h as Je,a1 as Xe,u as ce,p as Ze,a2 as et,a3 as tt}from"./index-CaTGvWwZ.js";import{I as j}from"./vendor-icons-C1Pj_eSX.js";import{T as F}from"./ToggleSwitch-CN_ppEc9.js";import{l as at,s as nt}from"./playbackCompletion-Cv5b1X7P.js";import{M as rt}from"./MatureConsentModal-CJcnA2Uj.js";const st="_sectionCard_1vuib_1",it="_dangerCard_1vuib_20",ot="_settingRow_1vuib_31",_={sectionCard:st,dangerCard:it,settingRow:ot};function lt(){const{data:t}=ye(Z),{data:s}=ye({queryKey:["profiles"],queryFn:()=>Q("/api/profiles/status"),enabled:!!t?.owner}),c=ee(),[p,d]=r(null),[y,S]=r(""),[h,o]=r(""),[n,g]=r(""),[v,m]=r(""),[x,l]=r(""),[f,T]=r(!1),[I,z]=r(null),[P,w]=r(null),[L,A]=r(""),G=async i=>{T(!0),l("");try{await Q("/api/profiles/update",{method:"POST",body:JSON.stringify(i)}),await c.invalidateQueries({queryKey:Z.queryKey}),S(""),o(""),l("Profile saved")}catch(R){l(R.message)}finally{T(!1)}};return t?e("section",{className:_.sectionCard,children:[e("h3",{children:"Your profile"}),e("p",{children:"Keep using this profile, rename it, or add another person with their own library and connections."}),e("div",{className:E.avatarRow,children:[e(Se,{image:t.image,name:t.name}),e("label",{className:E.uploadButton,children:[e(j,{name:"upload"}),e("span",{children:"Upload image"}),e("input",{className:E.fileInput,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:f,onChange:async i=>{const R=i.currentTarget.files?.[0];if(i.currentTarget.value="",!R)return;if(R.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const D=new FileReader;D.onerror=()=>l("Could not read image"),D.onload=()=>{G({avatar:D.result})},D.readAsDataURL(R)}})]}),t.avatar&&e(C,{variant:"secondary",disabled:f,onClick:()=>G({avatar:null}),children:"Clear uploaded image"})]}),e("p",{children:"Your uploaded image takes priority, followed by your active cloud account image, then the default user icon."}),e("form",{className:E.form,onSubmit:i=>{i.preventDefault(),G({name:p??t.name})},children:[e("label",{className:E.field,children:["Profile name",e("input",{value:p??t.name,maxLength:60,required:!0,onChange:i=>d(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f,children:"Save name"})]}),e("form",{className:E.form,onSubmit:i=>{i.preventDefault(),G({password:y,currentPassword:h})},children:[t.protected&&e("label",{className:E.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:h,required:!0,maxLength:256,onChange:i=>o(i.currentTarget.value)})]}),e("label",{className:E.field,children:[t.protected?"New password (empty removes protection)":"Protect this profile",e("input",{type:"password",autoComplete:"new-password",value:y,minLength:8,maxLength:256,onChange:i=>S(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f,children:"Save password"})]}),e(C,{variant:"secondary",disabled:f,onClick:async()=>{T(!0);try{await Q("/api/profiles/logout",{method:"POST"}),We()}catch(i){l(i.message),T(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:E.form,onSubmit:async i=>{i.preventDefault(),T(!0),l("");try{await Q("/api/profiles/create",{method:"POST",body:JSON.stringify({name:n,password:v})}),g(""),m(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(R){l(R.message)}finally{T(!1)}},children:[e("h3",{children:"Add another profile"}),e("p",{children:"Protect your owner profile first. New profiles start empty and do not inherit your accounts. A profile without a password is accessible to anyone who passes the LAN lock."}),e("label",{className:E.field,children:["Name",e("input",{required:!0,maxLength:60,value:n,onChange:i=>g(i.currentTarget.value)})]}),e("label",{className:E.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:v,onChange:i=>m(i.currentTarget.value)})]}),e(C,{type:"submit",disabled:f||!t.protected,children:"Create profile"})]}),t.owner&&s?.profiles.some(i=>!i.owner)&&e(de,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:E.profileList,children:s.profiles.filter(i=>!i.owner).map(i=>e("li",{children:[e("span",{className:E.smallAvatar,children:e(Se,{image:i.avatar??i.cloudAvatar,name:i.name})}),e("span",{className:E.profileName,children:i.name}),e(C,{variant:"secondary",size:"sm",disabled:f,onClick:()=>{l(""),A(""),w(i)},children:"Reset password"}),e(C,{variant:"danger",size:"sm",disabled:f,onClick:()=>{l(""),z(i)},children:"Delete"})]},i.id))})]}),e(K,{isOpen:!!P,onClose:f?void 0:()=>w(null),title:"Reset password",width:"sm",footer:e(de,{children:[e(C,{variant:"secondary",disabled:f,onClick:()=>w(null),children:"Cancel"}),e(C,{loading:f,onClick:async()=>{if(P){T(!0),l("");try{await Q("/api/profiles/reset-password",{method:"POST",body:JSON.stringify({id:P.id,password:L})}),await c.invalidateQueries({queryKey:["profiles"]}),w(null),A(""),l("Password updated. The profile has been signed out.")}catch(i){l(i.message)}finally{T(!1)}}},children:"Save password"})]}),children:[e("p",{children:["Set a new password for ",e("strong",{children:P?.name}),". They will be signed out and must use the new password next time."]}),e("label",{className:E.field,children:["New password",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,placeholder:"Leave empty to remove their password",value:L,onChange:i=>A(i.currentTarget.value)})]})]}),e(K,{isOpen:!!I,onClose:f?void 0:()=>z(null),title:"Delete profile?",width:"sm",footer:e(de,{children:[e(C,{variant:"secondary",disabled:f,onClick:()=>z(null),children:"Cancel"}),e(C,{variant:"danger",loading:f,onClick:async()=>{if(I){T(!0);try{await Q("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:I.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),z(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(i){l(i.message),z(null)}finally{T(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:I?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),x&&e("p",{role:"status",children:x})]}):null}const he={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ge=["name","nativeName","englishName"],me={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},ct=()=>{const{titlePreference:t,setTitlePreference:s,loading:c}=He(),p=Ie(),[d,y]=r(me[t]),[S,h]=r(!1),o=X(null);M(()=>{c||y(me[t])},[t,c]);const n=async()=>{if(S)return;h(!0);const v=(ge.indexOf(t)+1)%ge.length,m=ge[v],x=me[m];o.current&&(o.current.style.transform="translateX(-100%)",o.current.style.opacity="0"),setTimeout(async()=>{y(x),s(m),o.current&&(o.current.style.transition="none",o.current.style.transform="translateX(100%)",o.current.style.opacity="0",o.current.offsetWidth,o.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",o.current.style.transform="translateX(0)",o.current.style.opacity="1");try{await p.mutateAsync({key:"titlePreference",value:m})}catch(l){console.error("Error saving title preference:",l)}finally{h(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:he["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:n,className:he["toggle-button"],disabled:S,children:e("span",{ref:o,className:he["toggle-label"],children:d})})]})},dt="_settingsHeader_gfwoa_1",ut="_pageTitle_gfwoa_6",ht="_pageSubtitle_gfwoa_14",gt="_settingsLayout_gfwoa_20",mt="_sidebar_gfwoa_27",pt="_sidebarIndicator_gfwoa_35",ft="_sidebarItem_gfwoa_50",yt="_active_gfwoa_72",vt="_mainContent_gfwoa_80",wt="_tabContent_gfwoa_85",bt="_settingItem_gfwoa_103",Ct="_shortcutContainer_gfwoa_108",kt="_shortcutGroup_gfwoa_115",St="_shortcutGroupTitle_gfwoa_121",Nt="_shortcutGrid_gfwoa_130",_t="_shortcutCard_gfwoa_136",Tt="_controls_gfwoa_170",Pt="_status_gfwoa_176",u={settingsHeader:dt,pageTitle:ut,pageSubtitle:ht,settingsLayout:gt,sidebar:mt,sidebarIndicator:pt,sidebarItem:ft,active:yt,mainContent:vt,tabContent:wt,settingItem:bt,shortcutContainer:Ct,shortcutGroup:kt,shortcutGroupTitle:St,shortcutGrid:Nt,shortcutCard:_t,controls:Tt,status:Pt},It="_title_tm30b_11",Lt="_signIn_tm30b_18",xt="_userInfo_tm30b_25",Rt="_warning_tm30b_47",Dt="_formGroup_tm30b_54",Ot="_label_tm30b_58",At="_inputWrapper_tm30b_68",Gt="_input_tm30b_68",Mt="_select_tm30b_92",zt="_actions_tm30b_109",qt="_hr_tm30b_117",b={title:It,signIn:Lt,userInfo:xt,warning:Rt,formGroup:Dt,label:Ot,inputWrapper:At,input:Gt,select:Mt,actions:zt,hr:qt},Et=()=>{const t=ee(),[s,c]=r(!0),[p,d]=r(!1),[y,S]=r(!1),[h,o]=r(null),[n,g]=r({status:"idle"}),[v,m]=r(!1),[x,l]=r(""),[f,T]=r(!1),I=X(null),[z,P]=r({show:!1,message:"",type:"info"}),w=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},L=fe(N=>{S(N.authenticated),o(N.user||N.device.user||null),g(N.device),m(!!N.hasCustomClientId)},[]),A=fe(async()=>{const N=await k.auth.githubStatus.query();L(N)},[L]),G=async()=>{try{const N=await k.auth.githubPoll.query();g(N),N.status==="success"?(w(),await t.invalidateQueries({queryKey:Z.queryKey}),await A(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):N.status==="error"&&(w(),P({show:!0,message:N.error||"GitHub authentication failed.",type:"error"}))}catch{w(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},i=(N=5)=>{w(),I.current=window.setInterval(G,Math.max(N,5)*1e3)};M(()=>(A().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),w),[A]);const R=async()=>{d(!0);try{const N=await k.auth.githubStart.mutate();g(N),i(N.verification?.interval)}catch(N){P({show:!0,message:N instanceof Error?N.message:"Failed to start GitHub authentication.",type:"error"})}finally{d(!1)}},D=async()=>{try{await k.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:Z.queryKey}),S(!1),o(null),g({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},W=async()=>{T(!0);try{await k.auth.saveGithubAuth.mutate({clientId:x}),l(""),await A(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{T(!1)}},te=async()=>{T(!0);try{await k.auth.saveGithubAuth.mutate({clientId:""}),l(""),await A(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{T(!1)}};return s?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"GitHub Cloud Sync"}),e("p",{className:b.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),y&&h?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:h.name||h.login})]}),e(C,{variant:"danger",onClick:D,children:"Sign Out"})]}):e("div",{className:b.signIn,children:e(C,{onClick:R,disabled:p||n.status==="pending",children:p||n.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),n.status==="pending"&&n.verification&&e(de,{children:[e("hr",{className:b.hr}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Verification URL"}),e("div",{className:b.inputWrapper,children:[e("input",{className:b.input,value:n.verification.verification_uri,readOnly:!0}),e(C,{onClick:()=>{const N=n.verification?.verification_uri;N&&/^https?:\/\//i.test(N)&&window.open(N,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Device Code"}),e("input",{className:b.input,value:n.verification.user_code,readOnly:!0})]})]}),n.status==="error"&&e("p",{className:b.warning,children:n.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 ",v?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:x,onChange:N=>l(N.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:b.actions,children:[e(C,{onClick:W,disabled:f,children:"Save override"}),e(C,{variant:"secondary",onClick:te,disabled:f,children:"Use dango defaults"})]})]}),e(K,{isOpen:z.show,onClose:()=>P(N=>({...N,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:z.message})}),e(K.Actions,{children:e(C,{onClick:()=>P(N=>({...N,show:!1})),children:"OK"})})]})]})},Ut=()=>{const[t,s]=r(!0),[c,p]=r(null),[d,y]=r(!1),[S,h]=r(!1),[o,n]=r(""),[g,v]=r(""),[m,x]=r(""),[l,f]=r(!1),[T,I]=r({show:!1,message:"",type:"info"}),z=async()=>{try{const R=await k.auth.user.query();p(R?.email?R:null)}catch{p(null)}},P=async()=>{try{const[i,R]=await Promise.all([k.auth.configStatus.query(),k.auth.googleAuth.query()]);y(!!i.hasConfig),h(!!(R.hasCustomWorkerUrl||R.hasCustomClientId||R.hasClientSecret))}catch(i){console.error("Failed to fetch config status",i)}};M(()=>{(async()=>{s(!0),await Promise.all([z(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await z(),window.history.replaceState(null,"",window.location.pathname))}catch{}s(!1)})();const R=D=>{D.origin===window.location.origin&&typeof D.data=="object"&&D.data!==null&&D.data.type==="GOOGLE_AUTH_SUCCESS"&&(p(D.data.user),window.location.reload())};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[]);const w=async()=>{try{const i=await k.auth.googleLogin.mutate();if(i.authenticated){window.location.reload();return}if(i.url){if(typeof window.DangoBridge<"u"){window.location.href=i.url;return}const D=600,W=700,te=window.innerWidth/2-D/2,N=window.innerHeight/2-W/2;window.open(i.url,"GoogleAuth",`width=${D},height=${W},top=${N},left=${te}`)}else throw new Error("Auth URL not available")}catch{I({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},L=async()=>{try{await k.auth.logout.mutate(),p(null),I({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(i){console.error("Sign out failed",i),I({show:!0,message:"Failed to sign out.",type:"error"})}},A=async()=>{f(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:o,clientId:g,clientSecret:m}),n(""),v(""),x(""),await P(),I({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},G=async()=>{f(!0);try{await k.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),n(""),v(""),x(""),await P(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"Google Drive Sync"}),c?e("div",{className:b.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(C,{variant:"danger",onClick:L,children:"Sign Out"})]}):e("div",{className:b.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(C,{onClick:w,disabled:!d,children:"Sign in with Google"}),!d&&e("p",{className:b.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 ",S?"(override active)":""]}),e("div",{className:b.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:b.label,children:"Worker URL (optional)"}),e("input",{className:b.input,value:o,onChange:i=>n(i.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client ID (optional)"}),e("input",{className:b.input,value:g,onChange:i=>v(i.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:b.input,value:m,onChange:i=>x(i.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:b.actions,children:[e(C,{onClick:A,disabled:l,children:"Save override"}),e(C,{variant:"secondary",onClick:G,disabled:l,children:"Use dango defaults"})]})]}),e(K,{isOpen:T.show,onClose:()=>I(i=>({...i,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:T.message})}),e(K.Actions,{children:e(C,{onClick:()=>I(i=>({...i,show:!1})),children:"OK"})})]})]})},Kt="_settingItem_3qq0n_1",Ft="_modalOverlay_3qq0n_6",$t="_modal_3qq0n_6",Wt="_modalActions_3qq0n_41",Ht="_modalSecondary_3qq0n_47",Bt="_modalPrimary_3qq0n_57",B={settingItem:Kt,modalOverlay:Ft,modal:$t,modalActions:Wt,modalSecondary:Ht,modalPrimary:Bt},jt={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"]]}},Qt=(t,s)=>{if(t==null)return s;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:s},Te=(t,s,c)=>{const[p,d]=r(s),[y,S]=r(!1),h=ee();return M(()=>{(async()=>{try{const g=await k.settings.getByKey.query({key:t});d(Qt(g.value,s))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,s]),{value:p,setValue:d,isUpdating:y,toggle:async()=>{if(y)return;S(!0);const n=!p;d(n);try{await k.settings.set.mutate({key:t,value:n});for(const g of c)h.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),d(!n)}finally{S(!1)}}}},Vt=()=>{const{contentType:t}=Be(),s=jt[t],[c,p]=r(!1),[d,y]=r(!0),[S,h]=r(!1),o=Te(s.ignoreKey,!0,s.invalidateKeys),n=Te(s.listOnlyKey,!1,s.invalidateKeys),[g,v]=r(null),[m,x]=r(!1),l=ee(),f=je();M(()=>{y(!0),(async()=>{try{const L=await k.settings.getByKey.query({key:s.skipKey});String(L.value)==="true"||String(L.value)==="1"?p(!0):p(!1)}catch(L){console.error("Failed to fetch setting",L)}finally{y(!1)}})()},[s.skipKey]);const T=async()=>{if(S)return;h(!0);const w=!c;p(w);try{await k.settings.set.mutate({key:s.skipKey,value:w})}catch(L){console.error("Error saving setting:",L),p(!w)}finally{h(!1)}},I=async()=>{if(!o.isUpdating){if(o.value)try{let w;if(t==="anime"?w=(await k.continueWatching.adultCount.query()).count:t==="manga"?w=(await k.mangaProgress.adultCount.query()).count:t==="asmr"?w=(await k.asmrProgress.adultCount.query()).count:w=(await k.tvProgress.adultCount.query()).count,typeof w=="number"&&w>0){v(w);return}}catch(w){console.error("Failed to fetch adult count",w)}o.toggle()}},z=()=>{v(null),o.toggle()},P=async()=>{if(!m){x(!0);try{let w;t==="anime"?w=(await k.continueWatching.purgeAdult.mutate()).removed:t==="manga"?w=(await k.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?w=(await k.asmrProgress.purgeAdult.mutate()).removed:w=(await k.tvProgress.purgeAdult.mutate()).removed,Ne.success(s.purgeDoneText(w??0));for(const L of s.invalidateKeys)l.invalidateQueries({queryKey:L});t==="anime"&&l.invalidateQueries(f.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(f.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(f.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(f.tvProgress.pathFilter())}catch(w){console.error("Failed to purge adult entries",w),Ne.error("Failed to remove adult entries")}finally{x(!1),v(null)}o.toggle()}};return d?e("div",{children:"Loading settings..."}):e("div",{className:_.sectionCard,children:[e("h3",{children:s.heading}),e("p",{children:s.blurb}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:s.skipLabel}),e(F,{isChecked:c,onChange:T,id:"skip-confirmation-toggle",disabled:S})]})}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:s.ignoreLabel}),e(F,{isChecked:o.value,onChange:I,id:"ignore-adult-toggle",disabled:o.isUpdating})]})}),e("div",{className:B.settingItem,children:e("div",{className:_.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:s.listOnlyLabel}),e(F,{isChecked:n.value,onChange:n.toggle,id:"cw-watchlist-only-toggle",disabled:n.isUpdating})]})}),g!==null&&e("div",{className:B.modalOverlay,onClick:()=>v(null),children:e("div",{className:B.modal,onClick:w=>w.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[g," adult ",g===1?"entry":"entries"," not in your"," ",s.listNoun," ",g===1?"is":"are"," currently hidden from"," ",s.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:B.modalActions,children:[e("button",{type:"button",className:B.modalSecondary,onClick:z,disabled:m,children:"Show them"}),e("button",{type:"button",className:B.modalPrimary,onClick:P,disabled:m,children:m?"Purging...":`Purge ${g}`})]})]})})]})},Yt="_statsGrid_o4nf0_1",Jt="_statCard_o4nf0_8",Xt="_statLabel_o4nf0_18",Zt="_statValue_o4nf0_26",ea="_statMeta_o4nf0_32",ta="_statusBanner_o4nf0_38",aa="_statusSuccess_o4nf0_49",na="_statusUpdating_o4nf0_55",ra="_statusError_o4nf0_61",sa="_sha_o4nf0_67",ia="_settingItem_o4nf0_74",oa="_settingTitle_o4nf0_79",la="_settingSubtitle_o4nf0_85",ca="_actionsRow_o4nf0_92",O={statsGrid:Yt,statCard:Jt,statLabel:Xt,statValue:Zt,statMeta:ea,statusBanner:ta,statusSuccess:aa,statusUpdating:na,statusError:ra,sha:sa,settingItem:ia,settingTitle:oa,settingSubtitle:la,actionsRow:ca},da=()=>{const[t,s]=r(null),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r(!1),o=X(null),n=async()=>{try{const l=await k.settings.offlineDbInfo.query();return s(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{p(!1)}return null};M(()=>(n(),()=>{o.current&&window.clearInterval(o.current)}),[]),M(()=>{t?.isRefreshing?o.current||(o.current=window.setInterval(async()=>{const l=await n();l&&!l.isRefreshing&&o.current&&(window.clearInterval(o.current),o.current=null)},2e3)):o.current&&(window.clearInterval(o.current),o.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||d)return;const l=!t.autoUpdateEnabled;y(!0),s({...t,autoUpdateEnabled:l});try{await k.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(f){console.error("Failed to update auto update setting:",f),s({...t,autoUpdateEnabled:!l})}finally{y(!1)}},v=async()=>{if(!(t?.isRefreshing||S)){h(!0);try{await k.settings.triggerOfflineDbUpdate.mutate(),s(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{h(!1)}}},m=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},x=t?.isRefreshing||S;return e("div",{className:_.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:O.statsGrid,children:[e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"MAL Mapped"}),e("span",{className:O.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Release"}),e("span",{className:O.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Last Checked"}),e("span",{className:O.statMeta,children:c?"-":m(t?.lastCheckedAt??null)})]}),e("div",{className:O.statCard,children:[e("span",{className:O.statLabel,children:"Last Updated"}),e("span",{className:O.statMeta,children:c?"-":m(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${O.statusBanner} ${t.lastStatus==="failed"?O.statusError:t.lastStatus==="updating"?O.statusUpdating:O.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:O.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:O.settingItem,children:e("div",{className:_.settingRow,children:[e("div",{children:[e("span",{className:O.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:O.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(F,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:g,disabled:c||d})]})}),e("div",{className:O.actionsRow,children:e(C,{onClick:v,disabled:c||x,children:x?"Updating Database...":"Update Offline Database Now"})})]})},ua="_status_1wbo0_1",ha="_warningText_1wbo0_7",ga="_ackLabel_1wbo0_11",pe={status:ua,warningText:ha,ackLabel:ga},ma=()=>{const t=ee(),[s,c]=r(!1),[p,d]=r(!1),[y,S]=r(!1),[h,o]=r(""),n=()=>{d(!1),o(""),c(!0)},g=()=>{y||(c(!1),d(!1))},v=async()=>{if(!(!p||y)){S(!0),o("");try{const m=await J("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),x=await m.json();if(!m.ok)throw new Error(x.error||"Failed to clear database");const l=x.deleted,f=x.deletedManga,T=x.deletedTv,I=x.deletedAsmr,z=Object.values(l).reduce((A,G)=>A+(G||0),0)+Object.values(f??{}).reduce((A,G)=>A+(G||0),0)+Object.values(T??{}).reduce((A,G)=>A+(G||0),0)+Object.values(I??{}).reduce((A,G)=>A+(G||0),0),P=(f?.manga_library??0)+(f?.manga_progress??0),w=(T?.tv_library??0)+(T?.tv_progress??0),L=(I?.asmr_library??0)+(I?.asmr_progress??0);o(`Library cleared - ${l.watchlist??0} watchlist entries, ${P} manga rows, ${w} TV rows, ${L} ASMR rows and ${z} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(m){o(m.message)}finally{S(!1),d(!1)}}};return e("div",{className:`${_.sectionCard} ${_.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(C,{variant:"danger",onClick:n,children:"Clear Library Data"}),h&&e("p",{className:pe.status,children:h}),e(K,{isOpen:s,onClose:g,title:"Clear library data?",width:"sm",children:[e(K.Body,{children:[e("p",{className:pe.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:pe.ackLabel,children:[e("input",{type:"checkbox",checked:p,onChange:m=>d(m.currentTarget.checked),disabled:y}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(K.Actions,{children:[e(C,{variant:"secondary",onClick:g,disabled:y,children:"Cancel"}),e(C,{variant:"danger",onClick:v,disabled:!p||y,children:y?"Clearing...":"Yes, delete everything"})]})]})]})},pa=()=>{const[t,s]=r(""),[c,p]=r([]),[d,y]=r(null),[S,h]=r(!0),[o,n]=r({show:!1,message:"",type:"info"}),g=async()=>{try{h(!0);const m=await k.auth.rcloneSettings.query();s(m.remote||""),p(m.availableRemotes||[]),y(m.activeRemote||null)}catch(m){console.error("Failed to fetch Rclone settings",m)}finally{h(!1)}};M(()=>{g()},[]);const v=async()=>{try{await k.auth.saveRclone.mutate({remote:t}),n({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),g()}catch{n({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return S?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:_.sectionCard,children:[e("h3",{className:b.title,children:"Rclone Cloud Sync"}),e("p",{className:b.signIn,children:"Configure which Rclone remote to use for database synchronization."}),d?e("div",{className:b.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:d})]})}):e("p",{className:b.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:b.formGroup,children:[e("label",{className:b.label,children:"Remote Name"}),e("div",{className:b.inputWrapper,children:e("select",{className:b.select,value:t,onChange:m=>s(m.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(m=>e("option",{value:m,children:m},m)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:b.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:b.actions,children:e(C,{onClick:v,children:"Save Rclone Settings"})}),e(K,{isOpen:o.show,onClose:()=>n(m=>({...m,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:o.message})}),e(K.Actions,{children:e(C,{onClick:()=>n(m=>({...m,show:!1})),children:"OK"})})]})]})},fa=()=>{const t=ee(),[s,c]=r(null),[p,d]=r(!0),y=async()=>{try{const n=await k.auth.syncSettings.query();c(n)}catch(n){console.error("Failed to fetch sync settings",n)}finally{d(!1)}};M(()=>{y()},[]);const S=async n=>{const g=n.currentTarget.value;try{const v=await k.auth.saveSyncProvider.mutate({provider:g});c(m=>m?{...m,activeProvider:v.activeProvider}:null),await y(),await t.invalidateQueries({queryKey:Z.queryKey}),_e.success(`Sync provider updated to ${g==="default"?"Default Order":g}`)}catch{_e.error("Failed to update sync provider")}};if(p||!s)return null;const h=[{value:"default",label:"Default (Priority Based)"}];s.authenticatedProviders.github&&h.push({value:"github",label:"GitHub"}),s.authenticatedProviders.google&&h.push({value:"google",label:"Google Drive"}),s.authenticatedProviders.rclone&&h.push({value:"rclone",label:"Rclone"}),h.push({value:"none",label:"None (Local Only)"});const o=n=>n==="none"?"Local Only (No Sync)":n==="google"?"Google Drive":n==="github"?"GitHub":n==="rclone"?"Rclone":n;return e("div",{className:_.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:o(s.actualActiveProvider)})]}),e("div",{className:_.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:s.activeProvider,onChange:S,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:h.map(n=>e("option",{value:n.value,children:n.label},n.value))})]})]})};function ya(){return"javascript:"+encodeURIComponent(`(function(){
|
|
2
2
|
if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
|
|
3
3
|
var t=null;
|
|
4
4
|
try{
|
|
@@ -18,4 +18,4 @@ if(!t){alert('Dango: could not grab your token. Make sure you are logged in to D
|
|
|
18
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
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
20
|
if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t).then(done,function(){copyFallback();done()})}else{copyFallback();done()}
|
|
21
|
-
})()`)}const ma=()=>{const t=qe(ga,[]);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:p=>{p.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(j,{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(C,{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.`})]})},pa="_settingItem_68mz3_1",fa="_field_68mz3_6",ya="_input_68mz3_19",va="_actions_68mz3_39",wa="_status_68mz3_45",q={settingItem:pa,field:fa,input:ya,actions:va,status:wa},ba=()=>{const[t,s]=r(!1),[c,p]=r(""),[d,y]=r(""),[S,h]=r(!0),[o,a]=r(!1),[g,v]=r("");z(()=>{(async()=>{try{const I=await(await J("/api/auth/app-status")).json();s(I.hasPassword)}catch{console.error("Failed to fetch LAN auth status")}finally{h(!1)}})()},[]);const m=async()=>{if(v(""),c!==d){v("Passwords do not match");return}if(c.length<4){v("Password must be at least 4 characters");return}a(!0);try{const f=await J("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:c})}),T=await f.json();if(!f.ok){v(T.error||"Failed to update password");return}s(T.hasPassword),p(""),y(""),v(T.hasPassword?"Password set successfully":"Password removed")}catch{v("Network error")}finally{a(!1)}},x=async()=>{a(!0);try{const f=await J("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:""})}),T=await f.json();if(!f.ok){v(T.error||"Failed to remove password");return}s(!1),p(""),y(""),v("Password removed")}catch{v("Network error")}finally{a(!1)}},l=async()=>{a(!0);try{await J("/api/auth/app-logout",{method:"POST"}),v("Logged out"),window.location.reload()}catch{v("Logout failed")}finally{a(!1)}};return S?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.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:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"lan-password",children:"New Password"}),e("input",{id:"lan-password",type:"password",value:c,onChange:f=>p(f.currentTarget.value),placeholder:t?"Leave empty to keep current password":"Enter a password...",className:q.input})]}),e("div",{className:q.field,children:[e("label",{htmlFor:"lan-confirm-password",children:"Confirm Password"}),e("input",{id:"lan-confirm-password",type:"password",value:d,onChange:f=>y(f.currentTarget.value),placeholder:"Confirm password...",className:q.input})]}),e("div",{className:q.actions,children:[e(C,{variant:"primary",onClick:m,loading:o,disabled:o,children:t?"Update Password":"Set Password"}),t&&e(C,{variant:"danger",onClick:l,loading:o,disabled:o,children:"Logout"}),t&&e(C,{variant:"secondary",onClick:x,loading:o,disabled:o,children:"Remove Password"})]}),g&&e("p",{className:q.status,children:g})]})]})},Ca=()=>{const[t,s]=r(""),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r("");z(()=>{Q("/api/auth/app-status").then(a=>s(String(a.port??3e3))).catch(()=>h("Failed to load current port")).finally(()=>p(!1))},[]);const o=async()=>{const a=Number(t);if(!Number.isInteger(a)||a<1||a>65535){h("Enter a port between 1 and 65535");return}y(!0),h("");try{await k.auth.setServerPort.mutate({port:a}),h(`Saved. Restart dango, then open http://localhost:${a} - this overrides the PORT environment variable.`)}catch(g){h(g.message)}finally{y(!1)}};return c?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.sectionCard,children:[e("h3",{children:"Server Port"}),e("p",{children:"Port the backend listens on. Takes effect after a restart. Google and AniList sign-in need the matching redirect URI registered with the provider."}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"server-port",children:"Port"}),e("input",{id:"server-port",type:"number",min:1,max:65535,value:t,onChange:a=>s(a.currentTarget.value),className:q.input})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:o,loading:d,disabled:d,children:"Save Port"})}),S&&e("p",{className:q.status,children:S})]})]})},ka=()=>{const[t,s]=r(""),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r("");z(()=>{k.auth.allowedOrigins.query().then(a=>s(a.origins.join(", "))).catch(()=>h("Failed to load allowed origins")).finally(()=>p(!1))},[]);const o=async()=>{y(!0),h("");try{const a=await k.auth.setAllowedOrigins.mutate({origins:t});s(a.origins.join(", ")),h("Saved.")}catch(a){h(a.message)}finally{y(!1)}};return c?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.sectionCard,children:[e("h3",{children:"Allowed Origins"}),e("p",{children:["Extra browser origins allowed to call the API, comma-separated. Include the scheme (e.g."," ",e("code",{children:"https://example.com"}),"). Same-origin access and reverse proxies that forward X-Forwarded-Host/X-Forwarded-Proto work automatically."]}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"allowed-origins",children:"Origins"}),e("input",{id:"allowed-origins",value:t,onChange:a=>s(a.currentTarget.value),className:q.input,placeholder:"https://example.com"})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:o,loading:d,disabled:d,children:"Save Origins"})}),S&&e("p",{className:q.status,children:S})]})]})},Sa=()=>{const{theme:t,setTheme:s,loading:c}=We();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:He.map(p=>{const d=t===p.id;return e("button",{role:"radio","aria-checked":d,disabled:c,onClick:()=>s(p.id),style:{display:"flex",gap:"0.6rem",alignItems:"center",textAlign:"left",padding:"0.65rem 0.75rem",borderRadius:"10px",cursor:"pointer",background:d?"var(--accent-subtle)":"var(--bg-tertiary)",border:d?"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:p.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:p.label}),e("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.blurb})]})]},p.id)})})]})};function Na({variant:t="info",children:s,className:c=""}){return e("div",{className:`alert alert-${t} ${c}`,children:s})}const _a=["profile","appearance","presence","server","sync","watchlist"],Ta={general:"profile",database:"sync"},_e=t=>t?_a.includes(t)?t:Ta[t]??null:null,Aa=()=>{const{data:t}=fe(Z),[s,c]=ze(),p=_e(s.get("tab")),[d,y]=r(p??"profile"),[S,h]=r(""),o=X(null),a=X(null),g=X(new Map),[v,m]=r({top:0,height:0,left:0,width:0}),{lowEndMode:x,setLowEndMode:l}=Be(),{hasConsent:f,grant:T,revoke:I}=je(),[G,P]=r(!1),[w,L]=r(Qe),[A,M]=r(Xe),[i,R]=r(!0),{data:D}=de("discordRPCEnabled"),W=Te(),[te,N]=r(!1),{data:ie}=de("frozenMode"),[Pe,ye]=r(!0),{data:ae}=de("discordRPCHideMature"),[ve,oe]=r(""),[ne,ce]=r(null);z(()=>{t?.owner&&k.discord.gatewayStatus.query().then(n=>{ce(n),n.masked&&n.masked!=="none"&&oe(n.masked)}).catch(()=>{})},[t?.owner]),z(()=>{D!==void 0&&R(D==="true"||D===!0||D===null)},[D]),z(()=>{ae!==void 0&&ye(ae==="true"||ae===!0||ae===null)},[ae]);const Ie=n=>{R(n),W.mutate({key:"discordRPCEnabled",value:String(n)})};z(()=>{ie!==void 0&&N(ie==="true"||ie===!0)},[ie]);const Le=n=>{N(n),W.mutate({key:"frozenMode",value:String(n)})},xe=n=>{ye(n),W.mutate({key:"discordRPCHideMature",value:String(n)})},Re=n=>{L(n),Ve.setItem(Ye,String(n)),window.dispatchEvent(new CustomEvent(Je))},De=n=>{M(n),Ze(n)};be.useEffect(()=>{document.title="Settings - dango"},[]),be.useEffect(()=>{const n=_e(s.get("tab"));n&&y(n)},[s]);const V=n=>{y(n),c(n==="profile"?{}:{tab:n})},re=pe(()=>{const n=g.current.get(d),E=a.current;if(n&&E){const Y=E.getBoundingClientRect(),$=n.getBoundingClientRect(),se=window.matchMedia("(max-width: 900px)").matches;m(se?{top:$.top-Y.top,height:$.height,left:$.left-Y.left,width:$.width}:{top:$.top-Y.top,height:$.height,left:0,width:0})}},[d]);Ue(()=>{re()},[d,re]),z(()=>{const n=()=>re();window.addEventListener("resize",n);let E=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{E||re()}),()=>{E=!0,window.removeEventListener("resize",n)}},[d,re]);const Oe=()=>{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 E=document.createElement("a");E.href="/api/backup-db",E.download="dango-backup.json",document.body.appendChild(E),E.click(),E.remove(),setTimeout(()=>{h("Databases exported successfully!")},1500)},Ae=async n=>{const E=n.currentTarget.files?.[0];if(!E)return;h("Importing databases...");const Y=new FormData;Y.append("dbfile",E);try{const $=await J("/api/restore-db",{method:"POST",body:Y}),se=await $.json();if($.ok){const we=Array.isArray(se.restored)?se.restored.join(", "):null;h(we?`Databases imported successfully (${we})!`:"Database imported successfully!"),setTimeout(()=>window.location.reload(),2e3)}else h(`Import failed: ${se.error}`)}catch{h("Import failed: An unexpected error occurred.")}finally{n.currentTarget.value=""}},Me=()=>{o.current?.click()},Ge=()=>{switch(d){case"profile":return e("div",{className:u.tabContent,children:[e(rt,{}),e("div",{className:_.sectionCard,children:[e("h3",{children:"Mature Content"}),e("p",{children:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."})]}),e(F,{isChecked:f,onChange:n=>{n.currentTarget.checked?P(!0):(I(),window.location.reload())},id:"mature-content-enabled"})]})})]})]});case"appearance":return e("div",{className:u.tabContent,children:[e("div",{className:_.sectionCard,children:[e("h3",{children:"Appearance & Preferences"}),e("p",{children:"Configure how titles are displayed and other general preferences."}),e("div",{className:u.settingItem,children:e(st,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e(Sa,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:x,onChange:n=>l(n.currentTarget.checked),id:"low-end-mode"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Watched Episode Overlay"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows watched and completed episodes as an overlay on the player. Turn this off to use a popup instead."})]}),e(F,{isChecked:A,onChange:n=>De(n.currentTarget.checked),id:"watched-overlay-enabled"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:w,onChange:n=>Re(n.currentTarget.checked),id:"virtual-keyboard-enabled"})]})})]}),e("section",{className:_.sectionCard,children:[e("h3",{children:"Keyboard Shortcuts"}),e("p",{children:"Use S or Ctrl+K to focus search anywhere, or use player keys while watching."}),e("div",{className:u.shortcutContainer,children:[e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Search"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"S"}),e("span",{children:"Focus search"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Ctrl + K / ⌘ + K"}),e("span",{children:"Focus search"})]})]})]}),e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Player"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Space / K"}),e("span",{children:"Play / pause"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"J / L · ← / →"}),e("span",{children:"Seek back / fwd"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"↑ / ↓"}),e("span",{children:"Adjust volume"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"M / F"}),e("span",{children:"Mute / fullscreen"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"N / P"}),e("span",{children:"Next / prev episode"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"T"}),e("span",{children:"Theater mode"})]})]})]})]})]})]});case"presence":return e("div",{className:u.tabContent,children:e("div",{className:_.sectionCard,children:[e("h3",{children:"Discord Presence"}),e("p",{children:"Control what Dango shares on Discord."}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:i,onChange:n=>Ie(n.currentTarget.checked),id:"discord-rpc-enabled"})]})}),t?.owner&&i&&e("div",{className:u.settingItem,style:{marginTop:"1rem"},children:e("div",{className:_.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(F,{isChecked:Pe,onChange:n=>xe(n.currentTarget.checked),id:"discord-hide-mature"})]})}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem",background:"var(--bg-tertiary)",padding:"1rem",borderRadius:"8px",border:"1px solid var(--border-color)"},children:[e("div",{className:_.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(Na,{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:ve,onChange:n=>oe(n.currentTarget.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(C,{variant:"primary",size:"sm",onClick:async()=>{try{const n=await k.discord.gatewaySave.mutate({token:ve});ce({hasToken:!0,masked:n.masked,enabled:!0}),oe(n.masked)}catch(n){alert(n instanceof Error?n.message:"Failed to save token")}},children:"Save"}),e(C,{variant:"secondary",size:"sm",onClick:async()=>{await k.discord.gatewayRemove.mutate().catch(()=>{}),oe(""),ce({hasToken:!1,masked:null,enabled:!1})},children:"Remove"})]}),ne&&e("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",color:ne.hasToken?"green":"var(--text-secondary)"},children:["Status:"," ",ne.hasToken?`Token saved (${ne.masked})`:"No token saved",ne.enabled?" - Gateway active":""]}),t?.owner&&e(ma,{})]})]})});case"server":return e("div",{className:u.tabContent,children:[t?.owner&&e(ba,{}),t?.owner&&e(Ca,{}),t?.owner&&e(ka,{}),e(da,{})]});case"sync":return e("div",{className:u.tabContent,children:[e(ha,{}),e(Mt,{}),e(Gt,{}),t?.owner&&e(ua,{}),e("div",{className:_.sectionCard,children:[e("h3",{children:"Frozen Mode"}),e("p",{children:"When on, nothing is saved or synced."}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Frozen Mode"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"When on, nothing is saved or synced: no watchlist, progress, resume, or settings changes, and no cloud sync (GitHub/Google/rclone) or tracker push. Useful for experimentation and private sessions."})]}),e(F,{isChecked:te,onChange:n=>Le(n.currentTarget.checked),id:"frozen-mode"})]})})]}),e("div",{className:_.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:u.controls,children:[e(C,{onClick:Oe,children:"Backup Database"}),e(C,{variant:"secondary",onClick:Me,children:"Restore Database"})]}),e("input",{type:"file",ref:o,onChange:Ae,style:{position:"absolute",width:1,height:1,opacity:0,overflow:"hidden"},accept:".json,.db,application/octet-stream"}),S&&e("p",{className:u.status,children:S})]}),t?.owner&&e(ia,{})]});case"watchlist":return e("div",{className:u.tabContent,children:e(Ht,{})});default:return null}};return e("div",{className:"page-container",children:[e("div",{className:u.settingsHeader,children:[e("h1",{className:u.pageTitle,children:"Settings"}),e("p",{className:u.pageSubtitle,children:"Manage your preferences and data synchronization"})]}),e("div",{className:u.settingsLayout,children:[e("aside",{className:u.sidebar,ref:a,children:[e("div",{className:u.sidebarIndicator,style:{top:v.top,height:v.height,left:v.left,...v.width?{width:v.width}:{}}}),e("button",{ref:n=>{n&&g.current.set("profile",n)},className:`${u.sidebarItem} ${d==="profile"?u.active:""}`,onClick:()=>V("profile"),children:[e(j,{name:"user-astronaut"})," ",e("span",{children:"Profile"})]}),e("button",{ref:n=>{n&&g.current.set("appearance",n)},className:`${u.sidebarItem} ${d==="appearance"?u.active:""}`,onClick:()=>V("appearance"),children:[e(j,{name:"image"})," ",e("span",{children:"Appearance"})]}),e("button",{ref:n=>{n&&g.current.set("presence",n)},className:`${u.sidebarItem} ${d==="presence"?u.active:""}`,onClick:()=>V("presence"),children:[e(j,{name:"discord"})," ",e("span",{children:"Presence"})]}),e("button",{ref:n=>{n&&g.current.set("server",n)},className:`${u.sidebarItem} ${d==="server"?u.active:""}`,onClick:()=>V("server"),children:[e(j,{name:"server"})," ",e("span",{children:"Server"})]}),e("button",{ref:n=>{n&&g.current.set("sync",n)},className:`${u.sidebarItem} ${d==="sync"?u.active:""}`,onClick:()=>V("sync"),children:[e(j,{name:"cloud"})," ",e("span",{children:"Sync & Data"})]}),e("button",{ref:n=>{n&&g.current.set("watchlist",n)},className:`${u.sidebarItem} ${d==="watchlist"?u.active:""}`,onClick:()=>V("watchlist"),children:[e(j,{name:"list"})," ",e("span",{children:"Lists"})]})]}),e("main",{className:u.mainContent,children:e("div",{className:u.tabContent,children:Ge()},d)})]}),e(et,{isOpen:G,onClose:()=>P(!1),onGrant:()=>{T(),P(!1)},scope:"section"})]})};export{Aa as default};
|
|
21
|
+
})()`)}const va=()=>{const t=Ke(ya,[]);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:p=>{p.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(j,{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(C,{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.`})]})},wa="_settingItem_68mz3_1",ba="_field_68mz3_6",Ca="_input_68mz3_19",ka="_actions_68mz3_39",Sa="_status_68mz3_45",q={settingItem:wa,field:ba,input:Ca,actions:ka,status:Sa},Na=()=>{const[t,s]=r(!1),[c,p]=r(""),[d,y]=r(""),[S,h]=r(!0),[o,n]=r(!1),[g,v]=r("");M(()=>{(async()=>{try{const I=await(await J("/api/auth/app-status")).json();s(I.hasPassword)}catch{console.error("Failed to fetch LAN auth status")}finally{h(!1)}})()},[]);const m=async()=>{if(v(""),c!==d){v("Passwords do not match");return}if(c.length<4){v("Password must be at least 4 characters");return}n(!0);try{const f=await J("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:c})}),T=await f.json();if(!f.ok){v(T.error||"Failed to update password");return}s(T.hasPassword),p(""),y(""),v(T.hasPassword?"Password set successfully":"Password removed")}catch{v("Network error")}finally{n(!1)}},x=async()=>{n(!0);try{const f=await J("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:""})}),T=await f.json();if(!f.ok){v(T.error||"Failed to remove password");return}s(!1),p(""),y(""),v("Password removed")}catch{v("Network error")}finally{n(!1)}},l=async()=>{n(!0);try{await J("/api/auth/app-logout",{method:"POST"}),v("Logged out"),window.location.reload()}catch{v("Logout failed")}finally{n(!1)}};return S?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.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:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"lan-password",children:"New Password"}),e("input",{id:"lan-password",type:"password",value:c,onChange:f=>p(f.currentTarget.value),placeholder:t?"Leave empty to keep current password":"Enter a password...",className:q.input})]}),e("div",{className:q.field,children:[e("label",{htmlFor:"lan-confirm-password",children:"Confirm Password"}),e("input",{id:"lan-confirm-password",type:"password",value:d,onChange:f=>y(f.currentTarget.value),placeholder:"Confirm password...",className:q.input})]}),e("div",{className:q.actions,children:[e(C,{variant:"primary",onClick:m,loading:o,disabled:o,children:t?"Update Password":"Set Password"}),t&&e(C,{variant:"danger",onClick:l,loading:o,disabled:o,children:"Logout"}),t&&e(C,{variant:"secondary",onClick:x,loading:o,disabled:o,children:"Remove Password"})]}),g&&e("p",{className:q.status,children:g})]})]})},_a=()=>{const[t,s]=r(""),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r("");M(()=>{Q("/api/auth/app-status").then(n=>s(String(n.port??3e3))).catch(()=>h("Failed to load current port")).finally(()=>p(!1))},[]);const o=async()=>{const n=Number(t);if(!Number.isInteger(n)||n<1||n>65535){h("Enter a port between 1 and 65535");return}y(!0),h("");try{await k.auth.setServerPort.mutate({port:n}),h(`Saved. Restart dango, then open http://localhost:${n} - this overrides the PORT environment variable.`)}catch(g){h(g.message)}finally{y(!1)}};return c?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.sectionCard,children:[e("h3",{children:"Server Port"}),e("p",{children:"Port the backend listens on. Takes effect after a restart. Google and AniList sign-in need the matching redirect URI registered with the provider."}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"server-port",children:"Port"}),e("input",{id:"server-port",type:"number",min:1,max:65535,value:t,onChange:n=>s(n.currentTarget.value),className:q.input})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:o,loading:d,disabled:d,children:"Save Port"})}),S&&e("p",{className:q.status,children:S})]})]})},Ta=()=>{const[t,s]=r(""),[c,p]=r(!0),[d,y]=r(!1),[S,h]=r("");M(()=>{k.auth.allowedOrigins.query().then(n=>s(n.origins.join(", "))).catch(()=>h("Failed to load allowed origins")).finally(()=>p(!1))},[]);const o=async()=>{y(!0),h("");try{const n=await k.auth.setAllowedOrigins.mutate({origins:t});s(n.origins.join(", ")),h("Saved.")}catch(n){h(n.message)}finally{y(!1)}};return c?e("div",{className:_.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:_.sectionCard,children:[e("h3",{children:"Allowed Origins"}),e("p",{children:["Extra browser origins allowed to call the API, comma-separated. Include the scheme (e.g."," ",e("code",{children:"https://example.com"}),"). Same-origin access and reverse proxies that forward X-Forwarded-Host/X-Forwarded-Proto work automatically."]}),e("div",{className:q.settingItem,children:[e("div",{className:q.field,children:[e("label",{htmlFor:"allowed-origins",children:"Origins"}),e("input",{id:"allowed-origins",value:t,onChange:n=>s(n.currentTarget.value),className:q.input,placeholder:"https://example.com"})]}),e("div",{className:q.actions,children:e(C,{variant:"primary",onClick:o,loading:d,disabled:d,children:"Save Origins"})}),S&&e("p",{className:q.status,children:S})]})]})},Pa=()=>{const{theme:t,setTheme:s,loading:c}=Qe();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:Ve.map(p=>{const d=t===p.id;return e("button",{role:"radio","aria-checked":d,disabled:c,onClick:()=>s(p.id),style:{display:"flex",gap:"0.6rem",alignItems:"center",textAlign:"left",padding:"0.65rem 0.75rem",borderRadius:"10px",cursor:"pointer",background:d?"var(--accent-subtle)":"var(--bg-tertiary)",border:d?"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:p.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:p.label}),e("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.blurb})]})]},p.id)})})]})};function Ia({variant:t="info",children:s,className:c=""}){return e("div",{className:`alert alert-${t} ${c}`,children:s})}const La=["profile","appearance","presence","server","sync","watchlist"],xa={general:"profile",database:"sync"},Pe=t=>t?La.includes(t)?t:xa[t]??null:null,qa=()=>{const{data:t}=ye(Z),[s,c]=Fe(),p=Pe(s.get("tab")),[d,y]=r(p??"profile"),[S,h]=r(""),o=X(null),n=X(null),g=X(new Map),[v,m]=r({top:0,height:0,left:0,width:0}),{lowEndMode:x,setLowEndMode:l}=Ye(),{hasConsent:f,grant:T,revoke:I}=Je(),[z,P]=r(!1),[w,L]=r(Xe),[A,G]=r(at),[i,R]=r(!0),{data:D}=ce("discordRPCEnabled"),W=Ie(),[te,N]=r(!1),{data:ie}=ce("frozenMode"),[Le,ve]=r(!0),{data:oe}=ce("dangoGaze"),[xe,we]=r(!0),{data:ae}=ce("discordRPCHideMature"),[be,le]=r(""),[ne,ue]=r(null);M(()=>{t?.owner&&k.discord.gatewayStatus.query().then(a=>{ue(a),a.masked&&a.masked!=="none"&&le(a.masked)}).catch(()=>{})},[t?.owner]),M(()=>{D!==void 0&&R(D==="true"||D===!0||D===null)},[D]),M(()=>{ae!==void 0&&we(ae==="true"||ae===!0||ae===null)},[ae]);const Re=a=>{R(a),W.mutate({key:"discordRPCEnabled",value:String(a)})};M(()=>{ie!==void 0&&N(ie==="true"||ie===!0)},[ie]),M(()=>{oe!==void 0&&ve(oe!=="false"&&oe!==!1)},[oe]);const De=a=>{ve(a),W.mutate({key:"dangoGaze",value:String(a)})},Oe=a=>{N(a),W.mutate({key:"frozenMode",value:String(a)})},Ae=a=>{we(a),W.mutate({key:"discordRPCHideMature",value:String(a)})},Ge=a=>{L(a),Ze.setItem(et,String(a)),window.dispatchEvent(new CustomEvent(tt))},Me=a=>{G(a),nt(a)};ke.useEffect(()=>{document.title="Settings - dango"},[]),ke.useEffect(()=>{const a=Pe(s.get("tab"));a&&y(a)},[s]);const V=a=>{y(a),c(a==="profile"?{}:{tab:a})},re=fe(()=>{const a=g.current.get(d),U=n.current;if(a&&U){const Y=U.getBoundingClientRect(),$=a.getBoundingClientRect(),se=window.matchMedia("(max-width: 900px)").matches;m(se?{top:$.top-Y.top,height:$.height,left:$.left-Y.left,width:$.width}:{top:$.top-Y.top,height:$.height,left:0,width:0})}},[d]);$e(()=>{re()},[d,re]),M(()=>{const a=()=>re();window.addEventListener("resize",a);let U=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{U||re()}),()=>{U=!0,window.removeEventListener("resize",a)}},[d,re]);const ze=()=>{h("Exporting databases...");const a=window.DangoBridge;if(a?.downloadFile){a.downloadFile("/api/backup-db","dango-backup.json"),setTimeout(()=>{h("Databases exported successfully!")},1500);return}const U=document.createElement("a");U.href="/api/backup-db",U.download="dango-backup.json",document.body.appendChild(U),U.click(),U.remove(),setTimeout(()=>{h("Databases exported successfully!")},1500)},qe=async a=>{const U=a.currentTarget.files?.[0];if(!U)return;h("Importing databases...");const Y=new FormData;Y.append("dbfile",U);try{const $=await J("/api/restore-db",{method:"POST",body:Y}),se=await $.json();if($.ok){const Ce=Array.isArray(se.restored)?se.restored.join(", "):null;h(Ce?`Databases imported successfully (${Ce})!`:"Database imported successfully!"),setTimeout(()=>window.location.reload(),2e3)}else h(`Import failed: ${se.error}`)}catch{h("Import failed: An unexpected error occurred.")}finally{a.currentTarget.value=""}},Ee=()=>{o.current?.click()},Ue=()=>{switch(d){case"profile":return e("div",{className:u.tabContent,children:[e(lt,{}),e("div",{className:_.sectionCard,children:[e("h3",{children:"Mature Content"}),e("p",{children:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."})]}),e(F,{isChecked:f,onChange:a=>{a.currentTarget.checked?P(!0):(I(),window.location.reload())},id:"mature-content-enabled"})]})})]})]});case"appearance":return e("div",{className:u.tabContent,children:[e("div",{className:_.sectionCard,children:[e("h3",{children:"Appearance & Preferences"}),e("p",{children:"Configure how titles are displayed and other general preferences."}),e("div",{className:u.settingItem,children:e(ct,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e(Pa,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:x,onChange:a=>l(a.currentTarget.checked),id:"low-end-mode"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Dango Animations"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Lets dango buttons look around and react when you pet them. Always off in Low End Mode."})]}),e(F,{isChecked:Le,onChange:a=>De(a.currentTarget.checked),id:"dango-gaze"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Watched Episode Overlay"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows watched and completed episodes as an overlay on the player. Turn this off to use a popup instead."})]}),e(F,{isChecked:A,onChange:a=>Me(a.currentTarget.checked),id:"watched-overlay-enabled"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:w,onChange:a=>Ge(a.currentTarget.checked),id:"virtual-keyboard-enabled"})]})})]}),e("section",{className:_.sectionCard,children:[e("h3",{children:"Keyboard Shortcuts"}),e("p",{children:"Use S or Ctrl+K to focus search anywhere, or use player keys while watching."}),e("div",{className:u.shortcutContainer,children:[e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Search"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"S"}),e("span",{children:"Focus search"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Ctrl + K / ⌘ + K"}),e("span",{children:"Focus search"})]})]})]}),e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Player"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Space / K"}),e("span",{children:"Play / pause"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"J / L · ← / →"}),e("span",{children:"Seek back / fwd"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"↑ / ↓"}),e("span",{children:"Adjust volume"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"M / F"}),e("span",{children:"Mute / fullscreen"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"N / P"}),e("span",{children:"Next / prev episode"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"T"}),e("span",{children:"Theater mode"})]})]})]})]})]})]});case"presence":return e("div",{className:u.tabContent,children:e("div",{className:_.sectionCard,children:[e("h3",{children:"Discord Presence"}),e("p",{children:"Control what Dango shares on Discord."}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.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(F,{isChecked:i,onChange:a=>Re(a.currentTarget.checked),id:"discord-rpc-enabled"})]})}),t?.owner&&i&&e("div",{className:u.settingItem,style:{marginTop:"1rem"},children:e("div",{className:_.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(F,{isChecked:xe,onChange:a=>Ae(a.currentTarget.checked),id:"discord-hide-mature"})]})}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem",background:"var(--bg-tertiary)",padding:"1rem",borderRadius:"8px",border:"1px solid var(--border-color)"},children:[e("div",{className:_.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(Ia,{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:be,onChange:a=>le(a.currentTarget.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(C,{variant:"primary",size:"sm",onClick:async()=>{try{const a=await k.discord.gatewaySave.mutate({token:be});ue({hasToken:!0,masked:a.masked,enabled:!0}),le(a.masked)}catch(a){alert(a instanceof Error?a.message:"Failed to save token")}},children:"Save"}),e(C,{variant:"secondary",size:"sm",onClick:async()=>{await k.discord.gatewayRemove.mutate().catch(()=>{}),le(""),ue({hasToken:!1,masked:null,enabled:!1})},children:"Remove"})]}),ne&&e("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",color:ne.hasToken?"green":"var(--text-secondary)"},children:["Status:"," ",ne.hasToken?`Token saved (${ne.masked})`:"No token saved",ne.enabled?" - Gateway active":""]}),t?.owner&&e(va,{})]})]})});case"server":return e("div",{className:u.tabContent,children:[t?.owner&&e(Na,{}),t?.owner&&e(_a,{}),t?.owner&&e(Ta,{}),e(ma,{})]});case"sync":return e("div",{className:u.tabContent,children:[e(fa,{}),e(Et,{}),e(Ut,{}),t?.owner&&e(pa,{}),e("div",{className:_.sectionCard,children:[e("h3",{children:"Frozen Mode"}),e("p",{children:"When on, nothing is saved or synced."}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:_.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Frozen Mode"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"When on, nothing is saved or synced: no watchlist, progress, resume, or settings changes, and no cloud sync (GitHub/Google/rclone) or tracker push. Useful for experimentation and private sessions."})]}),e(F,{isChecked:te,onChange:a=>Oe(a.currentTarget.checked),id:"frozen-mode"})]})})]}),e("div",{className:_.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:u.controls,children:[e(C,{onClick:ze,children:"Backup Database"}),e(C,{variant:"secondary",onClick:Ee,children:"Restore Database"})]}),e("input",{type:"file",ref:o,onChange:qe,style:{position:"absolute",width:1,height:1,opacity:0,overflow:"hidden"},accept:".json,.db,application/octet-stream"}),S&&e("p",{className:u.status,children:S})]}),t?.owner&&e(da,{})]});case"watchlist":return e("div",{className:u.tabContent,children:e(Vt,{})});default:return null}};return e("div",{className:"page-container",children:[e("div",{className:u.settingsHeader,children:[e("h1",{className:u.pageTitle,children:"Settings"}),e("p",{className:u.pageSubtitle,children:"Manage your preferences and data synchronization"})]}),e("div",{className:u.settingsLayout,children:[e("aside",{className:u.sidebar,ref:n,children:[e("div",{className:u.sidebarIndicator,style:{top:v.top,height:v.height,left:v.left,...v.width?{width:v.width}:{}}}),e("button",{ref:a=>{a&&g.current.set("profile",a)},className:`${u.sidebarItem} ${d==="profile"?u.active:""}`,onClick:()=>V("profile"),children:[e(j,{name:"user-astronaut"})," ",e("span",{children:"Profile"})]}),e("button",{ref:a=>{a&&g.current.set("appearance",a)},className:`${u.sidebarItem} ${d==="appearance"?u.active:""}`,onClick:()=>V("appearance"),children:[e(j,{name:"image"})," ",e("span",{children:"Appearance"})]}),e("button",{ref:a=>{a&&g.current.set("presence",a)},className:`${u.sidebarItem} ${d==="presence"?u.active:""}`,onClick:()=>V("presence"),children:[e(j,{name:"discord"})," ",e("span",{children:"Presence"})]}),e("button",{ref:a=>{a&&g.current.set("server",a)},className:`${u.sidebarItem} ${d==="server"?u.active:""}`,onClick:()=>V("server"),children:[e(j,{name:"server"})," ",e("span",{children:"Server"})]}),e("button",{ref:a=>{a&&g.current.set("sync",a)},className:`${u.sidebarItem} ${d==="sync"?u.active:""}`,onClick:()=>V("sync"),children:[e(j,{name:"cloud"})," ",e("span",{children:"Sync & Data"})]}),e("button",{ref:a=>{a&&g.current.set("watchlist",a)},className:`${u.sidebarItem} ${d==="watchlist"?u.active:""}`,onClick:()=>V("watchlist"),children:[e(j,{name:"list"})," ",e("span",{children:"Lists"})]})]}),e("main",{className:u.mainContent,children:e("div",{className:u.tabContent,children:Ue()},d)})]}),e(rt,{isOpen:z,onClose:()=>P(!1),onGrant:()=>{T(),P(!1)},scope:"section"})]})};export{qa as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{
|
|
1
|
+
import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{a as l}from"./index-CaTGvWwZ.js";const a="_skeletonCard_qtypb_1",i="_poster_qtypb_11",d="_line_qtypb_20",c="_info_qtypb_38",_="_short_qtypb_54",m="_lowEnd_qtypb_69",e={skeletonCard:a,poster:i,line:d,"skeleton-wave":"_skeleton-wave_qtypb_1",info:c,short:_,lowEnd:m},p=({layout:n="vertical"})=>{const{lowEndMode:t}=l();return o("div",{className:`${e.skeletonCard} ${e[n]} ${t?e.lowEnd:""}`,children:[o("div",{className:e.poster}),o("div",{className:e.info,children:[o("div",{className:e.line}),o("div",{className:`${e.line} ${e.short}`})]})]})},v=({count:n=14,layout:t="vertical"})=>o("div",{className:"grid-container",children:Array.from({length:n}).map((k,s)=>o(p,{layout:t},s))}),w=r.memo(v);export{p as A,w as S};
|