diff --git a/src/api.ts b/src/api.ts index 5658968..a1ee282 100644 --- a/src/api.ts +++ b/src/api.ts @@ -262,17 +262,22 @@ const getRequestStatus = async ( .catch(err => Promise.reject(err)); }; -/* -const watchLink = async (title, year) => { +const watchLink = async (title: string, year: string) => { const url = new URL("/api/v1/plex/watch-link", API_HOSTNAME); url.searchParams.append("title", title); url.searchParams.append("year", year); - return fetch(url.href) + const options: RequestInit = { + headers: { "Content-Type": "application/json" }, + credentials: "include" + }; + + return fetch(url.href, options) .then(resp => resp.json()) .then(response => response.link); }; +/* const movieImages = id => { const url = new URL(`v2/movie/${id}/images`, API_HOSTNAME); @@ -560,6 +565,7 @@ export { getSettings, updateSettings, fetchGraphData, + watchLink, getEmoji, elasticSearchMoviesAndShows }; diff --git a/src/components/Graph.vue b/src/components/Graph.vue index 1d4be69..c0a9792 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -1,9 +1,11 @@ - + diff --git a/src/components/admin/TorrentManagementGrid.vue b/src/components/admin/TorrentManagementGrid.vue index 21a54aa..73049cc 100644 --- a/src/components/admin/TorrentManagementGrid.vue +++ b/src/components/admin/TorrentManagementGrid.vue @@ -36,19 +36,19 @@ sortDirection === "asc" ? "↑" : "↓" }} - + Size {{ sortDirection === "asc" ? "↑" : "↓" }} - + Seeders {{ sortDirection === "asc" ? "↑" : "↓" }} - Status + Status Actions @@ -58,10 +58,23 @@ :key="torrent.id" :class="{ processing: torrent.processing }" > - {{ torrent.name }} - {{ torrent.size }} - {{ torrent.seeders }} - + +
{{ torrent.name }}
+
+ {{ torrent.size }} + + {{ torrent.seeders }} seeders + + + {{ torrent.status }} + +
+ + {{ torrent.size }} + {{ torrent.seeders }} + {{ torrent.status }} @@ -116,7 +129,7 @@ diff --git a/src/components/plex/PlexLibraryModal.vue b/src/components/plex/PlexLibraryModal.vue index 6bbf434..88651c8 100644 --- a/src/components/plex/PlexLibraryModal.vue +++ b/src/components/plex/PlexLibraryModal.vue @@ -78,7 +78,7 @@ diff --git a/src/utils/commandTracking.ts b/src/utils/commandTracking.ts index bc81502..dd22afe 100644 --- a/src/utils/commandTracking.ts +++ b/src/utils/commandTracking.ts @@ -6,9 +6,7 @@ interface CommandData { } interface CommandStats { - commands: { - [key: string]: CommandData; - }; + commands: Record; version: number; } @@ -24,6 +22,7 @@ function getStats(): CommandStats { const parsed = JSON.parse(stored) as CommandStats; return parsed; } catch (error) { + // eslint-disable-next-line no-console console.error("Failed to parse command stats:", error); return { commands: {}, version: CURRENT_VERSION }; } @@ -33,6 +32,7 @@ function saveStats(stats: CommandStats): void { try { localStorage.setItem(STORAGE_KEY, JSON.stringify(stats)); } catch (error) { + // eslint-disable-next-line no-console console.error("Failed to save command stats:", error); } } @@ -53,7 +53,7 @@ export function trackCommand( }; } - stats.commands[id].count++; + stats.commands[id].count += 1; stats.commands[id].lastUsed = new Date().toISOString(); if (metadata?.routePath) { @@ -80,9 +80,7 @@ export function getCommandScore(commandId: string): number { return command.count * 0.7 + recencyBonus * 0.3; } -export function getTopCommands( - limit = 10 -): Array<{ id: string; score: number }> { +export function getTopCommands(limit = 10): { id: string; score: number }[] { const stats = getStats(); const scored = Object.keys(stats.commands).map(id => ({ diff --git a/src/utils/plexHelpers.ts b/src/utils/plexHelpers.ts index 228c152..226b9dd 100644 --- a/src/utils/plexHelpers.ts +++ b/src/utils/plexHelpers.ts @@ -79,10 +79,8 @@ export function processLibraryItem( } } // For movies and other types, use thumb - else { - if (item.thumb) { - posterUrl = `${serverUrl}${item.thumb}?X-Plex-Token=${authToken}`; - } + else if (item.thumb) { + posterUrl = `${serverUrl}${item.thumb}?X-Plex-Token=${authToken}`; } // Build Plex Web App URL @@ -120,7 +118,8 @@ export function processLibraryItem( ...baseItem, episodes: item.leafCount || 0 }; - } else if (libraryType === "music") { + } + if (libraryType === "music") { return { ...baseItem, artist: item.parentTitle || "Unknown Artist", @@ -166,7 +165,7 @@ export function calculateDuration(metadata: any[], libraryType: string) { }); const hours = Math.round(totalDuration / (1000 * 60 * 60)); - const formattedDuration = hours.toLocaleString() + " hours"; + const formattedDuration = `${hours.toLocaleString()} hours`; return { totalDuration: formattedDuration,