Improve resource loading on pages

This commit is contained in:
G2-Games 2024-10-29 00:35:14 -05:00
parent 07487415c1
commit 7033220688
2 changed files with 6 additions and 6 deletions

View file

@ -25,18 +25,18 @@ use utils::hash_file;
use uuid::Uuid; use uuid::Uuid;
/// Stylesheet /// Stylesheet
#[get("/main.css")] #[get("/resources/main.css")]
fn stylesheet() -> RawCss<&'static str> { fn stylesheet() -> RawCss<&'static str> {
RawCss(include_str!("../web/main.css")) RawCss(include_str!("../web/main.css"))
} }
/// Upload handler javascript /// Upload handler javascript
#[get("/request.js")] #[get("/resources/request.js")]
fn form_handler_js() -> RawJavaScript<&'static str> { fn form_handler_js() -> RawJavaScript<&'static str> {
RawJavaScript(include_str!("../web/request.js")) RawJavaScript(include_str!("../web/request.js"))
} }
#[get("/favicon.svg")] #[get("/resources/favicon.svg")]
fn favicon() -> (ContentType, &'static str) { fn favicon() -> (ContentType, &'static str) {
(ContentType::SVG, include_str!("../web/favicon.svg")) (ContentType::SVG, include_str!("../web/favicon.svg"))
} }
@ -45,7 +45,7 @@ fn favicon() -> (ContentType, &'static str) {
fn home(settings: &State<Settings>) -> Markup { fn home(settings: &State<Settings>) -> Markup {
html! { html! {
(head("Confetti-Box")) (head("Confetti-Box"))
script src="./request.js" { } script src="/resources/request.js" { }
center { center {
h1 { "Confetti-Box 🎉" } h1 { "Confetti-Box 🎉" }

View file

@ -9,8 +9,8 @@ pub fn head(page_title: &str) -> Markup {
meta charset="UTF-8"; meta charset="UTF-8";
meta name="viewport" content="width=device-width, initial-scale=1"; meta name="viewport" content="width=device-width, initial-scale=1";
title { (page_title) } title { (page_title) }
link rel="icon" type="image/svg+xml" href="favicon.svg"; link rel="icon" type="image/svg+xml" href="/resources/favicon.svg";
link rel="stylesheet" href="./main.css"; link rel="stylesheet" href="/resources/main.css";
} }
} }