add setting to block http protocol

This commit is contained in:
Fabian Freund
2024-06-25 15:43:54 +02:00
parent d2f55400aa
commit e20ed23c76
7 changed files with 56 additions and 2 deletions
@@ -312,6 +312,19 @@ class _WebViewState extends ConsumerState<WebView> {
}
}
if (request.url.isScheme('http')) {
if ((ref.read(settingsRepositoryProvider).valueOrNull ??
Settings.withDefaults())
.blockHttpProtocol) {
return WebResourceResponse(
contentType: "text/plain",
data: utf8.encode("HTTP protocol is blocked"),
statusCode: 403,
reasonPhrase: "Forbidden",
);
}
}
return null;
},
onProgressChanged: (controller, progress) {