From 604cada12695a1f17bb3e544780fba31464f243e Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Wed, 11 Mar 2026 00:04:24 +0100 Subject: [PATCH] API & Navigation Updates Add discover API endpoint, update command palette, and fix Plex auth - Add getTmdbMovieDiscoverByName() function to api.ts for discover categories - Add discover route to command palette with IconBinoculars and description - Replace IconBinoculars with IconSearch for torrent search input in SeasonedInput - Fix Plex auth cookie to include domain attribute for cross-subdomain support --- src/api.ts | 12 ++++++++++++ src/components/ui/CommandPalette.vue | 5 +++++ src/components/ui/SeasonedInput.vue | 4 ++-- src/composables/usePlexAuth.ts | 3 ++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/api.ts b/src/api.ts index 3deb5da..6d5b179 100644 --- a/src/api.ts +++ b/src/api.ts @@ -135,6 +135,17 @@ const getTmdbMovieListByName = async ( // .catch(error => { console.error(`api error getting list: ${name}, page: ${page}`); throw error }) // eslint-disable-line no-console }; +const getTmdbMovieDiscoverByName = async ( + name: string, + page = 1 +): Promise => { + const url = new URL(`/api/v2/movie/discover/${name}`, API_HOSTNAME); + url.searchParams.append("page", page.toString()); + + return fetch(url.href).then(resp => resp.json()); + // .catch(error => { console.error(`api error getting list: ${name}, page: ${page}`); throw error }) // eslint-disable-line no-console +}; + // Fetches requested items. const getRequests = async (page = 1) => { const url = new URL("/api/v2/request", API_HOSTNAME); @@ -565,6 +576,7 @@ export { getShowCredits, getPersonCredits, getTmdbMovieListByName, + getTmdbMovieDiscoverByName, searchTmdb, getUserRequests, getRequests, diff --git a/src/components/ui/CommandPalette.vue b/src/components/ui/CommandPalette.vue index f0a2684..a6f150d 100644 --- a/src/components/ui/CommandPalette.vue +++ b/src/components/ui/CommandPalette.vue @@ -147,6 +147,7 @@ import IconMagnet from "@/icons/IconMagnet.vue"; import IconProfileLock from "@/icons/IconProfileLock.vue"; import IconShow from "@/icons/IconShow.vue"; + import IconBinoculars from "@/icons/IconBinoculars.vue"; import { elasticSearchMoviesAndShows } from "@/api"; import type { IAutocompleteResult } from "@/interfaces/IAutocompleteSearch"; import { trackCommand, getCommandScore } from "@/utils/commandTracking"; @@ -180,6 +181,10 @@ } > = { home: { icon: IconMovie, description: "Browse movies and TV shows" }, + discover: { + icon: IconBinoculars, + description: "Discover movies by category" + }, activity: { icon: IconActivity, description: "View Plex server activity" }, profile: { icon: IconProfile, description: "Manage your profile" }, "requests-list": null, diff --git a/src/components/ui/SeasonedInput.vue b/src/components/ui/SeasonedInput.vue index 9d32a1f..264ee74 100644 --- a/src/components/ui/SeasonedInput.vue +++ b/src/components/ui/SeasonedInput.vue @@ -29,7 +29,7 @@ import { ref, computed } from "vue"; import IconKey from "@/icons/IconKey.vue"; import IconEmail from "@/icons/IconEmail.vue"; - import IconBinoculars from "@/icons/IconBinoculars.vue"; + import IconSearch from "@/icons/IconSearch.vue"; import type { Ref } from "vue"; interface Props { @@ -53,7 +53,7 @@ const inputIcon = computed(() => { if (props.type === "password") return IconKey; if (props.type === "email") return IconEmail; - if (props.type === "torrents") return IconBinoculars; + if (props.type === "torrents") return IconSearch; return false; }); diff --git a/src/composables/usePlexAuth.ts b/src/composables/usePlexAuth.ts index ea29b53..d78155e 100644 --- a/src/composables/usePlexAuth.ts +++ b/src/composables/usePlexAuth.ts @@ -91,7 +91,8 @@ export function usePlexAuth() { function setPlexAuthCookie(authToken: string) { const expires = new Date(); expires.setDate(expires.getDate() + 30); - document.cookie = `plex_auth_token=${authToken}; path=/; expires=${expires.toUTCString()}; SameSite=Strict`; + const domain = window.location.hostname; + document.cookie = `plex_auth_token=${authToken}; domain=.${domain}; path=/; expires=${expires.toUTCString()}; SameSite=Strict`; } // Get cookie