Skip to content

armgit / ente

Public Imported from GitHub
0

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

Read from remote store

Manav Rathi440818f1af3b
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index 1d7665521f..11562c26c0 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -989,29 +989,35 @@ const DomainSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
}) => {
// const { showMiniDialog } = useBaseContext();
- // const { mapEnabled } = useSettingsSnapshot();
-
+ const { customDomain, customDomainCNAME } = useSettingsSnapshot();
+
+ // const handleSubmit = useCallback(async (newName: string) => {
+ // const newFileName = [newName, extension].filter((x) => !!x).join(".");
+ // if (newFileName != fileName) {
+ // await onRename(newFileName);
+ // }
+ // onClose();
+ // };
const handleSubmit = useCallback(() => {
- console.log("test");
+ // customDomain
+ // showMiniDialog(
+ // mapEnabled
+ // ? confirmDisableMapsDialogAttributes(() =>
+ // updateMapEnabled(false),
+ // )
+ // : confirmEnableMapsDialogAttributes(() =>
+ // updateMapEnabled(true),
+ // ),
+ // ),
+ // [showMiniDialog, mapEnabled],
}, []);
- // showMiniDialog(
- // mapEnabled
- // ? confirmDisableMapsDialogAttributes(() =>
- // updateMapEnabled(false),
- // )
- // : confirmEnableMapsDialogAttributes(() =>
- // updateMapEnabled(true),
- // ),
- // ),
- // [showMiniDialog, mapEnabled],
- // );
const handleRootClose = () => {
onClose();
onRootClose();
};
- const customDomain = "";
+ // const customDomain = "";
return (
<TitledNestedSidebarDrawer
@@ -1028,28 +1034,17 @@ const DomainSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
placeholder={ut("photos.example.org")}
initialValue={customDomain}
submitButtonColor="accent"
- submitButtonTitle={pt("Set")}
+ submitButtonTitle={
+ customDomain ? pt("Update") : pt("Set")
+ }
onSubmit={handleSubmit}
- // onCancel={onClose}
- slotProps={{
- input: {
- // Align the adornment text to the input text.
- sx: { alignItems: "baseline" },
-
- // endAdornment: extension && (
- // <InputAdornment position="end">
- // {`.${extension}`}
- // </InputAdornment>
- // ),
- },
- }}
/>
</DomainItem>
<Divider sx={{ mt: 4, mb: 1 }} />
- <DomainItem title={pt("Add a CNAME")} ordinal={pt("2")}>
+ <DomainItem title={pt("Add DNS")} ordinal={pt("2")}>
<Typography sx={{ color: "text.muted" }}>
On your DNS provider, add a CNAME from your domain to{" "}
- <b>my.ente.io</b>
+ <b>{customDomainCNAME}</b>
</Typography>
</DomainItem>
<Divider sx={{ mt: 6, mb: 1 }} />
diff --git a/web/packages/new/photos/services/settings.ts b/web/packages/new/photos/services/settings.ts
index aedda42384..fc988edbdb 100644
--- a/web/packages/new/photos/services/settings.ts
+++ b/web/packages/new/photos/services/settings.ts
@@ -66,6 +66,24 @@ export interface Settings {
* Default: "https://cast.ente.io"
*/
castURL: string;
+
+ /**
+ * Set to the domain (host, e.g. "photos.example.org") that the user wishes
+ * to use for sharing their public albums.
+ *
+ * An empty string is treated as `undefined`.
+ */
+ customDomain?: string;
+
+ /**
+ * The URL we should ask the user to CNAME their {@link customDomain} to
+ * for wiring up their domain to the public albums app.
+ *
+ * See also `apps.custom-domain.cname` in `server/local.yaml`.
+ *
+ * Default: "my.ente.io"
+ */
+ customDomainCNAME: string;
}
const createDefaultSettings = (): Settings => ({
@@ -73,6 +91,7 @@ const createDefaultSettings = (): Settings => ({
mapEnabled: false,
cfUploadProxyDisabled: false,
castURL: "https://cast.ente.io",
+ customDomainCNAME: "my.ente.io",
});
/**
@@ -147,6 +166,8 @@ const FeatureFlags = z.object({
betaUser: z.boolean().nullish().transform(nullToUndefined),
mapEnabled: z.boolean().nullish().transform(nullToUndefined),
castUrl: z.string().nullish().transform(nullToUndefined),
+ customDomain: z.string().nullish().transform(nullToUndefined),
+ customDomainCNAME: z.string().nullish().transform(nullToUndefined),
});
type FeatureFlags = z.infer<typeof FeatureFlags>;
@@ -158,6 +179,9 @@ const syncSettingsSnapshotWithLocalStorage = () => {
settings.mapEnabled = flags?.mapEnabled || false;
settings.cfUploadProxyDisabled = savedCFProxyDisabled();
if (flags?.castUrl) settings.castURL = flags.castUrl;
+ if (flags?.customDomain) settings.customDomain = flags.customDomain;
+ if (flags?.customDomainCNAME)
+ settings.customDomainCNAME = flags.customDomainCNAME;
setSettingsSnapshot(settings);
};