π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Handle the API quirk
Manav Rathibc45261efac7
diff --git a/web/packages/new/photos/services/remote-store.ts b/web/packages/new/photos/services/remote-store.tsindex ac4d6941a6..621db2c630 100644--- a/web/packages/new/photos/services/remote-store.ts+++ b/web/packages/new/photos/services/remote-store.ts@@ -5,11 +5,11 @@ import { z } from "zod";/*** Fetch the value for the given {@link key} from remote store.*- * If the key is not present in the remote store, return `undefined`.+ * If the key is not present in the remote store, return {@link defaultValue}.*/-export const getRemoteValue = async (key: string) => {+export const getRemoteValue = async (key: string, defaultValue: string) => {const url = await apiURL("/remote-store");- const params = new URLSearchParams({ key });+ const params = new URLSearchParams({ key, defaultValue });const res = await fetch(`${url}?${params.toString()}`, {headers: await authenticatedRequestHeaders(),});@@ -23,7 +23,7 @@ const GetRemoteStoreResponse = z.object({ value: z.string() }).nullable();* Convenience wrapper over {@link getRemoteValue} that returns booleans.*/export const getRemoteFlag = async (key: string) =>- (await getRemoteValue(key)) == "true";+ (await getRemoteValue(key, "false")) == "true";/*** Update or insert {@link value} for the given {@link key} into remote store.