feat: add allow insecure connections toggle in system settings

Block ws:// relay connections and http:// resource loading by default
to prevent browser mixed content warnings. When blocked, resources
show clickable URL links instead of error placeholders so users can
open them manually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
codytseng 2026-03-21 23:12:09 +08:00
parent c9bd7ca7d7
commit 3b4a2ba2d3
29 changed files with 156 additions and 24 deletions

View file

@ -16,6 +16,9 @@ const SystemSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
const [filterOutOnionRelays, setFilterOutOnionRelays] = useState(
storage.getFilterOutOnionRelays()
)
const [allowInsecureConnection, setAllowInsecureConnection] = useState(
storage.getAllowInsecureConnection()
)
return (
<SecondaryPageLayout ref={ref} index={index} title={t('System')}>
@ -45,6 +48,22 @@ const SystemSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
}}
/>
</div>
<div className="flex min-h-9 items-center justify-between px-4">
<Label htmlFor="allow-insecure-connection" className="text-base font-normal">
<div>{t('Allow insecure connections')}</div>
<div className="text-muted-foreground">
{t('Allow insecure connections description')}
</div>
</Label>
<Switch
id="allow-insecure-connection"
checked={allowInsecureConnection}
onCheckedChange={(checked) => {
storage.setAllowInsecureConnection(checked)
setAllowInsecureConnection(checked)
}}
/>
</div>
<div className="space-y-2 px-4">
<DefaultRelaysSetting />
</div>