Skip to content

armgit / ente

Public Imported from GitHub
0

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

Custom albums build for custom domains

Manav Rathi633caa788368
diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml
index 6c2691ca35..ee6e1d6e7b 100644
--- a/.github/workflows/web-deploy.yml
+++ b/.github/workflows/web-deploy.yml
@@ -54,6 +54,18 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/photos web/apps/photos/out
+ - name: Build custom-albums
+ run: yarn build:photos
+ env:
+ NEXT_PUBLIC_ENTE_ONLY_SERVE_ALBUMS_APP: 1
+
+ - name: Publish custom-albums
+ uses: cloudflare/wrangler-action@v3
+ with:
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ command: pages deploy --project-name=ente --commit-dirty=true --branch=deploy/custom-albums web/apps/photos/out
+
- name: Build accounts
run: yarn build:accounts
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index d276aad67b..1796318bca 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -7,7 +7,11 @@ import { EnteLogo } from "ente-base/components/EnteLogo";
import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import { useBaseContext } from "ente-base/context";
-import { albumsAppOrigin, customAPIHost } from "ente-base/origins";
+import {
+ albumsAppOrigin,
+ customAPIHost,
+ shouldOnlyServeAlbumsApp,
+} from "ente-base/origins";
import {
masterKeyFromSession,
updateSessionFromElectronSafeStorageIfNeeded,
@@ -41,7 +45,8 @@ const Page: React.FC = () => {
const albumsURL = new URL(albumsAppOrigin());
currentURL.pathname = router.pathname;
if (
- currentURL.host == albumsURL.host &&
+ (shouldOnlyServeAlbumsApp ||
+ currentURL.host == albumsURL.host) &&
currentURL.pathname != "/shared-albums"
) {
const end = currentURL.hash.lastIndexOf("&");
diff --git a/web/packages/base/origins.ts b/web/packages/base/origins.ts
index 8e1ef1ddac..e6c8b89ebd 100644
--- a/web/packages/base/origins.ts
+++ b/web/packages/base/origins.ts
@@ -97,3 +97,9 @@ export const isCustomAlbumsAppOrigin =
*/
export const albumsAppOrigin = () =>
process.env.NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT ?? "https://albums.ente.io";
+
+/**
+ * Return true if this build is meant to only serve public albums.
+ */
+export const shouldOnlyServeAlbumsApp =
+ !!process.env.NEXT_PUBLIC_ENTE_ONLY_SERVE_ALBUMS_APP;