refactor: remove dead code across server, templ pages, and client modules
Deadcode-verified removals (RTA reachability from main, cross-checked with -test and textual xrefs): Go server: - whole files: middleware/transaction.go, middleware/error_handler.go, middleware/password_validator.go (live registration machinery kept), handlers/sync.go, sync/offline.go - unrouted endpoints: auth UpdateUsername/UpdateEmail, timezone settings handler, OPDS RegisterOPDS, Kobo LibrarySync handler, ReaderHandler.ShowReader, JSON-data twins on collections/library - duplicate book-matching handlers (book_matching.go Handler twins, matching.go MatchingHandler twins), superseded helpers (router.parseUUID, handlers.ValidateDeviceToken, normalizePath, userExists, generateLockID) Templ/client: - never-routed pages: api_explorer.templ, queue.templ and their client modules api-explorer.ts, api-explorer-docs.ts, queue.ts - fully orphaned wrapper modules events.ts, dom.ts - broken clearSyncQueue (called a nonexistent endpoint) and the hidden, never-populated sync-queue section on the devices page - 166+ unused exports demoted to private (knip-verified); ~85 truly dead declarations removed via tsc noUnusedLocals fixpoint - stale 'interactive API Explorer' claims dropped from docs The docs drift-gate package (internal/docs), templ-bound modules (dashboard, stats, header, index, login, profile*, bookshelf, collections, toast-error), sqlc-generated code, and web/static are intentionally untouched.
This commit is contained in:
1 parent
8733e83f1f
commit
8631aa00bf
107 files changed
+689
-3443
No files matched your search
+4
-12
@@ -60,12 +60,12 @@ type AudioChapter = { index: number; title: string; start: number; end: number }
|
||||
// layouts) carry several; single-file books carry exactly one spanning
|
||||
// the whole file. start/end are GLOBAL seconds — the same coordinate
|
||||
// system as chapters, bookmarks and audio_offset_seconds.
|
||||
export type AudioTrack = { url: string; start: number; end: number; title?: string };
|
||||
type AudioTrack = { url: string; start: number; end: number; title?: string };
|
||||
|
||||
// trackIndexFor finds the track holding a global position: the last one
|
||||
// whose start is at or before it (zero-duration/unknown-end tracks keep
|
||||
// working because only start matters for membership).
|
||||
export function trackIndexFor(tracks: AudioTrack[], globalSeconds: number): number {
|
||||
function trackIndexFor(tracks: AudioTrack[], globalSeconds: number): number {
|
||||
for (let i = tracks.length - 1; i > 0; i -= 1) {
|
||||
if (globalSeconds >= tracks[i].start) return i;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export function trackIndexFor(tracks: AudioTrack[], globalSeconds: number): numb
|
||||
}
|
||||
|
||||
// localOffsetFor converts a global position to seconds within track i.
|
||||
export function localOffsetFor(tracks: AudioTrack[], index: number, globalSeconds: number): number {
|
||||
function localOffsetFor(tracks: AudioTrack[], index: number, globalSeconds: number): number {
|
||||
const track = tracks[index];
|
||||
if (!track) return Math.max(0, globalSeconds);
|
||||
return Math.max(0, globalSeconds - track.start);
|
||||
@@ -81,11 +81,7 @@ export function localOffsetFor(tracks: AudioTrack[], index: number, globalSecond
|
||||
|
||||
// globalSecondsFor converts (track i, local seconds) back to the global
|
||||
// position — the inverse of localOffsetFor.
|
||||
export function globalSecondsFor(
|
||||
tracks: AudioTrack[],
|
||||
index: number,
|
||||
localSeconds: number,
|
||||
): number {
|
||||
function globalSecondsFor(tracks: AudioTrack[], index: number, localSeconds: number): number {
|
||||
const track = tracks[index];
|
||||
return (track ? track.start : 0) + Math.max(0, localSeconds);
|
||||
}
|
||||
@@ -1434,8 +1430,4 @@ Alpine.data("audioReader", () => ({
|
||||
this.pushProgress();
|
||||
}, PROGRESS_INTERVAL_MS);
|
||||
},
|
||||
|
||||
fmtTime,
|
||||
}));
|
||||
|
||||
export { fmtTime };
|
||||
Reference in new issue
Block a user