mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-22 14:56:38 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user