Skip to content

armgit / ente

Public Imported from GitHub
0

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

Redirect trip albums from custom domains to albums.ente.io

anandbaburajan23e3075cb6a9
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index cc0d040779..3a17c55b2f 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -55,6 +55,7 @@ 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,
@@ -235,6 +236,24 @@ export default function PublicCollectionGallery() {
await pullCollection(accessToken, collectionKey.current!);
setReferralCode(userReferralCode);
+ // 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;
+ return;
+ }
+ }
+
setPublicCollection(collection);
const isPasswordProtected =
!!collection.publicURLs[0]?.passwordEnabled;