diff options
Diffstat (limited to 'frontend/src/components/settings/pages/developer')
| -rw-r--r-- | frontend/src/components/settings/pages/developer/index.tsx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/frontend/src/components/settings/pages/developer/index.tsx b/frontend/src/components/settings/pages/developer/index.tsx index 05989806..8691ff7b 100644 --- a/frontend/src/components/settings/pages/developer/index.tsx +++ b/frontend/src/components/settings/pages/developer/index.tsx @@ -7,6 +7,7 @@ import { Navigation, TextField, Toggle, + showModal, } from '@decky/ui'; import { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -15,9 +16,11 @@ import { FaFileArchive, FaLink, FaReact, FaSteamSymbol, FaTerminal } from 'react import { setShouldConnectToReactDevTools, setShowValveInternal } from '../../../../developer'; import Logger from '../../../../logger'; import { installFromURL } from '../../../../store'; +import { WarnThirdPartyType } from '../../../../utils/globalTypes'; import { useSetting } from '../../../../utils/hooks/useSetting'; import { getSetting } from '../../../../utils/settings'; import { FileSelectionType } from '../../../modals/filepicker'; +import WarnThirdParty from '../../../modals/WarnThirdParty'; import RemoteDebuggingSettings from '../general/RemoteDebugging'; const logger = new Logger('DeveloperIndex'); @@ -43,6 +46,8 @@ export default function DeveloperSettings() { const [enableValveInternal, setEnableValveInternal] = useSetting<boolean>('developer.valve_internal', false); const [reactDevtoolsEnabled, setReactDevtoolsEnabled] = useSetting<boolean>('developer.rdt.enabled', false); const [reactDevtoolsIP, setReactDevtoolsIP] = useSetting<string>('developer.rdt.ip', ''); + const [acceptedWarning, setAcceptedWarning] = useSetting<boolean>('developer.warn.third_party', false); + const waitTime = acceptedWarning ? 0 : 5; const [pluginURL, setPluginURL] = useState(''); const textRef = useRef<HTMLDivElement>(null); const { t } = useTranslation(); @@ -74,13 +79,23 @@ export default function DeveloperSettings() { > <DialogButton disabled={pluginURL.length == 0} - onClick={() => { - if (/^https?:\/\//.test(pluginURL)) { - installFromURL(pluginURL); - } else { - installFromURL('https://' + pluginURL); - } - }} + onClick={() => + showModal( + <WarnThirdParty + type={WarnThirdPartyType.ZIP} + onOK={() => { + setAcceptedWarning(true); + if (/^https?:\/\//.test(pluginURL)) { + installFromURL(pluginURL); + } else { + installFromURL('https://' + pluginURL); + } + }} + onCancel={() => {}} + seconds={waitTime} + />, + ) + } > {t('SettingsDeveloperIndex.third_party_plugins.button_install')} </DialogButton> |
