Skip to content

armgit / ente

Public Imported from GitHub
0

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

Avoid production previews in self-hosted Photos

Anand Baburajan265da7e01006
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 2927dd9ea2..1e1357c601 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -23,7 +23,7 @@ import {
} from "ente-accounts/services/accounts-db";
import { isDesktop, staticAppTitle } from "ente-base/app";
import { CenteredRow } from "ente-base/components/containers";
-import { CustomHead } from "ente-base/components/Head";
+import { CustomHeadPhotos } from "ente-base/components/Head";
import {
LoadingIndicator,
TranslucentLoadingOverlay,
@@ -61,9 +61,6 @@ import "../styles/global.css";
type PhotosAppProps = AppProps<Record<string, unknown>>;
-const photosDescription = "Store and share your photos with absolute privacy.";
-const photosPreviewImage = "https://photos.ente.com/images/preview.png";
-
type MainContentProps = Pick<PhotosAppProps, "Component" | "pageProps"> & {
isChangingRoute: boolean;
};
@@ -168,19 +165,7 @@ const App: React.FC<PhotosAppProps> = ({ Component, pageProps }) => {
return (
<ThemeProvider theme={photosTheme}>
- <CustomHead title={title} description={photosDescription}>
- <meta property="og:type" content="website" />
- <meta property="og:title" content={title} />
- <meta property="og:description" content={photosDescription} />
- <meta property="og:image" content={photosPreviewImage} />
- <meta property="og:image:type" content="image/png" />
- <meta property="og:image:width" content="1200" />
- <meta property="og:image:height" content="630" />
- <meta name="twitter:card" content="summary_large_image" />
- <meta name="twitter:title" content={title} />
- <meta name="twitter:description" content={photosDescription} />
- <meta name="twitter:image" content={photosPreviewImage} />
- </CustomHead>
+ <CustomHeadPhotos {...{ title }} />
<CssBaseline enableColorScheme />
<ThemedLoadingBar ref={loadingBarRef} />
diff --git a/web/packages/base/components/Head.tsx b/web/packages/base/components/Head.tsx
index 891b069b9f..af2f8b6d5e 100644
--- a/web/packages/base/components/Head.tsx
+++ b/web/packages/base/components/Head.tsx
@@ -23,6 +23,9 @@ const AlbumsFontPreloads: React.FC = () => (
const albumsPreviewTitle = "Photos, shared with you";
const albumsPreviewDescription = "Tap to view on Ente";
const albumsPreviewImage = "https://albums.ente.com/images/preview.png";
+const photosPreviewDescription =
+ "Store and share your photos with absolute privacy.";
+const photosPreviewImage = "https://photos.ente.com/images/preview.png";
export const CustomHead: React.FC<React.PropsWithChildren<CustomHeadProps>> = ({
title,
@@ -40,6 +43,31 @@ export const CustomHead: React.FC<React.PropsWithChildren<CustomHeadProps>> = ({
</Head>
);
+export const CustomHeadPhotosStatic: React.FC<CustomHeadProps> = ({
+ title,
+}) => (
+ <CustomHead title={title} description={photosPreviewDescription}>
+ <meta property="og:type" content="website" />
+ <meta property="og:title" content={title} />
+ <meta property="og:description" content={photosPreviewDescription} />
+ <meta property="og:image" content={photosPreviewImage} />
+ <meta property="og:image:type" content="image/png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content={title} />
+ <meta name="twitter:description" content={photosPreviewDescription} />
+ <meta name="twitter:image" content={photosPreviewImage} />
+ </CustomHead>
+);
+
+export const CustomHeadPhotos: React.FC<CustomHeadProps> = ({ title }) =>
+ isCustomAPIOrigin ? (
+ <CustomHead {...{ title }} />
+ ) : (
+ <CustomHeadPhotosStatic {...{ title }} />
+ );
+
// Link preview crawlers only see static HTML, and og:image must be absolute.
export const CustomHeadAlbumsStatic: React.FC = () => (
<Head>