From 7111245c3e7468c2c6ac1a22d79c5cab90b37dd8 Mon Sep 17 00:00:00 2001
From: Myzel394 <50424412+Myzel394@users.noreply.github.com>
Date: Fri, 24 Feb 2023 14:01:20 +0100
Subject: [PATCH] feat: Add enable_image_proxy_storage option to GlobalSettings
---
public/locales/en-US/translation.json | 4 +
.../GlobalSettingsRoute/SettingsForm.tsx | 93 +++++++++++++------
src/server-types.ts | 1 +
3 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/public/locales/en-US/translation.json b/public/locales/en-US/translation.json
index 2afa166..fcb479e 100644
--- a/public/locales/en-US/translation.json
+++ b/public/locales/en-US/translation.json
@@ -379,6 +379,10 @@
},
"enableImageProxy": {
"label": "Enable image proxy",
+ "description": "If enabled, images will be proxied through the server. This enhances your user's privacy as their ip address will not be leaked."
+ },
+ "enableImageProxyStorage": {
+ "label": "Enable image proxy storage",
"description": "If enabled, images will be stored on the server and forwarded to the user. This makes email tracking nearly impossible as every message will be marked as read instantly, which is obviously not true as a user is typically not able to view an email in just a few seconds after it has been sent. This will only affect new images."
},
"userEmailEnableDisposableEmails": {
diff --git a/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx b/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
index 6737e73..81f91d7 100644
--- a/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
+++ b/src/route-widgets/GlobalSettingsRoute/SettingsForm.tsx
@@ -11,6 +11,7 @@ import AliasesPercentageAmount from "./AliasPercentageAmount"
import {
Checkbox,
+ Collapse,
FormControlLabel,
FormGroup,
FormHelperText,
@@ -82,6 +83,9 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
enableImageProxy: yup
.boolean()
.label(t("routes.AdminRoute.forms.settings.enableImageProxy.label")),
+ enableImageProxyStorage: yup
+ .boolean()
+ .label(t("routes.AdminRoute.forms.settings.enableImageProxyStorage.label")),
allowStatistics: yup
.boolean()
.label(t("routes.AdminRoute.forms.settings.allowStatistics.label")),
@@ -465,33 +469,70 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
-
-
+
+
+
+ }
+ disabled={formik.isSubmitting}
+ label={t(
+ "routes.AdminRoute.forms.settings.enableImageProxy.label",
+ )}
/>
- }
- disabled={formik.isSubmitting}
- label={t(
- "routes.AdminRoute.forms.settings.enableImageProxy.label",
- )}
- />
-
- {(formik.touched.enableImageProxy &&
- formik.errors.enableImageProxy) ||
- t(
- "routes.AdminRoute.forms.settings.enableImageProxy.description",
- )}
-
-
+
+ {(formik.touched.enableImageProxy &&
+ formik.errors.enableImageProxy) ||
+ t(
+ "routes.AdminRoute.forms.settings.enableImageProxy.description",
+ )}
+
+
+
+
+
+
+
+ }
+ disabled={formik.isSubmitting}
+ label={t(
+ "routes.AdminRoute.forms.settings.enableImageProxyStorage.label",
+ )}
+ />
+
+ {(formik.touched.enableImageProxyStorage &&
+ formik.errors.enableImageProxyStorage) ||
+ t(
+ "routes.AdminRoute.forms.settings.enableImageProxyStorage.description",
+ )}
+
+
+
+
+
diff --git a/src/server-types.ts b/src/server-types.ts
index bfe1b79..62642c7 100644
--- a/src/server-types.ts
+++ b/src/server-types.ts
@@ -208,6 +208,7 @@ export interface AdminSettings {
customEmailSuffixChars: string
imageProxyStorageLifeTimeInHours: number
enableImageProxy: boolean
+ enableImageProxyStorage: boolean
userEmailEnableDisposableEmails: boolean
userEmailEnableOtherRelays: boolean
allowStatistics: boolean