Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(web): use configurable memories app origin

AmanRajSinghMourya039116d818a9
diff --git a/web/apps/memories/src/pages/index.tsx b/web/apps/memories/src/pages/index.tsx
index 2c828436d5..7423377276 100644
--- a/web/apps/memories/src/pages/index.tsx
+++ b/web/apps/memories/src/pages/index.tsx
@@ -11,7 +11,7 @@ import { usePublicMemoryPage } from "../hooks/usePublicMemoryPage";
/**
* Index page that handles both root redirect and memory share links
*
- * - Root domain (/) redirects to ente.io/memories
+ * - Root domain (/) redirects to the configured memories landing page
* - Share links (/TOKEN#key) render the memory viewer
*
* This page is served for all routes via:
diff --git a/web/apps/memories/src/services/public-memory-page.ts b/web/apps/memories/src/services/public-memory-page.ts
index f786af2de6..2c71b10162 100644
--- a/web/apps/memories/src/services/public-memory-page.ts
+++ b/web/apps/memories/src/services/public-memory-page.ts
@@ -1,5 +1,6 @@
import { isHTTPErrorWithStatus } from "ente-base/http";
import log from "ente-base/log";
+import { memoriesAppOrigin } from "ente-base/origins";
import type { EnteFile } from "ente-media/file";
import {
decryptMemoryShareMetadata,
@@ -39,7 +40,7 @@ export const loadPublicMemoryPage = async (
if (!accessToken) {
return {
kind: "redirect",
- redirectURL: "https://ente.io/memories",
+ redirectURL: memoriesAppOrigin(),
};
}
diff --git a/web/packages/base/origins.ts b/web/packages/base/origins.ts
index f946dc923e..43c4e5fb8d 100644
--- a/web/packages/base/origins.ts
+++ b/web/packages/base/origins.ts
@@ -121,6 +121,17 @@ export const isCustomShareAppOrigin =
export const shareAppOrigin = (): string =>
process.env.NEXT_PUBLIC_ENTE_SHARE_ENDPOINT ?? "https://share.ente.io";
+/**
+ * Return the origin/path that serves the memories app landing experience.
+ *
+ * Defaults to our production memories landing page, "https://ente.io/memories",
+ * but can be overridden by setting the `NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT`
+ * environment variable.
+ */
+export const memoriesAppOrigin = (): string =>
+ process.env.NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT ??
+ "https://ente.io/memories";
+
/**
* Return the origin that serves the photos app.
*
@@ -130,22 +141,3 @@ export const shareAppOrigin = (): string =>
*/
export const photosAppOrigin = (): string =>
process.env.NEXT_PUBLIC_ENTE_PHOTOS_ENDPOINT ?? "https://web.ente.io";
-
-/**
- * Return the origin that serves public memory shares.
- *
- * Defaults to our production instance, "https://memories.ente.io", but can be
- * overridden by setting the `NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT` environment
- * variable. For self-hosted setups, this can be set to the custom API origin.
- */
-export const memoryHost = async (): Promise<string> => {
- const custom = await customAPIOrigin();
- if (custom) {
- // For self-hosted, point to the custom API with the memories path
- return `${custom}/memories`;
- }
- return (
- process.env.NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT ??
- "https://memories.ente.io"
- );
-};
diff --git a/web/packages/gallery/services/download.ts b/web/packages/gallery/services/download.ts
index fa027178df..a6b9016658 100644
--- a/web/packages/gallery/services/download.ts
+++ b/web/packages/gallery/services/download.ts
@@ -118,11 +118,6 @@ class DownloadManager {
* context of the public memory share app.
*/
publicMemoryCredentials: PublicMemoryCredentials | undefined;
- /**
- * Access token for downloading files when we're in the context of a
- * public memory share.
- */
- publicMemoryAccessToken: string | undefined;
/**
* Local cache for thumbnail blobs.
*
@@ -203,7 +198,6 @@ class DownloadManager {
logout() {
this.publicAlbumsCredentials = undefined;
this.publicMemoryCredentials = undefined;
- this.publicMemoryAccessToken = undefined;
this.thumbnailURLPromises.clear();
this.fileURLPromises.clear();
this.renderableSourceURLPromises.clear();
@@ -229,7 +223,6 @@ class DownloadManager {
credentials: PublicMemoryCredentials | undefined,
) {
this.publicMemoryCredentials = credentials;
- this.publicMemoryAccessToken = credentials?.accessToken;
}
/**