diff --git a/src/main.rs b/src/main.rs index 5034b83..8420e56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,6 +66,16 @@ async fn favicon() -> Result, String> { ) } +async fn font() -> Result, String> { + Ok( + Response::builder() + .status(200) + .header("content-type", "font/woff2") + .body(include_bytes!("../static/Inter.var.woff2").as_ref().into()) + .unwrap_or_default(), + ) +} + async fn resource(body: &str, content_type: &str, cache: bool) -> Result, String> { let mut res = Response::builder() .status(200) @@ -139,7 +149,7 @@ async fn main() { "Referrer-Policy" => "no-referrer", "X-Content-Type-Options" => "nosniff", "X-Frame-Options" => "DENY", - "Content-Security-Policy" => "default-src 'none'; script-src 'self' blob:; manifest-src 'self'; media-src 'self' data: blob: about:; style-src 'self' 'unsafe-inline'; base-uri 'none'; img-src 'self' data:; form-action 'self'; frame-ancestors 'none'; connect-src 'self'; worker-src blob:;" + "Content-Security-Policy" => "default-src 'none'; font-src 'self'; script-src 'self' blob:; manifest-src 'self'; media-src 'self' data: blob: about:; style-src 'self' 'unsafe-inline'; base-uri 'none'; img-src 'self' data:; form-action 'self'; frame-ancestors 'none'; connect-src 'self'; worker-src blob:;" }; if let Some(expire_time) = hsts { @@ -156,6 +166,7 @@ async fn main() { app.at("/robots.txt").get(|_| resource("User-agent: *\nAllow: /", "text/plain", true).boxed()); app.at("/favicon.ico").get(|_| favicon().boxed()); app.at("/logo.png").get(|_| pwa_logo().boxed()); + app.at("/Inter.var.woff2").get(|_| font().boxed()); app.at("/touch-icon-iphone.png").get(|_| iphone_logo().boxed()); app.at("/apple-touch-icon.png").get(|_| iphone_logo().boxed()); app diff --git a/static/Inter.var.woff2 b/static/Inter.var.woff2 new file mode 100644 index 0000000..b40083c Binary files /dev/null and b/static/Inter.var.woff2 differ diff --git a/static/style.css b/static/style.css index 2a54241..d67e4f3 100644 --- a/static/style.css +++ b/static/style.css @@ -6,6 +6,12 @@ --admin: #ea0027; } +@font-face { + font-family: 'Inter'; + src: url('/Inter.var.woff2') format('woff2-variations'); + font-style: normal; +} + /* Automatic theme selection */ :root, .dark{ /* Default & fallback theme (dark) */ @@ -150,7 +156,7 @@ html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote, pre, form, fieldset, table, th, td, select, input { margin: 0; color: var(--text); - font-family: sans-serif; + font-family: "Inter"; } body {