π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor Trip album redirect logic and clarify pre-commit guidelines
anandbaburajan54d4e1396194
diff --git a/web/CLAUDE.md b/web/CLAUDE.mdindex 7d9dce5ba0..8757afa74a 100644--- a/web/CLAUDE.md+++ b/web/CLAUDE.md@@ -9,7 +9,7 @@ When making commits, follow these rules:- NO emojis- NO promotional text or links (except Co-Authored-By line)- Use ONLY "Co-Authored-By: Claude <[email protected]>" for attribution-- Run pre-commit checks (format, lint, typecheck, build) before committing+- ONLY run pre-commit checks (format, lint, typecheck, build) when explicitly creating a commit## Commands@@ -34,7 +34,10 @@ yarn build:embed # Embed appyarn build:accounts # Accounts appyarn build:cast # Cast app-# Code quality - ALWAYS run before committing+# Code quality - ONLY run when:+# 1. Explicitly requested by user+# 2. Before creating a commit (pre-commit)+# DO NOT run automatically after file modificationsyarn lint # Check formatting, linting, and TypeScript typesyarn lint-fix # Auto-fix linting and formatting issues```@@ -76,7 +79,7 @@ web/## Important Notes-- Always run `yarn lint` before committing changes+- Always run `yarn lint` when explicitly requested or before committing (but not after file modifications)- Use Yarn (not npm) for package management- Respect the monorepo structure - shared code goes in packages/- Follow existing Material-UI theming patternsdiff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 0b15c75357..442e22ea21 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -55,7 +55,6 @@ import {type PublicAlbumsCredentials,} from "ente-base/http";import log from "ente-base/log";-import { albumsAppOrigin, shouldOnlyServeAlbumsApp } from "ente-base/origins";import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";import {useSaveGroups,@@ -149,6 +148,28 @@ export default function PublicCollectionGallery() {cancel: false,});+ /**+ * Check if we need to redirect Trip albums from custom domains to albums.ente.io+ * Returns true if a redirect was initiated, false otherwise.+ * Reason: custom domains do not support the Trip layout fully+ */+ const checkAndRedirectForTripAlbum = (collection: Collection): boolean => {+ if (collection.pubMagicMetadata?.data.layout === "trip") {+ const currentURL = new URL(window.location.href);+ const albumsURL = new URL("https://albums.ente.io");++ if (currentURL.host !== albumsURL.host) {+ albumsURL.search = currentURL.search;+ albumsURL.hash = currentURL.hash;++ setLoading(true);+ window.location.href = albumsURL.href;+ return true;+ }+ }+ return false;+ };+useEffect(() => {const currentURL = new URL(window.location.href);if (currentURL.pathname != "/") {@@ -189,23 +210,9 @@ export default function PublicCollectionGallery() {const accessToken = t;let accessTokenJWT: string | undefined;if (collection) {- // On custom domains, redirect Trip albums to albums.ente.io/...- // because custom domains do not support the Trip layout fully- if (- collection.pubMagicMetadata?.data.layout === "trip" &&- shouldOnlyServeAlbumsApp- ) {- const currentURL = new URL(window.location.href);- const albumsURL = new URL(albumsAppOrigin());-- if (currentURL.host !== albumsURL.host) {- albumsURL.search = currentURL.search;- albumsURL.hash = currentURL.hash;-- window.location.href = albumsURL.href;- redirectingToAlbumsApp = true;- return;- }+ if (checkAndRedirectForTripAlbum(collection)) {+ redirectingToAlbumsApp = true;+ return;}setReferralCode(@@ -254,6 +261,11 @@ export default function PublicCollectionGallery() {try {const { collection, referralCode: userReferralCode } =await pullCollection(accessToken, collectionKey.current!);++ if (checkAndRedirectForTripAlbum(collection)) {+ return;+ }+setReferralCode(userReferralCode);setPublicCollection(collection);