Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove legacy apiOrigin migration

Manav Rathi5fd0b4675643
diff --git a/web/packages/base/origins.ts b/web/packages/base/origins.ts
index 8c39396fb2..d1474014a3 100644
--- a/web/packages/base/origins.ts
+++ b/web/packages/base/origins.ts
@@ -1,5 +1,4 @@
-import { getKV, setKV } from "@/base/kv";
-import { inWorker } from "./env";
+import { getKV } from "@/base/kv";
/**
* Return the origin (scheme, host, port triple) that should be used for making
@@ -35,21 +34,10 @@ export const apiURL = async (path: string) => (await apiOrigin()) + path;
*
* Otherwise return undefined.
*/
-export const customAPIOrigin = async () => {
- let origin = await getKV("apiOrigin");
- if (!origin && !inWorker()) {
- // TODO: Migration of apiOrigin from local storage to indexed DB. Added
- // 27 June 2024, 1.7.2-rc. Remove me after a bit (tag: Migration).
- const legacyOrigin = localStorage.getItem("apiOrigin");
- if (legacyOrigin !== null) {
- origin = legacyOrigin;
- if (origin) await setKV("apiOrigin", origin);
- localStorage.removeItem("apiOrigin");
- }
- }
-
- return origin ?? process.env.NEXT_PUBLIC_ENTE_ENDPOINT ?? undefined;
-};
+export const customAPIOrigin = async () =>
+ (await getKV("apiOrigin")) ??
+ process.env.NEXT_PUBLIC_ENTE_ENDPOINT ??
+ undefined;
/**
* A convenience wrapper over {@link customAPIOrigin} that returns the only the
diff --git a/web/packages/new/photos/components/DevSettings.tsx b/web/packages/new/photos/components/DevSettings.tsx
index 2e3b1b3978..33da3a7373 100644
--- a/web/packages/new/photos/components/DevSettings.tsx
+++ b/web/packages/new/photos/components/DevSettings.tsx
@@ -69,17 +69,7 @@ const Contents: React.FC<ContentsProps> = (props) => {
>();
useEffect(
- () =>
- void getKV("apiOrigin").then((o) =>
- setInitialAPIOrigin(
- // Migrate apiOrigin from local storage to indexed DB.
- //
- // This code was added 27 June 2024. Note that the legacy
- // value was never in production builds, only nightlies, so
- // this code can be removed soon (tag: Migration).
- o ?? localStorage.getItem("apiOrigin") ?? "",
- ),
- ),
+ () => void getKV("apiOrigin").then((o) => setInitialAPIOrigin(o ?? "")),
[],
);
@@ -219,12 +209,6 @@ const Form: React.FC<FormProps> = ({ initialAPIOrigin, onClose }) => {
const updateAPIOrigin = async (origin: string) => {
if (!origin) {
await removeKV("apiOrigin");
- // Migrate apiOrigin from local storage to indexed DB.
- //
- // This code was added 27 June 2024. Note that the legacy value was
- // never in production builds, only nightlies, so this code can be
- // removed at some point soon (tag: Migration).
- localStorage.removeItem("apiOrigin");
return;
}