From cc7afb3533c3ae320b981c3ef4bca0efdab1043e Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sun, 24 Sep 2023 11:47:09 -0700 Subject: [PATCH] Get CSS working by adding a route to serve it. --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 2 +- src/db.rs | 9 +++++---- src/lib.rs | 10 ++++++++++ templates/base.html | 2 +- templates/css/ww.css | 4 +++- templates/header_with_user.html | 4 ++-- 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75bbbe6..a44f633 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2440,6 +2440,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "tower" version = "0.4.13" @@ -2470,8 +2483,13 @@ dependencies = [ "http", "http-body", "http-range-header", + "httpdate", "mime", + "mime_guess", + "percent-encoding", "pin-project-lite", + "tokio", + "tokio-util", "tower-layer", "tower-service", "tracing", diff --git a/Cargo.toml b/Cargo.toml index 651c008..20369ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ tokio = { version = "1", features = ["full", "tracing"], default-features = fals tokio-retry = "0.3" tokio-stream = "0.1" tower = { version = "0.4", features = ["util", "timeout"], default-features = false } -tower-http = { version = "0.4", features = ["add-extension", "trace"] } +tower-http = { version = "0.4", features = ["add-extension", "trace", "tracing", "fs"], default-features = false } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } unicode-segmentation = "1" diff --git a/src/db.rs b/src/db.rs index 464db67..d2abc4c 100644 --- a/src/db.rs +++ b/src/db.rs @@ -152,11 +152,12 @@ mod session_store { use super::*; - // NOTE! This code was straight stolen from - // https://github.com/jbr/async-sqlx-session/blob/30d00bed44ab2034082698f098eba48b21600f36/src/sqlite.rs - // and used under the terms of the MIT license: - /* + NOTE! This code was straight stolen from + https://github.com/jbr/async-sqlx-session/blob/30d00bed44ab2034082698f098eba48b21600f36/src/sqlite.rs + and used under the terms of the MIT license: + + Copyright 2022 Jacob Rothstein Permission is hereby granted, free of charge, to any person obtaining a copy of this software and diff --git a/src/lib.rs b/src/lib.rs index 6556ae3..55f54a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,7 @@ pub async fn app(db_pool: sqlx::SqlitePool, secret: &[u8]) -> IntoMakeService IntoMakeService {% block title %}{{ title }} - What 2 Watch{% endblock %} - + {% block head %}{% endblock %} diff --git a/templates/css/ww.css b/templates/css/ww.css index 9ea1f5b..a99c844 100644 --- a/templates/css/ww.css +++ b/templates/css/ww.css @@ -1 +1,3 @@ -@import "picnic.min"; +p { + color: red +} diff --git a/templates/header_with_user.html b/templates/header_with_user.html index 2bb761e..27a9e3e 100644 --- a/templates/header_with_user.html +++ b/templates/header_with_user.html @@ -13,13 +13,13 @@ -{% else %} +{% else %}
Heya, why don't you log in or sign up?
{% endmatch %} -{% else %} +{% else %} {% endif %}