Skip to content

Commit 89e8472

Browse files
authored
Add disclaimer to custom repositories setting (#544)
1 parent fd1fa63 commit 89e8472

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

src/components/settings/MutableListSetting.tsx

+32-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
77
*/
88

9-
import { Button, Dialog, DialogTitle, ListItemButton, ListItemText, Stack, Tooltip } from '@mui/material';
9+
import { Button, Dialog, DialogTitle, ListItemButton, ListItemText, Stack, Tooltip, Typography } from '@mui/material';
1010
import { useEffect, useState } from 'react';
1111
import DialogContent from '@mui/material/DialogContent';
1212
import DialogActions from '@mui/material/DialogActions';
@@ -15,6 +15,7 @@ import List from '@mui/material/List';
1515
import DeleteIcon from '@mui/icons-material/Delete';
1616
import IconButton from '@mui/material/IconButton';
1717
import DialogContentText from '@mui/material/DialogContentText';
18+
import InfoIcon from '@mui/icons-material/Info';
1819
import { TextSetting, TextSettingProps } from '@/components/settings/text/TextSetting.tsx';
1920
import { TextSettingDialog } from '@/components/settings/text/TextSettingDialog.tsx';
2021
import { makeToast } from '@/components/util/Toast.tsx';
@@ -40,6 +41,7 @@ const MutableListItem = ({
4041
type MutableListSettingProps = Pick<TextSettingProps, 'settingName' | 'placeholder'> & {
4142
values?: string[];
4243
description?: string;
44+
dialogDisclaimer?: JSX.Element | string;
4345
addItemButtonTitle?: string;
4446
handleChange: (values: string[]) => void;
4547
allowDuplicates?: boolean;
@@ -50,6 +52,7 @@ type MutableListSettingProps = Pick<TextSettingProps, 'settingName' | 'placehold
5052
export const MutableListSetting = ({
5153
settingName,
5254
description,
55+
dialogDisclaimer,
5356
values,
5457
handleChange,
5558
addItemButtonTitle,
@@ -122,9 +125,35 @@ export const MutableListSetting = ({
122125

123126
<Dialog open={isDialogOpen} onClose={() => closeDialog()} fullWidth>
124127
<DialogTitle>{settingName}</DialogTitle>
125-
{!!description && (
128+
{(!!description || !!dialogDisclaimer) && (
126129
<DialogContent>
127-
<DialogContentText sx={{ paddingBottom: '10px' }}>{description}</DialogContentText>
130+
<DialogContentText sx={{ paddingBottom: '10px' }} component="div">
131+
{description && (
132+
<Typography
133+
variant="body1"
134+
sx={{
135+
whiteSpace: 'pre-line',
136+
}}
137+
>
138+
{description}
139+
</Typography>
140+
)}
141+
{dialogDisclaimer && (
142+
<Stack direction="row" alignItems="center">
143+
<InfoIcon color="warning" />
144+
<Typography
145+
variant="body1"
146+
sx={{
147+
marginLeft: '10px',
148+
marginTop: '5px',
149+
whiteSpace: 'pre-line',
150+
}}
151+
>
152+
{dialogDisclaimer}
153+
</Typography>
154+
</Stack>
155+
)}
156+
</DialogContentText>
128157
</DialogContent>
129158
)}
130159
<DialogContent dividers sx={{ maxHeight: '300px' }}>

src/i18n/locale/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
},
251251
"label": {
252252
"description": "Add custom repositories from which extensions can be installed",
253+
"disclaimer": "<strong>Suwayomi does not provide any support for 3rd party repositories or extensions!</strong><br/>Use with caution as there could be malicious actors making those repositories.<br/>You as the user need to verify the security and that you trust any repository or extension.",
253254
"title": "Custom repositories"
254255
}
255256
}

src/screens/settings/ServerSettings.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
77
*/
88

9-
import { useTranslation } from 'react-i18next';
9+
import { useTranslation, Trans } from 'react-i18next';
1010
import { useContext, useEffect } from 'react';
1111
import { List, ListItem, ListItemText, Switch } from '@mui/material';
1212
import ListSubheader from '@mui/material/ListSubheader';
@@ -133,6 +133,17 @@ export const ServerSettings = () => {
133133
<MutableListSetting
134134
settingName={t('extension.settings.repositories.custom.label.title')}
135135
description={t('extension.settings.repositories.custom.label.description')}
136+
dialogDisclaimer={
137+
<Trans i18nKey="extension.settings.repositories.custom.label.disclaimer">
138+
<strong>
139+
Suwayomi does not provide any support for 3rd party repositories or extensions!
140+
</strong>
141+
<br />
142+
Use with caution as there could be malicious actors making those repositories.
143+
<br />
144+
You as the user need to verify the security and that you trust any repository or extension.
145+
</Trans>
146+
}
136147
handleChange={(repos) => updateSetting('extensionRepos', repos)}
137148
values={serverSettings?.extensionRepos}
138149
addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')}

0 commit comments

Comments
 (0)