Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix: Prevent redirect to ente.io for self-hosted instances

Johan Biju paul7d06c30b80d1
diff --git a/web/apps/embed/src/pages/index.tsx b/web/apps/embed/src/pages/index.tsx
index 746cb29acc..6b2153a3d3 100644
--- a/web/apps/embed/src/pages/index.tsx
+++ b/web/apps/embed/src/pages/index.tsx
@@ -12,6 +12,7 @@ import {
type PublicAlbumsCredentials,
} from "ente-base/http";
import log from "ente-base/log";
+import { isCustomAlbumsAppOrigin } from "ente-base/origins";
import { downloadManager } from "ente-gallery/services/download";
import { extractCollectionKeyFromShareURL } from "ente-gallery/services/share";
import { sortFiles } from "ente-gallery/utils/file";
@@ -130,8 +131,11 @@ export default function EmbedGallery() {
const t = currentURL.searchParams.get("t");
const ck = await extractCollectionKeyFromShareURL(currentURL);
if (!t && !ck) {
- window.location.href = "https://ente.io";
- redirectingToWebsite = true;
+ // Only redirect to ente.io if this is NOT a custom/self-hosted instance
+ if (!isCustomAlbumsAppOrigin) {
+ window.location.href = "https://ente.io";
+ redirectingToWebsite = true;
+ }
}
if (!t || !ck) {
return;
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 79eb377646..b08d3cfc84 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -4,6 +4,7 @@ import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternate
import CloseIcon from "@mui/icons-material/Close";
import DownloadIcon from "@mui/icons-material/Download";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
+
import {
Box,
Button,
@@ -55,7 +56,7 @@ import {
type PublicAlbumsCredentials,
} from "ente-base/http";
import log from "ente-base/log";
-import { albumsAppOrigin, shouldOnlyServeAlbumsApp } from "ente-base/origins";
+import { albumsAppOrigin, shouldOnlyServeAlbumsApp, isCustomAlbumsAppOrigin } from "ente-base/origins";
import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";
import {
useSaveGroups,
@@ -205,8 +206,11 @@ export default function PublicCollectionGallery() {
const t = currentURL.searchParams.get("t");
const ck = await extractCollectionKeyFromShareURL(currentURL);
if (!t && !ck) {
- window.location.href = "https://ente.io";
- redirectingToWebsite = true;
+ // Only redirect to ente.io if this is NOT a custom/self-hosted instance
+ if (!isCustomAlbumsAppOrigin) {
+ window.location.href = "https://ente.io";
+ redirectingToWebsite = true;
+ }
}
if (!t || !ck) {
return;
@@ -442,18 +446,18 @@ export default function PublicCollectionGallery() {
() =>
publicCollection && publicFiles
? {
- component: (
- <FileListHeader
- {...{
- publicCollection,
- publicFiles,
- downloadEnabled,
- onAddSaveGroup,
- }}
- />
- ),
- height: fileListHeaderHeight,
- }
+ component: (
+ <FileListHeader
+ {...{
+ publicCollection,
+ publicFiles,
+ downloadEnabled,
+ onAddSaveGroup,
+ }}
+ />
+ ),
+ height: fileListHeaderHeight,
+ }
: undefined,
[onAddSaveGroup, publicCollection, publicFiles, downloadEnabled],
);