fix(seerr): migrate legacy Jellyseerr settings and storage keys

The Jellyseerr -> Seerr rebrand renamed the settings property
(jellyseerrServerUrl -> seerrServerUrl) and the MMKV storage keys
(JELLYSEERR_USER/COOKIES -> SEERR_USER/COOKIES). Without migration,
users who configured Seerr before the rename lose their server URL and
are silently logged out on update.

Adds one-time migrations: loadSettings copies the legacy property, and
useSeerr migrates the storage keys at module load before the user atom
is read.
This commit is contained in:
Uruk
2026-05-22 01:43:50 +02:00
parent da3654ec4a
commit 9cc119894f
2 changed files with 42 additions and 0 deletions

View File

@@ -304,6 +304,19 @@ const loadSettings = (): Partial<Settings> => {
const loadedValues: Partial<Settings> =
jsonValue != null ? JSON.parse(jsonValue) : {};
// Migration: jellyseerrServerUrl -> seerrServerUrl (renamed in the Seerr rebrand).
// Without this, users who configured Seerr before the rename lose their server URL.
const legacy = loadedValues as Partial<Settings> & {
jellyseerrServerUrl?: string;
};
if (legacy.jellyseerrServerUrl !== undefined) {
if (legacy.seerrServerUrl === undefined) {
legacy.seerrServerUrl = legacy.jellyseerrServerUrl;
}
delete legacy.jellyseerrServerUrl;
storage.set("settings", JSON.stringify(loadedValues));
}
return loadedValues;
} catch (error) {
console.error("Failed to load settings:", error);