π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove custom _document
Manav Rathifa7cbaea1850
diff --git a/web/apps/accounts/public/favicon.ico b/web/apps/accounts/public/favicon.icodeleted file mode 100644index 4570eb8d92..0000000000Binary files a/web/apps/accounts/public/favicon.ico and /dev/null differdiff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsxindex 9c494569b0..fb65f621e8 100644--- a/web/apps/accounts/src/pages/_app.tsx+++ b/web/apps/accounts/src/pages/_app.tsx@@ -1,3 +1,4 @@+import { CustomHead } from "@/next/components/Head";import { setupI18n } from "@/next/i18n";import { APPS, APP_TITLES } from "@ente/shared/apps/constants";import { Overlay } from "@ente/shared/components/Container";@@ -15,8 +16,8 @@ import { getTheme } from "@ente/shared/themes";import { THEME_COLOR } from "@ente/shared/themes/constants";import { CssBaseline, useMediaQuery } from "@mui/material";import { ThemeProvider } from "@mui/material/styles";+import { t } from "i18next";import { AppProps } from "next/app";-import Head from "next/head";import { useRouter } from "next/router";import { createContext, useEffect, useState } from "react";import "styles/global.css";@@ -76,16 +77,13 @@ export default function App(props: AppProps) {const theme = getTheme(themeColor, APPS.PHOTOS);- // TODO: Localise APP_TITLES+ const title = isI18nReady+ ? t("TITLE", { context: APPS.ACCOUNTS })+ : APP_TITLES.get(APPS.ACCOUNTS);+return (<>- <Head>- <title>{APP_TITLES.get(APPS.ACCOUNTS)}</title>- <meta- name="viewport"- content="width=device-width, initial-scale=1"- />- </Head>+ <CustomHead {...{ title }} /><ThemeProvider theme={theme}><CssBaseline enableColorScheme />diff --git a/web/apps/accounts/src/pages/_document.tsx b/web/apps/accounts/src/pages/_document.tsxdeleted file mode 100644index 3c6c2a9590..0000000000--- a/web/apps/accounts/src/pages/_document.tsx+++ /dev/null@@ -1,3 +0,0 @@-import DocumentPage from "@ente/shared/next/pages/_document";--export default DocumentPage;diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsxindex c6cc5e1ac9..aea05cf280 100644--- a/web/apps/auth/src/pages/_app.tsx+++ b/web/apps/auth/src/pages/_app.tsx@@ -1,3 +1,4 @@+import { CustomHead } from "@/next/components/Head";import { setupI18n } from "@/next/i18n";import {APPS,@@ -28,7 +29,6 @@ import { CssBaseline, useMediaQuery } from "@mui/material";import { ThemeProvider } from "@mui/material/styles";import { t } from "i18next";import { AppProps } from "next/app";-import Head from "next/head";import { useRouter } from "next/router";import { createContext, useEffect, useRef, useState } from "react";import LoadingBar from "react-top-loading-bar";@@ -129,19 +129,13 @@ export default function App(props: AppProps) {content: t("UNKNOWN_ERROR"),});+ const title = isI18nReady+ ? t("TITLE", { context: APPS.AUTH })+ : APP_TITLES.get(APPS.AUTH);+return (<>- <Head>- <title>- {isI18nReady- ? t("TITLE", { context: APPS.AUTH })- : APP_TITLES.get(APPS.AUTH)}- </title>- <meta- name="viewport"- content="width=device-width, initial-scale=1"- />- </Head>+ <CustomHead {...{ title }} /><ThemeProvider theme={getTheme(themeColor, APPS.AUTH)}><CssBaseline enableColorScheme />diff --git a/web/apps/auth/src/pages/_document.tsx b/web/apps/auth/src/pages/_document.tsxdeleted file mode 100644index 3c6c2a9590..0000000000--- a/web/apps/auth/src/pages/_document.tsx+++ /dev/null@@ -1,3 +0,0 @@-import DocumentPage from "@ente/shared/next/pages/_document";--export default DocumentPage;diff --git a/web/apps/cast/public/favicon.ico b/web/apps/cast/public/favicon.icodeleted file mode 100644index 4570eb8d92..0000000000Binary files a/web/apps/cast/public/favicon.ico and /dev/null differdiff --git a/web/apps/cast/public/images/favicon.png b/web/apps/cast/public/images/favicon.pngnew file mode 100644index 0000000000..fcb8d1054bBinary files /dev/null and b/web/apps/cast/public/images/favicon.png differdiff --git a/web/apps/cast/src/pages/_app.tsx b/web/apps/cast/src/pages/_app.tsxindex 8874d956d1..81c7292fcf 100644--- a/web/apps/cast/src/pages/_app.tsx+++ b/web/apps/cast/src/pages/_app.tsx@@ -1,4 +1,5 @@-import { APPS } from "@ente/shared/apps/constants";+import { CustomHead } from "@/next/components/Head";+import { APPS, APP_TITLES } from "@ente/shared/apps/constants";import { getTheme } from "@ente/shared/themes";import { THEME_COLOR } from "@ente/shared/themes/constants";import { CssBaseline, ThemeProvider } from "@mui/material";@@ -7,16 +8,20 @@ import "styles/global.css";export default function App({ Component, pageProps }: AppProps) {return (- <ThemeProvider theme={getTheme(THEME_COLOR.DARK, APPS.PHOTOS)}>- <CssBaseline enableColorScheme />+ <>+ <CustomHead title={APP_TITLES.get(APPS.PHOTOS)} />- <main- style={{- display: "contents",- }}- >- <Component {...pageProps} />- </main>- </ThemeProvider>+ <ThemeProvider theme={getTheme(THEME_COLOR.DARK, APPS.PHOTOS)}>+ <CssBaseline enableColorScheme />++ <main+ style={{+ display: "contents",+ }}+ >+ <Component {...pageProps} />+ </main>+ </ThemeProvider>+ </>);}diff --git a/web/apps/cast/src/pages/_document.tsx b/web/apps/cast/src/pages/_document.tsxdeleted file mode 100644index b038dc04e7..0000000000--- a/web/apps/cast/src/pages/_document.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { Head, Html, Main, NextScript } from "next/document";--export default function Document() {- return (- <Html- lang="en"- style={{- height: "100%",- width: "100%",- }}- >- <Head />- <body- style={{- height: "100%",- width: "100%",- margin: 0,- backgroundColor: "black",- color: "white",- }}- >- <Main />- <NextScript />- </body>- </Html>- );-}diff --git a/web/apps/cast/src/styles/global.css b/web/apps/cast/src/styles/global.cssindex d79f9f302f..3ac2cfc5e7 100644--- a/web/apps/cast/src/styles/global.css+++ b/web/apps/cast/src/styles/global.css@@ -1,3 +1,11 @@+body {+ height: 100%;+ width: 100%;+ margin: 0;+ background-color: black;+ color: white;+}+#__next {height: 100%;}diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex b7172144d1..cf84f4296d 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -1,3 +1,4 @@+import { CustomHead } from "@/next/components/Head";import { setupI18n } from "@/next/i18n";import {APPS,@@ -48,7 +49,6 @@ import { REDIRECTS } from "constants/redirects";import { t } from "i18next";import isElectron from "is-electron";import { AppProps } from "next/app";-import Head from "next/head";import { useRouter } from "next/router";import "photoswipe/dist/photoswipe.css";import { createContext, useEffect, useRef, useState } from "react";@@ -378,19 +378,13 @@ export default function App(props: AppProps) {content: t("UNKNOWN_ERROR"),});+ const title = isI18nReady+ ? t("TITLE", { context: APPS.PHOTOS })+ : APP_TITLES.get(APPS.PHOTOS);+return (<>- <Head>- <title>- {isI18nReady- ? t("TITLE", { context: APPS.PHOTOS })- : APP_TITLES.get(APPS.PHOTOS)}- </title>- <meta- name="viewport"- content="width=device-width, initial-scale=1"- />- </Head>+ <CustomHead {...{ title }} /><ThemeProvider theme={getTheme(themeColor, APPS.PHOTOS)}><CssBaseline enableColorScheme />diff --git a/web/apps/photos/src/pages/_document.tsx b/web/apps/photos/src/pages/_document.tsxdeleted file mode 100644index 3c6c2a9590..0000000000--- a/web/apps/photos/src/pages/_document.tsx+++ /dev/null@@ -1,3 +0,0 @@-import DocumentPage from "@ente/shared/next/pages/_document";--export default DocumentPage;diff --git a/web/packages/next/components/Head.tsx b/web/packages/next/components/Head.tsxnew file mode 100644index 0000000000..d756a9b09b--- /dev/null+++ b/web/packages/next/components/Head.tsx@@ -0,0 +1,29 @@+import Head from "next/head";+import React from "react";++interface CustomHeadProps {+ title: string;+}++/**+ * A custom version of "next/head" that sets the title, description, favicon and+ * some other boilerplate <head> tags.+ *+ * This assumes the existence of `public/images/favicon.png`.+ */+export const CustomHead: React.FC<CustomHeadProps> = ({ title }) => {+ return (+ <Head>+ <title>{title}</title>+ <link rel="icon" href="/images/favicon.png" type="image/png" />+ <meta+ name="description"+ content="Ente - end-to-end encrypted cloud with open-source apps"+ />+ <meta+ name="viewport"+ content="width=device-width, initial-scale=1"+ />+ </Head>+ );+};diff --git a/web/packages/shared/next/pages/_document.tsx b/web/packages/shared/next/pages/_document.tsxdeleted file mode 100644index b2f09c5ca5..0000000000--- a/web/packages/shared/next/pages/_document.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { Head, Html, Main, NextScript } from "next/document";--export default function EnteDocument() {- return (- <Html lang="en">- <Head>- <meta- name="description"- content="Ente - end-to-end encrypted cloud with open-source apps"- />- <link rel="icon" href="/images/favicon.png" type="image/png" />- </Head>- <body>- <Main />- <NextScript />- </body>- </Html>- );-}