mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 01:22:56 +01:00
feat(tv): add Jellyseerr connect support on TV (incl. Apple TV)
Adds the missing piece for Jellyseerr on TV: a way to configure and connect to a Jellyseerr server from the TV settings screen. The discover and search UI, native tvOS search field, and post-login auto-connect already existed on develop, but there was no TV-side connect/disconnect flow — so seerr could never be enabled on Apple TV. - settings.tv.tsx: new "seerr" section with server URL + password inputs and Connect/Disconnect (respects plugin-locked server URLs) - useJellyseerr: add validateJellyseerrSession(); clear cached search results on disconnect - search: prompt to connect when a server is configured but no session exists, and warn when the session has expired on Discover - translations: add connect/session keys to en + sv All additions are platform-agnostic React Native, so they work on both Apple TV and Android TV. Ported from #1676 (which was 40 commits behind develop and conflicting); the unrelated Android tv-recommendations changes from that PR were intentionally left out. Co-authored-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Claude-Session: https://claude.ai/code/session_016Hhu5DruGLPhdP4LAoy1Xd
This commit is contained in:
@@ -70,6 +70,35 @@ export const clearJellyseerrStorageData = () => {
|
||||
storage.remove(JELLYSEERR_COOKIES);
|
||||
};
|
||||
|
||||
export type JellyseerrSessionStatus =
|
||||
| { valid: true }
|
||||
| { valid: false; reason: "no_session" | "expired" };
|
||||
|
||||
/**
|
||||
* Checks whether the persisted Jellyseerr session (user + cookies) is still
|
||||
* valid by hitting the server status endpoint. Clears local session data if the
|
||||
* request fails (expired/revoked cookie).
|
||||
*/
|
||||
export async function validateJellyseerrSession(
|
||||
serverUrl: string,
|
||||
): Promise<JellyseerrSessionStatus> {
|
||||
const user = storage.get<JellyseerrUser>(JELLYSEERR_USER);
|
||||
const cookies = storage.get<string[]>(JELLYSEERR_COOKIES);
|
||||
|
||||
if (!user || !cookies) {
|
||||
return { valid: false, reason: "no_session" };
|
||||
}
|
||||
|
||||
try {
|
||||
const api = new JellyseerrApi(serverUrl);
|
||||
await api.axios.get(Endpoints.API_V1 + Endpoints.STATUS);
|
||||
return { valid: true };
|
||||
} catch {
|
||||
clearJellyseerrStorageData();
|
||||
return { valid: false, reason: "expired" };
|
||||
}
|
||||
}
|
||||
|
||||
export enum Endpoints {
|
||||
STATUS = "/status",
|
||||
API_V1 = "/api/v1",
|
||||
@@ -450,7 +479,8 @@ export const useJellyseerr = () => {
|
||||
clearJellyseerrStorageData();
|
||||
setJellyseerrUser(undefined);
|
||||
updateSettings({ jellyseerrServerUrl: undefined });
|
||||
}, []);
|
||||
queryClient.removeQueries({ queryKey: ["search", "jellyseerr"] });
|
||||
}, [queryClient]);
|
||||
|
||||
const requestMedia = useCallback(
|
||||
(title: string, request: MediaRequestBody, onSuccess?: () => void) => {
|
||||
|
||||
Reference in New Issue
Block a user