Use Inter font

This commit is contained in:
spikecodes 2021-05-19 16:09:08 -07:00
parent 73732a2a44
commit b9af6f47f3
No known key found for this signature in database
GPG Key ID: 004CECFF9B463BCB
3 changed files with 19 additions and 2 deletions

View File

@ -66,6 +66,16 @@ async fn favicon() -> Result<Response<Body>, String> {
) )
} }
async fn font() -> Result<Response<Body>, 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<Response<Body>, String> { async fn resource(body: &str, content_type: &str, cache: bool) -> Result<Response<Body>, String> {
let mut res = Response::builder() let mut res = Response::builder()
.status(200) .status(200)
@ -139,7 +149,7 @@ async fn main() {
"Referrer-Policy" => "no-referrer", "Referrer-Policy" => "no-referrer",
"X-Content-Type-Options" => "nosniff", "X-Content-Type-Options" => "nosniff",
"X-Frame-Options" => "DENY", "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 { 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("/robots.txt").get(|_| resource("User-agent: *\nAllow: /", "text/plain", true).boxed());
app.at("/favicon.ico").get(|_| favicon().boxed()); app.at("/favicon.ico").get(|_| favicon().boxed());
app.at("/logo.png").get(|_| pwa_logo().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("/touch-icon-iphone.png").get(|_| iphone_logo().boxed());
app.at("/apple-touch-icon.png").get(|_| iphone_logo().boxed()); app.at("/apple-touch-icon.png").get(|_| iphone_logo().boxed());
app app

BIN
static/Inter.var.woff2 Normal file

Binary file not shown.

View File

@ -6,6 +6,12 @@
--admin: #ea0027; --admin: #ea0027;
} }
@font-face {
font-family: 'Inter';
src: url('/Inter.var.woff2') format('woff2-variations');
font-style: normal;
}
/* Automatic theme selection */ /* Automatic theme selection */
:root, .dark{ :root, .dark{
/* Default & fallback theme (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 { pre, form, fieldset, table, th, td, select, input {
margin: 0; margin: 0;
color: var(--text); color: var(--text);
font-family: sans-serif; font-family: "Inter";
} }
body { body {