diff --git a/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/SecuritySettings.tsx b/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/SecuritySettings.tsx index 622aa72690b..256f6b97f74 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/SecuritySettings.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/SecuritySettings.tsx @@ -46,6 +46,7 @@ export function SecuritySettings({ visibleItems }: SecuritySettingsProps) { }); const [confirmOpen, setConfirmOpen] = useState(false); + const [confirmTargetEnabled, setConfirmTargetEnabled] = useState(false); const runToggle = (enabled: boolean) => { toast.promise(setExpose.mutateAsync({ enabled }), { @@ -59,11 +60,8 @@ export function SecuritySettings({ visibleItems }: SecuritySettingsProps) { }; const handleChange = (next: boolean) => { - if (next) { - setConfirmOpen(true); - } else { - runToggle(false); - } + setConfirmTargetEnabled(next); + setConfirmOpen(true); }; return ( @@ -101,10 +99,12 @@ export function SecuritySettings({ visibleItems }: SecuritySettingsProps) { { + const enabled = confirmTargetEnabled; setConfirmOpen(false); - runToggle(true); + runToggle(enabled); }} /> diff --git a/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/components/ExposeViaRelayConfirmDialog/ExposeViaRelayConfirmDialog.tsx b/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/components/ExposeViaRelayConfirmDialog/ExposeViaRelayConfirmDialog.tsx index 68c57df8372..910e5108d4f 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/components/ExposeViaRelayConfirmDialog/ExposeViaRelayConfirmDialog.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/settings/security/components/SecuritySettings/components/ExposeViaRelayConfirmDialog/ExposeViaRelayConfirmDialog.tsx @@ -15,12 +15,14 @@ const CONFIRM_PHRASE = "I understand"; interface ExposeViaRelayConfirmDialogProps { open: boolean; + targetEnabled: boolean; onOpenChange: (open: boolean) => void; onConfirm: () => void; } export function ExposeViaRelayConfirmDialog({ open, + targetEnabled, onOpenChange, onConfirm, }: ExposeViaRelayConfirmDialogProps) { @@ -32,51 +34,56 @@ export function ExposeViaRelayConfirmDialog({ if (!open) setTyped(""); }, [open]); - const canConfirm = typed === CONFIRM_PHRASE; + const canConfirm = !targetEnabled || typed === CONFIRM_PHRASE; return ( - Expose this device to Superset Relay? + {targetEnabled ? "Enable Relay access?" : "Disable Relay access?"}

- Turning this on allows any remote device which you grant access - to — and anything that can compromise the Superset Relay — to - reach into this device to run commands. They will be able to - read and write files in your configured project directories, run - shell commands as you, and access any tools the host service - exposes. -

-

- Only enable this if you are okay with the risk that this - entails. Most users should leave this off. + This restarts the host service and stops running terminals. File + watches and other host-backed work will be interrupted.

+ {targetEnabled ? ( +

+ Remote workspaces you grant access to will be able to reach + this device through Superset Relay. +

+ ) : ( +

+ Remote workspaces will no longer be able to reach this device + through Superset Relay. +

+ )}
-
- - setTyped(event.target.value)} - placeholder={CONFIRM_PHRASE} - autoComplete="off" - spellCheck={false} - /> -
+ {targetEnabled && ( +
+ + setTyped(event.target.value)} + placeholder={CONFIRM_PHRASE} + autoComplete="off" + spellCheck={false} + /> +
+ )}