feat: Add enable_image_proxy_storage option to GlobalSettings

This commit is contained in:
Myzel394 2023-02-24 14:01:20 +01:00
parent 21c9acbd2c
commit 7111245c3e
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
3 changed files with 72 additions and 26 deletions

View File

@ -379,6 +379,10 @@
}, },
"enableImageProxy": { "enableImageProxy": {
"label": "Enable image proxy", "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." "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": { "userEmailEnableDisposableEmails": {

View File

@ -11,6 +11,7 @@ import AliasesPercentageAmount from "./AliasPercentageAmount"
import { import {
Checkbox, Checkbox,
Collapse,
FormControlLabel, FormControlLabel,
FormGroup, FormGroup,
FormHelperText, FormHelperText,
@ -82,6 +83,9 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
enableImageProxy: yup enableImageProxy: yup
.boolean() .boolean()
.label(t("routes.AdminRoute.forms.settings.enableImageProxy.label")), .label(t("routes.AdminRoute.forms.settings.enableImageProxy.label")),
enableImageProxyStorage: yup
.boolean()
.label(t("routes.AdminRoute.forms.settings.enableImageProxyStorage.label")),
allowStatistics: yup allowStatistics: yup
.boolean() .boolean()
.label(t("routes.AdminRoute.forms.settings.allowStatistics.label")), .label(t("routes.AdminRoute.forms.settings.allowStatistics.label")),
@ -465,6 +469,8 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
</FormGroup> </FormGroup>
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<Grid container spacing={1}>
<Grid item>
<FormGroup key="enable_image_proxy"> <FormGroup key="enable_image_proxy">
<FormControlLabel <FormControlLabel
control={ control={
@ -493,6 +499,41 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
</FormHelperText> </FormHelperText>
</FormGroup> </FormGroup>
</Grid> </Grid>
<Grid item>
<Collapse in={formik.values.enableImageProxy}>
<FormGroup key="enable_image_proxy_storage">
<FormControlLabel
control={
<Checkbox
checked={
formik.values.enableImageProxyStorage
}
onChange={formik.handleChange}
name="enableImageProxyStorage"
/>
}
disabled={formik.isSubmitting}
label={t(
"routes.AdminRoute.forms.settings.enableImageProxyStorage.label",
)}
/>
<FormHelperText
error={
formik.touched.enableImageProxyStorage &&
Boolean(formik.errors.enableImageProxyStorage)
}
>
{(formik.touched.enableImageProxyStorage &&
formik.errors.enableImageProxyStorage) ||
t(
"routes.AdminRoute.forms.settings.enableImageProxyStorage.description",
)}
</FormHelperText>
</FormGroup>
</Collapse>
</Grid>
</Grid>
</Grid>
<Grid item xs={12}> <Grid item xs={12}>
<FormGroup key="allow_statistics"> <FormGroup key="allow_statistics">
<FormControlLabel <FormControlLabel

View File

@ -208,6 +208,7 @@ export interface AdminSettings {
customEmailSuffixChars: string customEmailSuffixChars: string
imageProxyStorageLifeTimeInHours: number imageProxyStorageLifeTimeInHours: number
enableImageProxy: boolean enableImageProxy: boolean
enableImageProxyStorage: boolean
userEmailEnableDisposableEmails: boolean userEmailEnableDisposableEmails: boolean
userEmailEnableOtherRelays: boolean userEmailEnableOtherRelays: boolean
allowStatistics: boolean allowStatistics: boolean