-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathui_frontend.py
More file actions
1562 lines (1436 loc) · 107 KB
/
Copy pathui_frontend.py
File metadata and controls
1562 lines (1436 loc) · 107 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ui_frontend.py
# CrossWatch - UI Frontend Registration
# Copyright (c) 2025-2026 CrossWatch / Cenodude (https://github.com/cenodude/CrossWatch)
from __future__ import annotations
from pathlib import Path
import time
from fastapi import FastAPI, Request
from fastapi.responses import FileResponse, HTMLResponse, Response
from starlette.staticfiles import StaticFiles
from api.versionAPI import CURRENT_VERSION
__all__ = ["register_assets_and_favicons", "register_ui_root", "get_index_html"]
_ASSET_VERSION_CACHE: dict[str, float | str] = {"ts": 0.0, "val": CURRENT_VERSION}
DEFAULT_MANIFEST: str = r"""{
"name": "CrossWatch",
"short_name": "CrossWatch",
"description": "Sync watchlists, history and ratings across Plex, Trakt, SIMKL, Jellyfin and more.",
"id": "/",
"start_url": "/?ui=compact",
"scope": "/",
"display": "standalone",
"display_override": ["standalone", "minimal-ui", "browser"],
"orientation": "any",
"background_color": "#0b0b0f",
"theme_color": "#0b0b0f",
"icons": [
{ "src": "/assets/pwa/icon-192.png?v=__CW_VERSION__", "sizes": "192x192", "type": "image/png", "purpose": "any" },
{ "src": "/assets/pwa/icon-512.png?v=__CW_VERSION__", "sizes": "512x512", "type": "image/png", "purpose": "any" },
{ "src": "/assets/pwa/icon-192-maskable.png?v=__CW_VERSION__", "sizes": "192x192", "type": "image/png", "purpose": "maskable" },
{ "src": "/assets/pwa/icon-512-maskable.png?v=__CW_VERSION__", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
]
}"""
DEFAULT_SW: str = r"""/* sw.js - service worker */
self.addEventListener("install", (event) => {
self.skipWaiting();
});
self.addEventListener("activate", (event) => {
event.waitUntil(self.clients.claim());
});
self.addEventListener("fetch", (event) => {
});
"""
def register_assets_and_favicons(app: FastAPI, root: Path) -> None:
assets_dir = root / "assets"
assets_dir.mkdir(parents=True, exist_ok=True)
app.mount("/assets", StaticFiles(directory=str(assets_dir)), name="assets")
def asset_response(name: str, fallback: str, media_type: str, **headers: str) -> Response:
try:
content = (assets_dir / name).read_text(encoding="utf-8")
except Exception:
content = fallback
return Response(content=content, media_type=media_type, headers=headers)
@app.get("/favicon.ico", include_in_schema=False, tags=["ui"])
def favicon_ico() -> FileResponse:
return FileResponse(assets_dir / "pwa" / "favicon.ico", media_type="image/x-icon", headers={"Cache-Control": "public, max-age=86400"})
@app.get("/favicon.svg", include_in_schema=False, tags=["ui"])
def favicon_svg_compat() -> FileResponse:
return FileResponse(assets_dir / "pwa" / "favicon-64.png", media_type="image/png", headers={"Cache-Control": "public, max-age=86400"})
@app.get("/manifest.webmanifest", include_in_schema=False, tags=["ui"])
def manifest_webmanifest() -> Response:
try:
content = (assets_dir / "manifest.webmanifest").read_text(encoding="utf-8")
except Exception:
content = DEFAULT_MANIFEST
content = content.replace("__CW_VERSION__", _asset_version_token())
return Response(content=content, media_type="application/manifest+json", headers={"Cache-Control": "public, max-age=3600"})
@app.get("/sw.js", include_in_schema=False, tags=["ui"])
def service_worker() -> Response:
return asset_response("sw.js", DEFAULT_SW, "text/javascript", **{"Cache-Control": "no-store", "Service-Worker-Allowed": "/"})
def register_ui_root(app: FastAPI) -> None:
@app.get("/", include_in_schema=False, tags=["ui"])
def ui_root(request: Request) -> HTMLResponse:
return HTMLResponse(get_index_html(), headers={"Cache-Control": "no-store"})
_HELPER_SCRIPTS = (
"help-links.js", "provider-meta.js", "icon-select.js", "profile-select.js", "page-loader.js", "dom.js", "events.js", "api.js", "core.js", "details-log.js",
"media-meta.js", "trailer.js", "playing-card.js", "watchlist-preview.js", "providers-ui.js", "settings-ui.js", "settings-save.js", "maintenance.js", "backups.js",
"restart_apply.js",
)
_APP_SCRIPTS = (
"syncbar.js", "run-summary-stream.js", "main.js", "connections.overlay.js", "connections.pairs.overlay.js", "scheduler.js",
"schedulerbanner.js", "playingcard.js", "insights.js", "activity.js", "dashboard-widgets.js", "auth-dots.js", "main-status.js",
"scrobbler.js",
)
def _asset_block() -> str:
helper_tags = "\n".join(f'<script src="/assets/helpers/{name}?v=__CW_VERSION__"></script>' for name in _HELPER_SCRIPTS)
app_tags = "\n".join(f'<script src="/assets/js/{name}?v=__CW_VERSION__" defer></script>' for name in _APP_SCRIPTS)
return "\n".join((
helper_tags,
'<script src="/assets/helpers/media_user_picker.js?v=__CW_VERSION__" defer></script>',
'<script src="/assets/helpers/whitelist_table.js?v=__CW_VERSION__" defer></script>',
'<script src="/assets/crosswatch.js?v=__CW_VERSION__"></script>',
app_tags,
'<script src="/assets/auth/auth.shared.js?v=__CW_VERSION__"></script>',
'<script src="/assets/auth/auth_loader.js?v=__CW_VERSION__" defer></script>',
'<script src="/assets/auth/auth.tmdb.js?v=__CW_VERSION__" defer></script>',
'<script type="module" src="/assets/js/modals.js?v=__CW_VERSION__"></script>',
'<script src="/assets/js/theme-flat-runtime.js?v=__CW_VERSION__" defer></script>',
))
def _asset_version_token() -> str:
now = time.time()
cached_at = float(_ASSET_VERSION_CACHE.get("ts") or 0.0)
cached_val = str(_ASSET_VERSION_CACHE.get("val") or CURRENT_VERSION)
if now - cached_at < 2.0:
return cached_val
root = Path(__file__).resolve().parent
latest_mtime = 0
try:
candidates = [root / "assets", root / "ui_frontend.py"]
for candidate in candidates:
if candidate.is_file():
latest_mtime = max(latest_mtime, int(candidate.stat().st_mtime))
continue
if not candidate.exists():
continue
for path in candidate.rglob("*"):
if path.is_file():
latest_mtime = max(latest_mtime, int(path.stat().st_mtime))
except Exception:
latest_mtime = 0
token = f"{CURRENT_VERSION}.{latest_mtime}" if latest_mtime > 0 else CURRENT_VERSION
_ASSET_VERSION_CACHE["ts"] = now
_ASSET_VERSION_CACHE["val"] = token
return token
def _get_index_html_static() -> str:
return r"""<!doctype html><html lang="en"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>CrossWatch</title>
<script>
(() => {
const APP_NAME = "CrossWatch";
const TITLES = {
main: "Main",
watchlist: "Watchlist",
playback_progress: "Playback Progress",
snapshots: "Captures",
playlists: "Playlists",
editor: "Editor",
settings: "Settings",
};
const normalize = (value) => String(value || "").trim().toLowerCase();
const setTitle = (page) => {
const label = TITLES[normalize(page)];
document.title = label ? `${label} | ${APP_NAME}` : APP_NAME;
};
const currentPage = () => {
const dataTab = normalize(document.body?.dataset?.tab || document.documentElement?.dataset?.tab);
if (dataTab) return dataTab;
const activeTab = document.querySelector('.tabs .tab.active[id^="tab-"]')?.id || "";
return normalize(activeTab.replace(/^tab-/, "")) || "main";
};
window.cwSetDocumentTitle = setTitle;
document.addEventListener("DOMContentLoaded", () => setTitle(currentPage()), { once: true });
document.addEventListener("tab-changed", (event) => setTitle(event?.detail?.id || event?.detail?.tab));
document.addEventListener("cw-settings-pane-changed", () => {
if (currentPage() === "settings") setTitle("settings");
});
})();
</script>
<link rel="icon" type="image/png" sizes="64x64" href="/assets/pwa/favicon-64.png?v=__CW_VERSION__"><link rel="alternate icon" href="/favicon.ico?v=__CW_VERSION__">
<meta name="theme-color" content="#0b0b0f">
<link rel="manifest" href="/manifest.webmanifest">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/pwa/apple-touch-icon.png?v=__CW_VERSION__">
<meta name="application-name" content="CrossWatch">
<meta name="apple-mobile-web-app-title" content="CrossWatch">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<script>
(() => {
try {
const raw = localStorage.getItem("cw.ui.theme") || "flat-dark";
const theme = raw === "flat-light" ? "flat-light" : raw === "original" ? "original" : "flat-dark";
if (theme === "original") {
delete document.documentElement.dataset.cwTheme;
} else {
document.documentElement.dataset.cwTheme = theme;
}
document.documentElement.classList.toggle("cw-theme-light", theme === "flat-light");
document.documentElement.classList.toggle("cw-theme-dark", theme === "flat-dark");
document.documentElement.classList.toggle("cw-theme-original", theme === "original");
} catch {
document.documentElement.dataset.cwTheme = "flat-dark";
}
})();
</script>
<link rel="stylesheet" href="/assets/themes/tokens.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/base.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/providers.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/crosswatch.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/auth-providers.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/layout.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/components.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/css/pages.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/ui-shell.css?v=__CW_VERSION__">
<script>
(() => {
try {
const q = new URLSearchParams(window.location.search || "");
const ui = String(q.get("ui") || "").toLowerCase();
const explicit = ui === "compact" || ui === "full" || q.get("compact") === "1" || q.get("full") === "1";
const hasCompactViewport = !!window.matchMedia?.("(max-width: 680px)")?.matches;
const uaLooksMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent || "");
const likelyHandheld = (() => {
try {
if (typeof navigator.userAgentData?.mobile === "boolean") return navigator.userAgentData.mobile;
} catch {}
if (uaLooksMobile) return true;
try {
const coarse = !!window.matchMedia?.("(pointer: coarse)")?.matches;
const fine = !!window.matchMedia?.("(pointer: fine)")?.matches;
const points = Number(navigator.maxTouchPoints || 0);
return points > 1 && coarse && !fine && hasCompactViewport;
} catch {}
return false;
})();
const wantCompact = ui === "compact" || q.get("compact") === "1" || (!explicit && hasCompactViewport && likelyHandheld);
if (wantCompact) document.documentElement.classList.add("cw-compact");
} catch {}
})();
</script>
<link rel="preload" href="/assets/fonts/material-symbols-rounded-full-v355.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="/assets/fonts/material-symbols-rounded.css?v=__CW_VERSION__">
<link rel="stylesheet" href="/assets/js/modals/core/styles.css?v=__CW_VERSION__">
<link id="cw-theme-flat-css" rel="stylesheet" href="/assets/themes/flat.css?v=__CW_VERSION__" media="not all" disabled>
<link id="cw-theme-original-css" rel="stylesheet" href="/assets/themes/original-coverage.css?v=__CW_VERSION__" media="not all" disabled>
<script>
(() => {
const original = document.documentElement.classList.contains("cw-theme-original");
const flatLink = document.getElementById("cw-theme-flat-css");
const originalLink = document.getElementById("cw-theme-original-css");
flatLink.disabled = original;
flatLink.media = original ? "not all" : "all";
originalLink.disabled = !original;
originalLink.media = original ? "all" : "not all";
})();
</script>
</head><body>
<header>
<div class="brand" role="button" tabindex="0" title="Go to Main" onclick="showTab('main')" onkeypress="if(event.key==='Enter'||event.key===' ')showTab('main')">
<img class="logo" src="/assets/pwa/favicon-64.png?v=__CW_VERSION__" alt="CrossWatch">
<span class="brand-text">
<span class="name">CrossWatch</span>
<span class="version">__CW_CURRENT_VERSION__</span>
</span>
</div>
<nav class="tabs" aria-label="Primary navigation">
<button id="tab-main" class="tab active" type="button" onclick="showTab('main')">Main</button>
<button id="tab-watchlist" class="tab" type="button" onclick="showTab('watchlist')">Watchlist</button>
<button id="tab-playback_progress" class="tab" type="button" onclick="showTab('playback_progress')">Playback</button>
<button id="tab-snapshots" class="tab" type="button" onclick="showTab('snapshots')">Captures</button>
<button id="tab-playlists" class="tab" type="button" onclick="showTab('playlists')">Playlists</button>
<button id="tab-editor" class="tab" type="button" onclick="showTab('editor')">Editor</button>
<div class="cw-tabmenu" id="tab-settings-menu">
<button id="tab-settings" class="tab" type="button"
aria-haspopup="menu" aria-expanded="false"
onclick="window.cwToggleSettingsMenu(event)">
<span>Settings</span>
<span class="tab-caret" aria-hidden="true"></span>
</button>
<div class="cw-menu hidden" id="cw-settings-menu" role="menu" aria-labelledby="tab-settings">
<button class="cw-menu-item active" data-settings-pane="overview" type="button" role="menuitem" aria-current="page" onclick="window.cwSettingsMenuSelect('overview')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">grid_view</span><span>Settings overview</span></button>
<div class="cw-menu-sep" role="separator" aria-hidden="true"></div>
<button class="cw-menu-item" data-settings-pane="providers" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('providers')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">device_hub</span><span>Connections</span></button>
<button class="cw-menu-item" data-settings-pane="sync" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('pairs')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">sync_alt</span><span>Sync pairs</span></button>
<button class="cw-menu-item" data-settings-pane="scrobbler" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('scrobbler')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">sensors</span><span>Scrobbler</span></button>
<button class="cw-menu-item" data-settings-pane="scheduling" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('scheduling')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">schedule</span><span>Scheduling</span></button>
<button class="cw-menu-item" data-settings-pane="app" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('app')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">security</span><span>UI and Security</span></button>
<button class="cw-menu-item" data-settings-pane="maintenance" type="button" role="menuitem" onclick="window.cwSettingsMenuSelect('maintenance')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">build</span><span>Maintenance</span></button>
<div class="cw-menu-sep" role="separator" aria-hidden="true"></div>
<button class="cw-menu-item danger" type="button" role="menuitem" onclick="window.cwSettingsMenuLogout()"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">logout</span><span>Log out</span></button>
</div>
</div>
<div class="cw-tabmenu" id="tab-about-menu">
<button id="tab-about" class="tab" type="button"
aria-haspopup="menu" aria-expanded="false"
onclick="window.cwToggleAboutMenu(event)">
<span>About</span>
<span class="tab-caret" aria-hidden="true"></span>
</button>
<div class="cw-menu hidden" id="cw-about-menu" role="menu" aria-labelledby="tab-about">
<button class="cw-menu-item" type="button" role="menuitem" onclick="window.cwAboutMenuSelect('about')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">info</span><span>About</span></button>
<button class="cw-menu-item" type="button" role="menuitem" onclick="window.cwAboutMenuSelect('help')"><span class="material-symbols-rounded cw-menu-icon" aria-hidden="true">help</span><span>Help</span></button>
</div>
</div>
</nav>
<div class="cw-ui-toggle" aria-label="UI mode">
<button class="cw-ui-btn btn-full" type="button" onclick="cwSetUiMode('full')">Full UI</button>
<button class="cw-ui-btn btn-compact" type="button" onclick="cwSetUiMode('compact')">Compact</button>
</div>
</header>
<main id="layout">
<section id="ops-card" class="card cw-main-card cw-main-card--sync">
<div class="title">Sync Hub</div>
<div class="ops-header cw-main-card-head">
<div class="cw-main-card-head-copy">
<h2>Sync Hub</h2>
</div>
<div class="cw-main-card-head-side">
<div id="conn-badges" class="vip-badges"></div>
<div class="cw-main-card-head-actions">
<div id="update-banner" class="hidden"><span id="update-text">A new version is available.</span>
<a id="update-link" href="https://github.com/cenodude/crosswatch/releases" target="_blank" rel="noopener">Get update</a>
</div>
<button id="btn-status-refresh" class="iconbtn" title="Re-check status" aria-label="Refresh status">
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">
<path d="M21 12a9 9 0 1 1-2.64-6.36" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M21 5v5h-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
</div>
</div>
</div>
<div class="sync-status" style="display:none"><div id="sync-icon"></div><div id="sync-status-text"></div><span id="sched-inline" style="display:none"></span></div>
<div id="ux-progress"></div><div id="ux-lanes"></div><div id="ux-spotlight"></div>
<div class="action-row">
<div class="action-buttons">
<div class="cw-split-run" id="cw-sync-split">
<button id="run" class="btn acc cw-split-main" onclick="runSync()"><span class="material-symbols-rounded cw-action-icon cw-sync-action-icon" aria-hidden="true">sync</span><span class="label">Synchronize</span></button>
<button id="run-menu" class="btn acc cw-split-edge" type="button" title="Sync options" aria-label="Sync options" aria-haspopup="menu" aria-expanded="false" onclick="window.cwToggleSyncMenu(event)"><span class="material-symbols-rounded" aria-hidden="true">expand_more</span></button>
<div class="cw-menu cw-sync-menu hidden" id="cw-sync-menu" role="menu" aria-labelledby="run-menu"></div>
</div>
<button id="btn-details" class="btn cw-hub-action" onclick="toggleDetails()" title="Show the sync results and stats" aria-label="Show the latest sync results and stats"><span class="material-symbols-rounded cw-action-icon" aria-hidden="true">description</span><span>View details</span></button>
<button class="btn cw-hub-action" onclick="openAnalyzer()" title="Finds missing, unresolved or inconsistent sync items" aria-label="Finds missing, unresolved or inconsistent sync items between providers"><span class="material-symbols-rounded cw-action-icon" aria-hidden="true">monitoring</span><span>Analyzer</span></button>
<button class="btn cw-hub-action" onclick="openEvents()" title="View sync events" aria-label="View sync events"><span class="material-symbols-rounded cw-action-icon" aria-hidden="true">history</span><span>Events</span></button>
<button class="btn cw-hub-action" onclick="openExporter()" title="Export your watchlist, history and ratings to a file" aria-label="Export your watchlist, history and ratings to a file"><span class="material-symbols-rounded cw-action-icon" aria-hidden="true">ios_share</span><span>Exporter</span></button>
</div>
<div class="cw-status-dock"></div>
</div>
<div id="details" class="details hidden">
<div class="details-grid">
<div class="det-left">
<div class="det-head">
<div class="det-tabs" role="tablist" aria-label="Output tabs">
<button id="det-tab-sync" class="det-tab active" type="button"
role="tab" aria-selected="true" aria-controls="det-panel-sync" data-tab="sync">Sync</button>
<button id="det-tab-watcher" class="det-tab" type="button"
role="tab" aria-selected="false" aria-controls="det-panel-watcher" data-tab="watcher">Watcher</button>
<button id="det-tab-debug" class="det-tab" type="button"
role="tab" aria-selected="false" aria-controls="det-panel-debug" data-tab="debug">Debug</button>
</div>
<div class="det-tools">
<button id="det-copy" class="ghost det-tool-icon" type="button" title="Copy current output" aria-label="Copy current output"><span class="material-symbols-rounded" aria-hidden="true">content_copy</span></button>
<button id="det-clear" class="ghost det-tool-icon" type="button" title="Clear current output" aria-label="Clear current output"><span class="material-symbols-rounded" aria-hidden="true">delete</span></button>
<button id="det-follow" class="ghost det-follow" type="button" title="Toggle auto-follow" aria-pressed="true"><span class="material-symbols-rounded det-follow-icon" aria-hidden="true">podcasts</span><span>Follow</span><span class="material-symbols-rounded det-follow-caret" aria-hidden="true">expand_more</span></button>
</div>
</div>
<div class="det-panels">
<div id="det-panel-sync" class="det-panel" role="tabpanel" aria-labelledby="det-tab-sync">
<div id="det-log" class="log"></div>
</div>
<div id="det-panel-watcher" class="det-panel hidden" role="tabpanel" aria-labelledby="det-tab-watcher">
<div id="det-watch-log" class="log wlog"></div>
</div>
<div id="det-panel-debug" class="det-panel hidden" role="tabpanel" aria-labelledby="det-tab-debug">
<div id="det-debug-log" class="log wlog"></div>
</div>
</div>
<div class="det-console-footer" aria-live="polite">
<span id="det-live-state" class="det-live-state"><span class="det-live-dot" aria-hidden="true"></span><span class="det-live-label">Live</span></span>
<span id="det-follow-state" class="det-follow-state">Auto-scroll on</span>
<span class="det-footer-spacer"></span>
<span id="det-line-count" class="det-line-count">0 lines</span>
<span class="material-symbols-rounded det-list-icon" aria-hidden="true">format_list_bulleted</span>
</div>
</div>
<div class="det-right">
<div class="meta-card">
<div class="meta-grid">
<div class="meta-label">Module</div><div class="meta-value"><span id="det-cmd" class="pillvalue truncate">-</span></div>
<div class="meta-label">Version</div><div class="meta-value"><span id="det-ver" class="pillvalue">-</span></div>
<div class="meta-label">Started</div><div class="meta-value"><span id="det-start" class="pillvalue mono">-</span></div>
<div class="meta-label">Finished</div><div class="meta-value"><span id="det-finish" class="pillvalue mono">-</span></div>
</div>
<div class="meta-actions"><button class="btn" onclick="copySummary(this)">Copy summary</button></div>
</div>
</div>
</div>
</div>
</section>
<section id="stats-card" class="card cw-main-card cw-main-card--stats">
<div class="title">Statistics</div>
<div class="cw-main-card-head cw-main-card-head--compact">
<div class="cw-main-card-head-copy">
<div class="cw-main-card-kicker">Statistics</div>
</div>
</div>
<div class="stats-modern v2">
<div class="now"><div class="label">Now</div><div id="stat-now" class="value" data-v="0">0</div><div class="chips"><span id="trend-week" class="chip trend flat">no change</span></div></div>
<div class="facts">
<div class="fact"><span class="k">Last Week</span><span id="stat-week" class="v" data-v="0">0</span></div>
<div class="fact"><span class="k">Last Month</span><span id="stat-month" class="v" data-v="0">0</span></div>
<div class="mini-legend"><span class="dot add"></span><span class="l">Added</span><span id="stat-added" class="n">0</span><span class="dot del"></span><span class="l">Removed</span><span id="stat-removed" class="n">0</span></div>
<div class="stat-meter" aria-hidden="true"><span id="stat-fill"></span></div>
</div>
</div>
<div class="stat-tiles" id="stat-providers"></div>
<div class="stat-block" id="recent-activity-block">
<div class="stat-block-header"><span class="pill plain">Recent Scrobble</span><button id="activity-view-all" class="ghost refresh-insights" type="button">View all</button></div>
<div id="recent-activity" class="history-list"></div>
</div>
<div class="stat-block">
<div class="stat-block-header"><span class="pill plain">Recent syncs</span><button class="ghost refresh-insights material-symbols-rounded" onclick="refreshInsights()" title="Refresh" aria-label="Refresh recent syncs">refresh</button></div>
<div id="sync-history" class="history-list"></div>
</div>
</section>
<section id="dashboard-widgets-card" class="cw-dashboard-widgets hidden" aria-label="Media widgets">
<article id="placeholder-card" class="card cw-main-card cw-main-card--wall cw-dash-widget cw-dash-widget--watchlist cw-dash-widget--wide hidden">
<div class="title">Watchlist</div>
<div class="cw-main-card-head cw-main-card-head--compact">
<div class="cw-main-card-head-copy">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">movie</span>
<h3>Watchlist</h3>
</div>
</div>
<span id="watchlist-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button class="cw-watchlist-see-all" type="button" onclick="showTab('watchlist')" aria-label="Open Watchlist page">View all</button>
</div>
<div id="wall-msg" class="wall-msg">Loading...</div>
<div class="wall-wrap">
<div id="edgeL" class="edge left"></div><div id="edgeR" class="edge right"></div>
<div id="poster-row" class="row-scroll" aria-label="Watchlist"></div>
<button class="nav prev" type="button" onclick="scrollWall(-1)" aria-label="Scroll left"><</button>
<button class="nav next" type="button" onclick="scrollWall(1)" aria-label="Scroll right">></button>
</div>
</article>
<article id="recent-history-widget" class="cw-dash-widget cw-dash-widget--history">
<div class="cw-dash-widget-head">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">play_arrow</span>
<h3>Recent History</h3>
</div>
<div class="cw-dash-head-actions">
<span id="recent-history-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button id="recent-history-refresh" class="cw-dash-ghost" type="button" title="Refresh recent history" aria-label="Refresh recent history"><span class="material-symbols-rounded" aria-hidden="true">refresh</span></button>
</div>
</div>
<div id="recent-history-list" class="cw-history-widget-list cw-widget-scrollbar" aria-live="polite"></div>
</article>
<article id="latest-ratings-widget" class="cw-dash-widget cw-dash-widget--ratings">
<div class="cw-dash-widget-head">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">star</span>
<h3>Latest Ratings</h3>
</div>
<div class="cw-dash-head-actions">
<span id="latest-ratings-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button id="latest-ratings-refresh" class="cw-dash-ghost" type="button" title="Refresh latest ratings" aria-label="Refresh latest ratings"><span class="material-symbols-rounded" aria-hidden="true">refresh</span></button>
</div>
</div>
<div id="latest-ratings-grid" class="cw-ratings-widget-grid" aria-live="polite"></div>
</article>
<article id="recent-scrobble-widget" class="cw-dash-widget cw-dash-widget--scrobble">
<div class="cw-dash-widget-head">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">sensors</span>
<h3>Recent Scrobble</h3>
</div>
<div class="cw-dash-head-actions">
<span id="recent-scrobble-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button id="recent-scrobble-refresh" class="cw-dash-ghost" type="button" title="Refresh recent scrobble" aria-label="Refresh recent scrobble"><span class="material-symbols-rounded" aria-hidden="true">refresh</span></button>
</div>
</div>
<div id="recent-scrobble-list" class="cw-history-widget-list cw-widget-scrollbar" aria-live="polite"></div>
</article>
<article id="recent-progress-widget" class="cw-dash-widget cw-dash-widget--progress">
<div class="cw-dash-widget-head">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">timelapse</span>
<h3>Recent Progress</h3>
</div>
<div class="cw-dash-head-actions">
<span id="recent-progress-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button id="recent-progress-refresh" class="cw-dash-ghost" type="button" title="Refresh recent progress" aria-label="Refresh recent progress"><span class="material-symbols-rounded" aria-hidden="true">refresh</span></button>
</div>
</div>
<div id="recent-progress-list" class="cw-history-widget-list cw-widget-scrollbar" aria-live="polite"></div>
</article>
<article id="recent-playlists-widget" class="cw-dash-widget cw-dash-widget--playlists">
<div class="cw-dash-widget-head">
<div class="cw-dash-title-row">
<span class="material-symbols-rounded" aria-hidden="true">queue_music</span>
<h3>Recent Playlists</h3>
</div>
<div class="cw-dash-head-actions">
<span id="recent-playlists-count-chip" class="cw-widget-count-chip hidden" aria-live="polite"></span>
<button id="recent-playlists-refresh" class="cw-dash-ghost" type="button" title="Refresh recent playlists" aria-label="Refresh recent playlists"><span class="material-symbols-rounded" aria-hidden="true">refresh</span></button>
</div>
</div>
<div id="recent-playlists-list" class="cw-history-widget-list cw-widget-scrollbar" aria-live="polite"></div>
</article>
</section>
<section id="page-watchlist" class="card hidden tab-page"></section>
<section id="page-playback_progress" class="card hidden tab-page">
<div id="playback-progress-root">
<div class="cw-page-loading">Loading Playback Progress...</div>
</div>
</section>
<section id="page-snapshots" class="card hidden tab-page"></section>
<section id="page-playlists" class="card hidden tab-page"></section>
<section id="page-editor" class="card hidden tab-page"></section>
<section id="page-settings" class="card hidden">
<div id="cw-settings-shell">
<aside id="cw-settings-nav" aria-label="Settings navigation">
<div class="cw-settings-nav-card">
<div class="cw-settings-nav-title">Settings</div>
<div class="cw-settings-nav-gear" aria-hidden="true"><span class="material-symbols-rounded">settings</span></div>
</div>
<div class="cw-settings-nav-list" role="tablist" aria-label="Settings sections">
<button type="button" class="cw-settings-nav-btn active" data-pane="overview" onclick="cwSettingsSelect?.('overview')">
<span class="material-symbols-rounded">grid_view</span>
<span><strong>Setup</strong><small>Progress, status and next steps</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="providers" onclick="cwSettingsSelect?.('providers')">
<span class="material-symbols-rounded">device_hub</span>
<span><strong>Connections</strong><small>Providers and metadata</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="sync" onclick="cwSettingsSelect?.('sync')">
<span class="material-symbols-rounded">sync_alt</span>
<span><strong>Synchronization</strong><small>Sync pairs and routes</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="scrobbler" onclick="cwSettingsSelect?.('scrobbler')">
<span class="material-symbols-rounded">sensors</span>
<span><strong>Scrobbler</strong><small>Webhook and watcher routes</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="scheduling" onclick="cwSettingsSelect?.('scheduling')">
<span class="material-symbols-rounded">schedule</span>
<span><strong>Scheduling</strong><small>Jobs and automation</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="app" onclick="cwSettingsSelect?.('app')">
<span class="material-symbols-rounded">security</span>
<span><strong>UI and Security</strong><small>Interface, auth and tracker</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
<button type="button" class="cw-settings-nav-btn" data-pane="maintenance" onclick="cwSettingsSelect?.('maintenance')">
<span class="material-symbols-rounded">build</span>
<span><strong>Maintenance</strong><small>Tools and diagnostics</small></span>
<span class="cw-settings-nav-chev" aria-hidden="true">chevron_right</span>
</button>
</div>
<div class="cw-settings-nav-footer">
<button type="button" class="cw-settings-help-card" onclick="openHelp?.()">
<span><strong>Need help?</strong><small>View documentation</small></span>
<span class="material-symbols-rounded" aria-hidden="true">open_in_new</span>
</button>
</div>
</aside>
<div id="cw-settings-left">
<section id="cw-settings-overview" class="cw-settings-pane active" data-pane="overview">
<div id="cw-settings-overview-grid">
<div class="cw-settings-overview-main">
<div class="cw-settings-overview-title">
<h3>Setup</h3>
<p>Track your setup progress and configure core areas.</p>
</div>
<section class="cw-settings-overview-card cw-settings-progress-card">
<div class="cw-settings-progress-summary">
<div class="cw-settings-progress-ring" id="cw-settings-progress-ring">
<span id="cw-settings-progress-count">0/4</span>
</div>
<div class="cw-settings-progress-copy">
<strong id="cw-settings-hero-title">Setup progress</strong>
<span id="cw-settings-hero-copy">Checking your CrossWatch setup.</span>
<span class="cw-settings-hero-progress-value" id="cw-settings-progress-text">0 of 4 steps ready</span>
<span class="cw-settings-progress-track" aria-hidden="true"><span id="cw-settings-progress-bar"></span></span>
</div>
</div>
<div class="cw-settings-progress-steps" aria-label="Setup progress areas">
<span class="cw-settings-progress-node" data-step-node="auth"><span class="material-symbols-rounded">check</span><small>Connections</small></span>
<span class="cw-settings-progress-node" data-step-node="meta"><span class="material-symbols-rounded">check</span><small>Metadata</small></span>
<span class="cw-settings-progress-node" data-step-node="sync"><span class="material-symbols-rounded">check</span><small>Synchronization</small></span>
<span class="cw-settings-progress-node" data-step-node="scheduling"><span class="material-symbols-rounded">check</span><small>Automation</small></span>
</div>
</section>
<section class="cw-settings-setup-card-list" aria-label="Setup areas">
<div class="cw-settings-setup-table">
<article class="cw-settings-setup-step cw-settings-setup-row" data-step="auth" role="button" tabindex="0" onclick="cwSettingsOverviewGo?.('auth')" onkeydown="cwSettingsStepKey?.(event,'auth')">
<span class="cw-settings-setup-area">
<span class="cw-settings-management-icon material-symbols-rounded" aria-hidden="true">device_hub</span>
<span>
<strong>Connections</strong>
<span class="cw-settings-step-copy" id="cw-settings-step-auth-copy">Connect your media services and metadata providers.</span>
</span>
</span>
<span class="cw-settings-step-state" id="cw-settings-step-auth-state">Needs setup</span>
<span class="cw-settings-step-detail" id="cw-settings-step-auth-detail">No providers</span>
<button type="button" class="cw-settings-step-link" id="cw-settings-step-auth-link" onclick="event.stopPropagation(); cwSettingsOverviewGo?.('auth')">Manage</button>
</article>
<article class="cw-settings-setup-step cw-settings-setup-row" data-step="meta" role="button" tabindex="0" onclick="cwSettingsOverviewGo?.('meta')" onkeydown="cwSettingsStepKey?.(event,'meta')">
<span class="cw-settings-setup-area">
<span class="cw-settings-management-icon material-symbols-rounded" aria-hidden="true">database</span>
<span>
<strong>Metadata</strong>
<span class="cw-settings-step-copy" id="cw-settings-step-meta-copy">Configure metadata sources and refresh settings.</span>
</span>
</span>
<span class="cw-settings-step-state" id="cw-settings-step-meta-state">Missing</span>
<span class="cw-settings-step-detail" id="cw-settings-step-meta-detail">Configure metadata sources</span>
<button type="button" class="cw-settings-step-link" id="cw-settings-step-meta-link" onclick="event.stopPropagation(); cwSettingsOverviewGo?.('meta')">Manage</button>
</article>
<article class="cw-settings-setup-step cw-settings-setup-row" data-step="sync" role="button" tabindex="0" onclick="cwSettingsOverviewGo?.('sync')" onkeydown="cwSettingsStepKey?.(event,'sync')">
<span class="cw-settings-setup-area">
<span class="cw-settings-management-icon material-symbols-rounded" aria-hidden="true">sync_alt</span>
<span>
<strong>Synchronization</strong>
<span class="cw-settings-step-copy" id="cw-settings-step-sync-copy">Manage sync pairs, routes and history.</span>
</span>
</span>
<span class="cw-settings-step-state" id="cw-settings-step-sync-state">Optional</span>
<span class="cw-settings-step-detail" id="cw-settings-step-sync-detail">No pairs configured</span>
<button type="button" class="cw-settings-step-link" id="cw-settings-step-sync-link" onclick="event.stopPropagation(); cwSettingsOverviewGo?.('sync')">Manage</button>
</article>
<article class="cw-settings-setup-step cw-settings-setup-row" data-step="scheduling" role="button" tabindex="0" onclick="cwSettingsOverviewGo?.('scheduling')" onkeydown="cwSettingsStepKey?.(event,'scheduling')">
<span class="cw-settings-setup-area">
<span class="cw-settings-management-icon material-symbols-rounded" aria-hidden="true">schedule</span>
<span>
<strong>Automation</strong>
<span class="cw-settings-step-copy" id="cw-settings-step-scheduling-copy">Schedule jobs and manage automation tasks.</span>
</span>
</span>
<span class="cw-settings-step-state" id="cw-settings-step-scheduling-state">Optional</span>
<span class="cw-settings-step-detail" id="cw-settings-step-scheduling-detail">No automation enabled</span>
<button type="button" class="cw-settings-step-link" id="cw-settings-step-scheduling-link" onclick="event.stopPropagation(); cwSettingsOverviewGo?.('scheduling')">Manage</button>
</article>
</div>
</section>
<div class="hidden" aria-hidden="true">
<span id="cw-settings-primary-cta"></span>
<span id="cw-settings-scrobbler-cta"></span>
<span id="cw-settings-stat-auth"></span>
<span id="cw-settings-stat-auth-copy"></span>
<span id="cw-settings-stat-pairs"></span>
<span id="cw-settings-stat-pairs-copy"></span>
<span id="cw-settings-stat-automation"></span>
<span id="cw-settings-stat-automation-copy"></span>
</div>
</div>
<aside id="cw-settings-insight" aria-label="Settings Insight"></aside>
</div>
</section>
<section class="cw-settings-pane" data-pane="providers">
<div class="cw-settings-pane-head cw-settings-hero cw-settings-hero-connections">
<div>
<div class="cw-settings-pane-kicker">Connections</div>
<h3>Providers and metadata</h3>
<p>Connect media servers and/or Trackers first (Providers) then configure Metadata (TMDb)</p>
</div>
<div class="cw-settings-pane-head-actions">
<div class="cw-settings-jumpbar cw-connections-actions" aria-label="Connection actions">
<button type="button" class="cw-settings-jump" onclick="window.openAddMetadata?.()"><span class="material-symbols-rounded" aria-hidden="true">add</span>Add metadata</button>
<button type="button" class="cw-settings-jump" onclick="window.openAddConnection?.()"><span class="material-symbols-rounded" aria-hidden="true">add</span>Add provider</button>
</div>
</div>
<span class="material-symbols-rounded cw-settings-hero-shape" aria-hidden="true">hub</span>
</div>
<div class="cw-settings-pane-stack cw-settings-providers-stack">
<div class="section open cw-settings-section cw-settings-provider-section" id="sec-auth" data-accordion="off">
<div class="body"><div id="auth-providers"></div></div>
</div>
<div id="metadata-providers" class="hidden" aria-hidden="true">
<div id="meta-provider-panel" class="cw-meta-provider-stack"></div>
<div id="meta-provider-raw" class="hidden"></div>
</div>
</div>
</section>
<section class="cw-settings-pane" data-pane="sync">
<div class="cw-settings-pane-head cw-settings-hero cw-settings-hero-sync">
<div>
<div class="cw-settings-pane-kicker">Synchronization</div>
<h3>Sync pairs</h3>
<p>Choose providers and manage how data syncs between them.</p>
</div>
<span class="material-symbols-rounded cw-settings-hero-shape" aria-hidden="true">sync_alt</span>
</div>
<div class="cw-settings-pane-stack cw-settings-sync-stack">
<div class="section open cw-settings-section" id="sec-sync" data-accordion="off">
<div class="body">
<div id="providers_list" class="grid2"></div>
<div class="sep"></div><h4 class="cw-sync-subhead">Pairs</h4><div id="pairs_list"></div>
<div class="footer"><div class="pair-selectors" style="margin-top:1em;">
<label for="source-provider" style="margin-right:1em;">Source:</label><select id="source-provider" name="source_provider" style="margin-left:.5em;"></select>
<label for="target-provider">Target:</label><select id="target-provider" name="target_provider" style="margin-left:.5em;"></select>
</div></div>
</div>
</div>
</div>
</section>
<section class="cw-settings-pane" data-pane="scheduling">
<div class="cw-settings-pane-head cw-settings-hero cw-settings-hero-scheduling">
<div>
<div class="cw-settings-pane-kicker">Scheduling</div>
<h3>Run automation</h3>
<p>Use standard for simple scheduling tasks or advanced for pair-based scheduling</p>
</div>
<div class="cw-settings-pane-head-actions">
<div class="cw-settings-jumpbar" id="sched-pane-tabs" aria-label="Scheduling sections">
<button type="button" class="cw-settings-jump active" data-sub="basic">Standard</button>
<button type="button" class="cw-settings-jump" data-sub="advanced">Advanced</button>
</div>
</div>
<span class="material-symbols-rounded cw-settings-hero-shape" aria-hidden="true">event_repeat</span>
</div>
<div class="section open cw-settings-section cw-scheduling-section" id="sec-scheduling" data-accordion="off">
<div class="body">
<div id="sched-provider-panel" class="cw-panel hidden"></div>
<div id="sched-provider-raw" class="hidden">
<div class="grid2">
<div><label for="schEnabled">Enable</label><select id="schEnabled" name="schEnabled"><option value="false">Disabled</option><option value="true">Enabled</option></select></div>
<div><label for="schMode">Frequency</label><select id="schMode" name="schMode"><option value="hourly">Every hour</option><option value="every_n_hours">Every N hours</option><option value="daily_time">Daily at...</option><option value="custom_interval">Custom</option></select></div>
<div><label for="schN">Every N hours</label><input id="schN" name="schN" type="number" min="2" value="12"></div>
<div><label for="schTime">Time</label><input id="schTime" name="schTime" type="time" value="03:30"></div>
<div><label for="schCustomValue">Custom interval</label><input id="schCustomValue" name="schCustomValue" type="number" min="15" step="15" value="60"></div>
<div><label for="schCustomUnit">Custom unit</label><select id="schCustomUnit" name="schCustomUnit"><option value="minutes">Minutes</option><option value="hours">Hours</option></select></div>
</div>
<div id="sched_advanced_mount"></div>
</div>
</div>
</div>
</section>
<section class="cw-settings-pane" data-pane="scrobbler">
<div id="sec-scrobbler" class="cw-settings-pane-stack cw-settings-scrobbler-stack" data-accordion="off">
<div id="scrobble-mount" class="cw-settings-pane-stack cw-settings-scrobbler-stack-inner">
<div class="sc2-page">
<div class="cw-settings-pane-head cw-settings-hero cw-settings-hero-scrobbler sc2-pane-head">
<div>
<div class="cw-settings-pane-kicker">Scrobbler</div>
<h3>Webhooks and Watcher</h3>
<p>Receive real time scrobbles via Watcher routes or webhooks. <b>Watcher is recommended</b> Only use both for specific use cases!</p>
</div>
<span class="material-symbols-rounded cw-settings-hero-shape" aria-hidden="true">sensors</span>
</div>
<div class="sc2-empty">Loading Scrobbler...</div>
</div>
</div>
</div>
</section>
<section class="cw-settings-pane cw-app-settings-pane" data-pane="app">
<div class="cw-settings-pane-head cw-app-hero">
<div class="cw-app-hero-copy">
<div class="cw-app-hero-panel active" data-app-hero="ui">
<div class="cw-settings-pane-kicker">UI and Security</div>
<h3>Interface, authentication and Local Tracker</h3>
<p>Shape the experience, lock things down, and manage tracker behavior.</p>
</div>
<div class="cw-app-hero-panel" data-app-hero="security">
<div class="cw-settings-pane-kicker">Security</div>
<h3>Authentication and access controls</h3>
<p>Manage sign-in, sessions, remembered browsers and trusted proxy access.</p>
</div>
<div class="cw-app-hero-panel" data-app-hero="tracker">
<div class="cw-settings-pane-kicker">Local Tracker</div>
<h3>Retention, capture and restore snapshots</h3>
<p>Control local provider snapshots and choose restore defaults per feature.</p>
</div>
</div>
<div class="cw-settings-jumpbar" aria-label="UI settings sections">
<button type="button" class="cw-settings-jump active" data-target="ui" onclick="cwUiSettingsJump?.('ui')">User Interface</button>
<button type="button" class="cw-settings-jump" data-target="security" onclick="cwUiSettingsJump?.('security')">Security</button>
<button type="button" class="cw-settings-jump" data-target="tracker" onclick="cwUiSettingsJump?.('tracker')">Local Tracker</button>
</div>
<span class="material-symbols-rounded cw-app-hero-shape active" data-app-hero-shape="ui" aria-hidden="true">desktop_windows</span>
<span class="material-symbols-rounded cw-app-hero-shape" data-app-hero-shape="security" aria-hidden="true">shield</span>
<span class="material-symbols-rounded cw-app-hero-shape" data-app-hero-shape="tracker" aria-hidden="true">database</span>
</div>
<div class="section open cw-settings-section cw-app-section" id="sec-ui" data-accordion="off">
<div class="head" style="display:flex;align-items:center">
<span class="chev"></span>
<strong>Settings (UI / Security / Local Tracker)</strong>
</div>
<div class="body">
<div class="cw-settings-panels" id="ui_settings_panels">
<!-- Panel: User Interface -->
<div class="cw-settings-panel cw-settings-shell cw-app-panel active" data-tab="ui">
<div class="cw-settings-layout cw-app-ui-layout">
<div class="cw-settings-block cw-app-card cw-app-card-widgets">
<div class="cw-app-card-head">
<span class="material-symbols-rounded cw-app-card-icon" aria-hidden="true">dashboard_customize</span>
<div>
<div class="cw-settings-block-title">Dashboard widgets</div>
<div class="sub">Control which widgets appear on the dashboard.</div>
</div>
</div>
<div class="cw-settings-2col">
<div>
<div class="cw-field-label-row">
<label for="ui_show_watchlist_preview">Watchlist widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Watchlist widget: Shows or hides the dashboard Watchlist card on the Main screen." aria-label="Watchlist widget setting help">help</button>
</div>
<select id="ui_show_watchlist_preview" name="ui_show_watchlist_preview">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_recent_history_widget">Recent history widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent history widget: Shows or hides the Main screen media history widget below Watchlist." aria-label="Recent history widget setting help">help</button>
</div>
<select id="ui_show_recent_history_widget" name="ui_show_recent_history_widget">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_latest_ratings_widget">Latest ratings widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Latest ratings widget: Shows or hides the Main screen latest ratings poster widget below Watchlist." aria-label="Latest ratings widget setting help">help</button>
</div>
<select id="ui_show_latest_ratings_widget" name="ui_show_latest_ratings_widget">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_recent_scrobble_widget">Recent Scrobble widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent Scrobble widget: Shows or hides the Main screen recent scrobble widget below Watchlist." aria-label="Recent Scrobble widget setting help">help</button>
</div>
<select id="ui_show_recent_scrobble_widget" name="ui_show_recent_scrobble_widget">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_recent_progress_widget">Recent Progress widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent Progress widget: Shows or hides the Main screen recent progress sync activity widget." aria-label="Recent Progress widget setting help">help</button>
</div>
<select id="ui_show_recent_progress_widget" name="ui_show_recent_progress_widget">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_recent_playlists_widget">Recent Playlists widget</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent Playlists widget: Shows or hides the Main screen recent playlist sync activity widget." aria-label="Recent Playlists widget setting help">help</button>
</div>
<select id="ui_show_recent_playlists_widget" name="ui_show_recent_playlists_widget">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
</div>
</div>
<div class="cw-settings-block cw-app-card cw-app-card-visibility">
<div class="cw-app-card-head">
<span class="material-symbols-rounded cw-app-card-icon" aria-hidden="true">visibility</span>
<div>
<div class="cw-settings-block-title">Visibility</div>
<div class="sub">Manage what information is displayed in the UI.</div>
</div>
</div>
<div class="cw-settings-2col">
<div>
<div class="cw-field-label-row">
<label for="ui_show_playingcard">Playing card</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Playing card: Shows or hides the currently playing card on the Main screen." aria-label="Playing card setting help">help</button>
</div>
<select id="ui_show_playingcard" name="ui_show_playingcard">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_recent_activity">Recent Scrobble list</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent Scrobble list: Shows or hides the Main screen text list of locally recorded scrobbled movies and episodes." aria-label="Recent Scrobble list setting help">help</button>
</div>
<select id="ui_show_recent_activity" name="ui_show_recent_activity">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_recent_activity_display">Recent Scrobble display</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent Scrobble display: Choose a fixed number of rows, or show items from the last 24, 48, or 72 hours with a maximum of 5 rows." aria-label="Recent Scrobble display setting help">help</button>
</div>
<select id="ui_recent_activity_display" name="ui_recent_activity_display">
<option value="count:3">Last 3 items</option>
<option value="count:4">Last 4 items</option>
<option value="count:5">Last 5 items</option>
<option value="hours:24">Last 24 hours, max 5</option>
<option value="hours:48">Last 48 hours, max 5</option>
<option value="hours:72">Last 72 hours, max 5</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_recent_syncs_display">Recent syncs display</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Recent syncs display: Choose a fixed number of rows, or show runs from the last 24, 48, or 72 hours with a maximum of 5 rows." aria-label="Recent syncs display setting help">help</button>
</div>
<select id="ui_recent_syncs_display" name="ui_recent_syncs_display">
<option value="count:3">Last 3 items</option>
<option value="count:4">Last 4 items</option>
<option value="count:5">Last 5 items</option>
<option value="hours:24">Last 24 hours, max 5</option>
<option value="hours:48">Last 48 hours, max 5</option>
<option value="hours:72">Last 72 hours, max 5</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_quick_add_desktop">Desktop quick add</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Desktop quick add: Shows or hides the quick-add control on larger screens." aria-label="Desktop quick add setting help">help</button>
</div>
<select id="ui_show_quick_add_desktop" name="ui_show_quick_add_desktop">
<option value="true">Show</option>
<option value="false">Hide</option>
</select>
</div>
<div>
<div class="cw-field-label-row">
<label for="ui_show_quick_add_mobile">Mobile quick add</label>
<button type="button" class="cw-field-help material-symbols-rounded" title="Mobile quick add: Shows or hides the compact quick-add control on mobile layouts." aria-label="Mobile quick add setting help">help</button>
</div>