Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mnvr committed Nov 5, 2024
1 parent 448a878 commit 4f0ba47
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions web/packages/new/photos/services/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,20 @@ const saveCFProxyDisabled = (v: boolean) =>
: localStorage.removeItem(cfProxyDisabledKey);

const savedCFProxyDisabled = () => {
const json = localStorage.getItem(cfProxyDisabledKey);
if (!json) return false;
if (json == "1") return true;
const v = localStorage.getItem(cfProxyDisabledKey);
if (!v) return false;
if (v == "1") return true;

// Older versions of the app used to store this flag in a different
// format, so see if this is one of those, and if so, migrate it too.
try {
const value = z.object({ value: z.boolean() }).parse(json).value;
const value = z
.object({ value: z.boolean() })
.parse(JSON.parse(v)).value;
saveCFProxyDisabled(value);
return value;
} catch (e) {
log.warn(`Ignoring ${cfProxyDisabledKey} value: ${json}`, e);
log.warn(`Ignoring ${cfProxyDisabledKey} value: ${v}`, e);
localStorage.removeItem(cfProxyDisabledKey);
return false;
}
Expand Down

0 comments on commit 4f0ba47

Please sign in to comment.