Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tighten public memory routing

Anand Baburajand465eb0f9e86
diff --git a/web/apps/memories/src/components/PublicMemoryViewerShared.tsx b/web/apps/memories/src/components/PublicMemoryViewerShared.tsx
index eaa95433e0..93ea8f7b36 100644
--- a/web/apps/memories/src/components/PublicMemoryViewerShared.tsx
+++ b/web/apps/memories/src/components/PublicMemoryViewerShared.tsx
@@ -70,8 +70,8 @@ const LANE_DESKTOP_CARD_MIN_WIDTH_PX = 280;
const MEDIA_SWITCH_TRANSITION_DURATION_MS = 380;
const DESKTOP_MEDIA_MAX_WIDTH_CSS = `min(${DESKTOP_MEDIA_MAX_WIDTH_PX}px, calc(100vw - ${DESKTOP_MEDIA_HORIZONTAL_PADDING_PX}px))`;
const DESKTOP_MEDIA_MAX_HEIGHT_CSS = `calc(min(100vh, 100dvh) - ${DESKTOP_MEDIA_VERTICAL_RESERVED_PX}px)`;
-const DESKTOP_BACKGROUND_IMAGE_PATH = "/images/desktop-bg.svg";
-const MOBILE_BACKGROUND_IMAGE_PATH = "/images/mobile-bg.svg";
+const DESKTOP_BACKGROUND_IMAGE_PATH = "/images/memory-lane-bg-desktop.svg";
+const MOBILE_BACKGROUND_IMAGE_PATH = "/images/memory-lane-bg-mobile.svg";
const ENTE_BRAND_TAG_IMAGE_PATH = "/images/ente-brand-tag.svg";
const LANE_GRID_CELL_SIZE_PX = 80;
const LANE_GRID_LINE_COLOR = "#08c225";
diff --git a/web/apps/memories/src/utils/public-memory-url.ts b/web/apps/memories/src/utils/public-memory-url.ts
index 94df9fb51a..68d01b1a54 100644
--- a/web/apps/memories/src/utils/public-memory-url.ts
+++ b/web/apps/memories/src/utils/public-memory-url.ts
@@ -27,21 +27,19 @@ export const extractAccessTokenFromURL = (url: URL): string | null => {
return tokenFromQuery;
}
- // Support:
- // - /<TOKEN>#<SECRET>
- // - /memory/<TOKEN>#<SECRET>
- // - /memories/<TOKEN>#<SECRET>
- // while treating bare /memory and /memories as no-token landing routes.
- const routePrefixes = new Set(["memory", "memories"]);
const pathSegments = url.pathname
.split("/")
.filter((segment) => segment.length > 0);
- for (let i = pathSegments.length - 1; i >= 0; i--) {
- const segment = pathSegments[i]!;
- if (!routePrefixes.has(segment.toLowerCase())) {
- return segment;
- }
+ if (pathSegments.length !== 1) {
+ return null;
}
- return null;
+ const [segment] = pathSegments;
+ if (!segment) {
+ return null;
+ }
+
+ return ["memory", "memories"].includes(segment.toLowerCase())
+ ? null
+ : segment;
};
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 67669acde5..8c8bdb989e 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -112,14 +112,10 @@ const Page: React.FC = () => {
}
const albumsURL = new URL(albumsAppOrigin());
- const isMemoryRoute =
- currentURL.pathname === "/memory" ||
- currentURL.pathname.startsWith("/memory/");
if (
(shouldOnlyServeAlbumsApp ||
currentURL.host == albumsURL.host) &&
- currentURL.pathname != "/shared-albums" &&
- !isMemoryRoute
+ currentURL.pathname != "/shared-albums"
) {
const [hash] = currentURL.hash.slice(1).split("&", 1);
await router.replace({