Nacre/src/resources.rs
astar76 f63ddf8da1 S050 (WIP): WebKit through the bridge over SOCKS5, navigation policy, certificate warning, downloads, cookie policy
- Bridge speaks SOCKS5 on its port; WebKit uses it (plain http through the HTTP proxy lost the login and looped);
  loopback skips the proxy.
- decide-policy: HTTPS-only upgrade with redirect guard, tracking strip, Content-Disposition downloads; Images
  permission as a WebKit content filter (net::policy::images_filter).
- load-failed-with-tls-errors -> Nacre's certificate page (assets/pages/badcert.html), "Open anyway" via
  nacre://allowcert for that tab only.
- download-started: web links to Nacre's downloader, blob:/data: saved by WebKit and tracked in the downloads list.
- Third-party cookies: NoThirdParty + ITP; privacy mode Accept-Language through the extension.
- selftest js/assert/save wait for the page's answer (unanswered asserts used to pass).
- Smokes: net-privacy (+localhost, TLS, images), net-downloads (+<a download>, blob:), privacy-net on https.
Open: main-frame detection for navigations, Google UA quirk, privacy-mode/cache smokes (see plan "Resume").

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 15:27:36 -06:00

16 lines
954 B
Rust

//! Titles of the pages Nacre shows for a failed load, a certificate error and a crash, so the browser can tell
//! them from real pages.
/// Title of the network error page; a tab showing it is treated as "failed to load".
pub const ERROR_TITLE: &str = "Couldn't open this page";
pub const BAD_CERT_TITLE: &str = "Connection not secure";
#[allow(dead_code)]
pub const CRASH_TITLE: &str = "This page crashed";
/// The certificate warning (shown in the page area in place of the site): `url` and what is wrong; its "Open
/// anyway" goes to `nacre://allowcert`, which the browser takes only from this tab while the warning is up.
pub fn bad_cert_page(url: &url::Url, why: &str) -> String {
let page = include_str!("../assets/pages/badcert.html").replace("${url}", &crate::util::html_escape(url.as_str())).replace("${reason}", &crate::util::html_escape(why));
debug_assert!(page.contains(&format!("<title>{BAD_CERT_TITLE}</title>")));
page
}