From 79c3d1801b4cb7726202394e1b5e37309f5d5108 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 9 Jan 2024 21:27:59 +0100 Subject: [PATCH] Add disclaimer to custom repositories setting --- .../settings/MutableListSetting.tsx | 35 +++++++++++++++++-- src/i18n/locale/en.json | 1 + src/screens/settings/ServerSettings.tsx | 13 ++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/components/settings/MutableListSetting.tsx b/src/components/settings/MutableListSetting.tsx index b87b0374f3..8359b7c20c 100644 --- a/src/components/settings/MutableListSetting.tsx +++ b/src/components/settings/MutableListSetting.tsx @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { Button, Dialog, DialogTitle, ListItemButton, ListItemText, Stack, Tooltip } from '@mui/material'; +import { Button, Dialog, DialogTitle, ListItemButton, ListItemText, Stack, Tooltip, Typography } from '@mui/material'; import { useEffect, useState } from 'react'; import DialogContent from '@mui/material/DialogContent'; import DialogActions from '@mui/material/DialogActions'; @@ -15,6 +15,7 @@ import List from '@mui/material/List'; import DeleteIcon from '@mui/icons-material/Delete'; import IconButton from '@mui/material/IconButton'; import DialogContentText from '@mui/material/DialogContentText'; +import InfoIcon from '@mui/icons-material/Info'; import { TextSetting, TextSettingProps } from '@/components/settings/text/TextSetting.tsx'; import { TextSettingDialog } from '@/components/settings/text/TextSettingDialog.tsx'; import { makeToast } from '@/components/util/Toast.tsx'; @@ -40,6 +41,7 @@ const MutableListItem = ({ type MutableListSettingProps = Pick & { values?: string[]; description?: string; + dialogDisclaimer?: JSX.Element | string; addItemButtonTitle?: string; handleChange: (values: string[]) => void; allowDuplicates?: boolean; @@ -50,6 +52,7 @@ type MutableListSettingProps = Pick closeDialog()} fullWidth> {settingName} - {!!description && ( + {(!!description || !!dialogDisclaimer) && ( - {description} + + {description && ( + + {description} + + )} + {dialogDisclaimer && ( + + + + {dialogDisclaimer} + + + )} + )} diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index b20e61f850..0915379524 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -250,6 +250,7 @@ }, "label": { "description": "Add custom repositories from which extensions can be installed", + "disclaimer": "Suwayomi does not provide any support for 3rd party repositories or extensions!
Use with caution as there could be malicious actors making those repositories.
You as the user need to verify the security and that you trust any repository or extension.", "title": "Custom repositories" } } diff --git a/src/screens/settings/ServerSettings.tsx b/src/screens/settings/ServerSettings.tsx index 0fed83a909..e68a855f15 100644 --- a/src/screens/settings/ServerSettings.tsx +++ b/src/screens/settings/ServerSettings.tsx @@ -6,7 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { useTranslation } from 'react-i18next'; +import { useTranslation, Trans } from 'react-i18next'; import { useContext, useEffect } from 'react'; import { List, ListItem, ListItemText, Switch } from '@mui/material'; import ListSubheader from '@mui/material/ListSubheader'; @@ -133,6 +133,17 @@ export const ServerSettings = () => { + + Suwayomi does not provide any support for 3rd party repositories or extensions! + +
+ Use with caution as there could be malicious actors making those repositories. +
+ You as the user need to verify the security and that you trust any repository or extension. + + } handleChange={(repos) => updateSetting('extensionRepos', repos)} values={serverSettings?.extensionRepos} addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')}