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

@ -1,7 +1,9 @@
import { useFetchWebMetadata } from '@/hooks/useFetchWebMetadata'
import { isInsecureUrl } from '@/lib/url'
import { cn } from '@/lib/utils'
import { useContentPolicy } from '@/providers/ContentPolicyProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
import storage from '@/services/local-storage.service'
import { useMemo } from 'react'
import Image from '../Image'
import ExternalLink from '../ExternalLink'
@ -27,6 +29,10 @@ export default function WebPreview({
}
}, [url])
if (!storage.getAllowInsecureConnection() && isInsecureUrl(url)) {
return null
}
if (!autoLoadMedia && !mustLoad) {
return null
}