Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove custom share app origin

Manav Rathi2c31bbd8e003
diff --git a/web/packages/base/components/Head.tsx b/web/packages/base/components/Head.tsx
index fc3adea0f0..02950d4f39 100644
--- a/web/packages/base/components/Head.tsx
+++ b/web/packages/base/components/Head.tsx
@@ -1,11 +1,6 @@
import Head from "next/head";
import React from "react";
-import { haveWindow } from "../env";
-import {
- isCustomAPIOrigin,
- isCustomShareAppOrigin,
- shareAppOrigin,
-} from "../origins";
+import { isCustomAPIOrigin } from "../origins";
interface CustomHeadProps {
title: string;
@@ -133,14 +128,12 @@ export const CustomHeadShareStatic: React.FC = () => (
* A convenience fan out to conditionally show one of {@link CustomHead} or
* {@link CustomHeadShareStatic}.
*
- * This component defaults to {@link CustomHeadShareStatic} during SSR unless a
- * custom endpoint is defined, and then does a client side update when it
- * detects that the origin it is being served on is not the share origin.
+ * Use static production preview tags only when using Ente's production API.
+ * Custom API builds should not inline production preview metadata into the
+ * static HTML.
*/
export const CustomHeadShare: React.FC<CustomHeadProps> = ({ title }) =>
- isCustomShareAppOrigin ||
- (haveWindow() &&
- new URL(window.location.href).origin != shareAppOrigin()) ? (
+ isCustomAPIOrigin ? (
<CustomHead {...{ title }} />
) : (
<CustomHeadShareStatic />
diff --git a/web/packages/base/next.config.base.js b/web/packages/base/next.config.base.js
index 938e3ba47b..b2287633bc 100644
--- a/web/packages/base/next.config.base.js
+++ b/web/packages/base/next.config.base.js
@@ -113,6 +113,15 @@ if (process.env.NEXT_PUBLIC_ENTE_PHOTOS_ENDPOINT) {
);
}
+if (process.env.NEXT_PUBLIC_ENTE_SHARE_ENDPOINT) {
+ console.log(
+ "The NEXT_PUBLIC_ENTE_SHARE_ENDPOINT environment variable is not used anymore and is ignored.",
+ );
+ console.log(
+ "It only affected link preview metadata; public link behavior is configured through Museum.",
+ );
+}
+
/**
* Configuration for the Next.js build
*
diff --git a/web/packages/base/origins.ts b/web/packages/base/origins.ts
index 1d215aa9f9..903e99fb8a 100644
--- a/web/packages/base/origins.ts
+++ b/web/packages/base/origins.ts
@@ -87,23 +87,6 @@ export const customAPIHost = async () => {
export const uploaderOrigin = async () =>
(await customAPIOrigin()) ?? "https://uploader.ente.com";
-/**
- * A static build time constant that is `true` if {@link shareAppOrigin} has
- * been customized.
- */
-export const isCustomShareAppOrigin =
- !!process.env.NEXT_PUBLIC_ENTE_SHARE_ENDPOINT;
-
-/**
- * Return the origin that serves public locker (share app).
- *
- * Defaults to our production instance, "https://share.ente.com", but can be
- * overridden by setting the `NEXT_PUBLIC_ENTE_SHARE_ENDPOINT` environment
- * variable.
- */
-export const shareAppOrigin = (): string =>
- process.env.NEXT_PUBLIC_ENTE_SHARE_ENDPOINT ?? "https://share.ente.com";
-
/**
* Return the origin that serves Ente's official photos app.
*/