Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

update WebView configuration in ImageFormat and WebpageFormat for improved security and performance

daniel31x13742db2ea5b7f
diff --git a/apps/mobile/components/Formats/ImageFormat.tsx b/apps/mobile/components/Formats/ImageFormat.tsx
index 49767491..e66f4f77 100644
--- a/apps/mobile/components/Formats/ImageFormat.tsx
+++ b/apps/mobile/components/Formats/ImageFormat.tsx
@@ -123,12 +123,12 @@ export default function ImageFormat({ link, setIsLoading, format }: Props) {
`,
}}
scalesPageToFit
- originWhitelist={["*"]}
- mixedContentMode="always"
- javaScriptEnabled={true}
+ originWhitelist={[
+ ...(auth.instance ? [auth.instance] : []),
+ "file://",
+ ]}
+ javaScriptEnabled={false}
allowFileAccess={true}
- allowFileAccessFromFileURLs={true}
- allowUniversalAccessFromFileURLs={true}
onLoadEnd={() => setIsLoading(false)}
/>
)
diff --git a/apps/mobile/components/Formats/WebpageFormat.tsx b/apps/mobile/components/Formats/WebpageFormat.tsx
index 79a458e4..8417282e 100644
--- a/apps/mobile/components/Formats/WebpageFormat.tsx
+++ b/apps/mobile/components/Formats/WebpageFormat.tsx
@@ -67,12 +67,9 @@ export default function WebpageFormat({ link, setIsLoading }: Props) {
baseUrl: FileSystem.documentDirectory,
}}
scalesPageToFit
- originWhitelist={["*"]}
- mixedContentMode="always"
- javaScriptEnabled={true}
+ originWhitelist={[...(auth.instance ? [auth.instance] : []), "file://"]}
+ javaScriptEnabled={false}
allowFileAccess={true}
- allowFileAccessFromFileURLs={true}
- allowUniversalAccessFromFileURLs={true}
onLoadEnd={() => setIsLoading(false)}
/>
)