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
This commit is contained in:
2026-03-11 00:04:24 +01:00
parent 1e9077a819
commit 604cada126
4 changed files with 21 additions and 3 deletions

View File

@@ -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 // .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<IList> => {
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. // Fetches requested items.
const getRequests = async (page = 1) => { const getRequests = async (page = 1) => {
const url = new URL("/api/v2/request", API_HOSTNAME); const url = new URL("/api/v2/request", API_HOSTNAME);
@@ -565,6 +576,7 @@ export {
getShowCredits, getShowCredits,
getPersonCredits, getPersonCredits,
getTmdbMovieListByName, getTmdbMovieListByName,
getTmdbMovieDiscoverByName,
searchTmdb, searchTmdb,
getUserRequests, getUserRequests,
getRequests, getRequests,

View File

@@ -147,6 +147,7 @@
import IconMagnet from "@/icons/IconMagnet.vue"; import IconMagnet from "@/icons/IconMagnet.vue";
import IconProfileLock from "@/icons/IconProfileLock.vue"; import IconProfileLock from "@/icons/IconProfileLock.vue";
import IconShow from "@/icons/IconShow.vue"; import IconShow from "@/icons/IconShow.vue";
import IconBinoculars from "@/icons/IconBinoculars.vue";
import { elasticSearchMoviesAndShows } from "@/api"; import { elasticSearchMoviesAndShows } from "@/api";
import type { IAutocompleteResult } from "@/interfaces/IAutocompleteSearch"; import type { IAutocompleteResult } from "@/interfaces/IAutocompleteSearch";
import { trackCommand, getCommandScore } from "@/utils/commandTracking"; import { trackCommand, getCommandScore } from "@/utils/commandTracking";
@@ -180,6 +181,10 @@
} }
> = { > = {
home: { icon: IconMovie, description: "Browse movies and TV shows" }, 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" }, activity: { icon: IconActivity, description: "View Plex server activity" },
profile: { icon: IconProfile, description: "Manage your profile" }, profile: { icon: IconProfile, description: "Manage your profile" },
"requests-list": null, "requests-list": null,

View File

@@ -29,7 +29,7 @@
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import IconKey from "@/icons/IconKey.vue"; import IconKey from "@/icons/IconKey.vue";
import IconEmail from "@/icons/IconEmail.vue"; import IconEmail from "@/icons/IconEmail.vue";
import IconBinoculars from "@/icons/IconBinoculars.vue"; import IconSearch from "@/icons/IconSearch.vue";
import type { Ref } from "vue"; import type { Ref } from "vue";
interface Props { interface Props {
@@ -53,7 +53,7 @@
const inputIcon = computed(() => { const inputIcon = computed(() => {
if (props.type === "password") return IconKey; if (props.type === "password") return IconKey;
if (props.type === "email") return IconEmail; if (props.type === "email") return IconEmail;
if (props.type === "torrents") return IconBinoculars; if (props.type === "torrents") return IconSearch;
return false; return false;
}); });

View File

@@ -91,7 +91,8 @@ export function usePlexAuth() {
function setPlexAuthCookie(authToken: string) { function setPlexAuthCookie(authToken: string) {
const expires = new Date(); const expires = new Date();
expires.setDate(expires.getDate() + 30); 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 // Get cookie