Skip to content

armgit / ente

Public Imported from GitHub
0

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

cast

Manav Rathi4a14017cff68
diff --git a/web/apps/accounts/src/components/context.ts b/web/apps/accounts/src/components/context.ts
index d6a2755e41..3189659b03 100644
--- a/web/apps/accounts/src/components/context.ts
+++ b/web/apps/accounts/src/components/context.ts
@@ -1,4 +1,4 @@
-import type { BaseAppContextT } from "@/next/types/app";
+import type { BaseAppContextT } from "@/next/types/context";
import { ensure } from "@/utils/ensure";
import { createContext, useContext } from "react";
diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx
index b22a8e5533..158b1a3b34 100644
--- a/web/apps/accounts/src/pages/_app.tsx
+++ b/web/apps/accounts/src/pages/_app.tsx
@@ -1,7 +1,7 @@
+import { staticAppTitle } from "@/next/app";
import { CustomHead } from "@/next/components/Head";
import { setupI18n } from "@/next/i18n";
import { logUnhandledErrorsAndRejections } from "@/next/log-web";
-import { staticAppTitle } from "@/next/types/app";
import { PAGES } from "@ente/accounts/constants/pages";
import { accountLogout } from "@ente/accounts/services/logout";
import { Overlay } from "@ente/shared/components/Container";
diff --git a/web/apps/accounts/src/services/passkey.ts b/web/apps/accounts/src/services/passkey.ts
index c729a2b3c7..fdb87df4e4 100644
--- a/web/apps/accounts/src/services/passkey.ts
+++ b/web/apps/accounts/src/services/passkey.ts
@@ -1,6 +1,6 @@
+import { clientPackageName } from "@/next/app";
import { isDevBuild } from "@/next/env";
import { apiURL } from "@/next/origins";
-import { clientPackageName } from "@/next/types/app";
import { TwoFactorAuthorizationResponse } from "@/next/types/credentials";
import { ensure } from "@/utils/ensure";
import { nullToUndefined } from "@/utils/transform";
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 4c24613308..a18bb5c130 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -1,14 +1,11 @@
+import { clientPackageName, staticAppTitle } from "@/next/app";
import { CustomHead } from "@/next/components/Head";
import { setupI18n } from "@/next/i18n";
import {
logStartupBanner,
logUnhandledErrorsAndRejections,
} from "@/next/log-web";
-import {
- clientPackageName,
- staticAppTitle,
- type BaseAppContextT,
-} from "@/next/types/app";
+import type { BaseAppContextT } from "@/next/types/context";
import { ensure } from "@/utils/ensure";
import { accountLogout } from "@ente/accounts/services/logout";
import { Overlay } from "@ente/shared/components/Container";
diff --git a/web/apps/cast/src/pages/_app.tsx b/web/apps/cast/src/pages/_app.tsx
index df51320dcb..5ae3158587 100644
--- a/web/apps/cast/src/pages/_app.tsx
+++ b/web/apps/cast/src/pages/_app.tsx
@@ -1,7 +1,7 @@
import { CustomHead } from "@/next/components/Head";
import { disableDiskLogs } from "@/next/log";
import { logUnhandledErrorsAndRejections } from "@/next/log-web";
-import { appTitle } from "@/next/types/app";
+import { appTitle } from "@/next/app";
import { getTheme } from "@ente/shared/themes";
import { THEME_COLOR } from "@ente/shared/themes/constants";
import { CssBaseline, ThemeProvider } from "@mui/material";
diff --git a/web/packages/accounts/services/redirect.ts b/web/packages/accounts/services/redirect.ts
index bee96ae423..2a4aaad867 100644
--- a/web/packages/accounts/services/redirect.ts
+++ b/web/packages/accounts/services/redirect.ts
@@ -1,4 +1,4 @@
-import { appName } from "@/next/types/app";
+import { appName } from "@/next/app";
import { AUTH_PAGES, PHOTOS_PAGES } from "@ente/shared/constants/pages";
/**
@@ -6,8 +6,9 @@ import { AUTH_PAGES, PHOTOS_PAGES } from "@ente/shared/constants/pages";
*
* This is where we redirect to after successful authentication.
*/
-export const appHomeRoute = {
+export const appHomeRoute: string = {
accounts: "/passkeys",
auth: AUTH_PAGES.AUTH,
+ cast: "/",
photos: PHOTOS_PAGES.GALLERY,
}[appName];
diff --git a/web/packages/next/app.ts b/web/packages/next/app.ts
index 6220e691a9..e5b8415768 100644
--- a/web/packages/next/app.ts
+++ b/web/packages/next/app.ts
@@ -1,6 +1,6 @@
import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
-export const appNames = ["accounts", "auth", "photos"] as const;
+export const appNames = ["accounts", "auth", "cast", "photos"] as const;
/**
* Arbitrary names that we used as keys for indexing various constants
@@ -44,6 +44,7 @@ export const isDesktop = process.env.isDesktop == "1";
export const staticAppTitle = {
accounts: "Ente Accounts",
auth: "Ente Auth",
+ cast: "Ente Photos",
photos: "Ente Photos",
}[appName];
@@ -68,6 +69,7 @@ export const clientPackageName = (() => {
return {
accounts: "io.ente.accounts.web",
auth: "io.ente.auth.web",
+ cast: "io.ente.cast.web",
photos: "io.ente.photos.web",
}[appName];
})();
diff --git a/web/packages/next/types/context.ts b/web/packages/next/types/context.ts
new file mode 100644
index 0000000000..59d3724ff2
--- /dev/null
+++ b/web/packages/next/types/context.ts
@@ -0,0 +1,14 @@
+import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";
+
+/**
+ * Properties guaranteed to be present in the AppContext types for apps that are
+ * listed in {@link AppName}.
+ */
+export interface BaseAppContextT {
+ /** Perform the (possibly app specific) logout sequence. */
+ logout: () => void;
+ /** Show or hide the app's navigation bar. */
+ showNavBar: (show: boolean) => void;
+ isMobile: boolean;
+ setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
+}