Server: Add forkawesome
This commit is contained in:
parent
b01ee00541
commit
04eec386b1
17
src/main.rs
17
src/main.rs
|
@ -123,7 +123,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
.route("/", web::get().to(home))
|
.route("/", web::get().to(home))
|
||||||
.route("/browse", web::get().to(browse::index))
|
.route("/browse", web::get().to(browse::index))
|
||||||
.route("/settings", web::get().to(settings))
|
.route("/settings", web::get().to(settings))
|
||||||
.route("/toolkit/{name}", web::get().to(toolkit))
|
.route("/toolkit/{folder}/{name}", web::get().to(toolkit))
|
||||||
.route("/static/{name}", web::get().to(statics))
|
.route("/static/{name}", web::get().to(statics))
|
||||||
.service(web::scope("/.well-known").route(
|
.service(web::scope("/.well-known").route(
|
||||||
"/webfinger",
|
"/webfinger",
|
||||||
|
@ -274,7 +274,7 @@ impl fmt::Debug for State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toolkit_path(name: &str) -> String {
|
fn toolkit_path(name: &str) -> String {
|
||||||
format!("/toolkit/{}", name)
|
format!("/toolkit/static/{}", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statics_path(name: &str) -> String {
|
fn statics_path(name: &str) -> String {
|
||||||
|
@ -289,7 +289,18 @@ async fn home(profile: Option<UserProfile>) -> HttpResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn toolkit(path: web::Path<String>, startup: web::Data<SystemTime>) -> HttpResponse {
|
async fn toolkit(
|
||||||
|
path: web::Path<(String, String)>,
|
||||||
|
startup: web::Data<SystemTime>,
|
||||||
|
) -> HttpResponse {
|
||||||
|
let (folder, path) = path.into_inner();
|
||||||
|
|
||||||
|
let path = if folder == "fonts" {
|
||||||
|
format!("fonts/{}", path)
|
||||||
|
} else {
|
||||||
|
path
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(file) = hyaenidae_toolkit::templates::statics::StaticFile::get(&path) {
|
if let Some(file) = hyaenidae_toolkit::templates::statics::StaticFile::get(&path) {
|
||||||
return HttpResponse::Ok()
|
return HttpResponse::Ok()
|
||||||
.set(LastModified(SystemTime::clone(&startup).into()))
|
.set(LastModified(SystemTime::clone(&startup).into()))
|
||||||
|
|
|
@ -2,4 +2,3 @@
|
||||||
|
|
||||||
@()
|
@()
|
||||||
<script src="@crate::toolkit_path(file_input_js.name)"></script>
|
<script src="@crate::toolkit_path(file_input_js.name)"></script>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@use crate::{toolkit_path, statics_path, templates::statics::layout_css};
|
@use crate::{toolkit_path, statics_path, templates::statics::layout_css};
|
||||||
@use hyaenidae_toolkit::templates::statics::toolkit_css;
|
@use hyaenidae_toolkit::templates::statics::{toolkit_css, fork_awesome_min_css};
|
||||||
|
|
||||||
@(title: &str, description: &str, dark: bool, head: Content, body: Content)
|
@(title: &str, description: &str, dark: bool, head: Content, body: Content)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
<title>@Html(title)</title>
|
<title>@Html(title)</title>
|
||||||
<link href="@toolkit_path(toolkit_css.name)" rel="stylesheet" type="text/css" />
|
<link href="@toolkit_path(toolkit_css.name)" rel="stylesheet" type="text/css" />
|
||||||
<link href="@statics_path(layout_css.name)" rel="stylesheet" type="text/css" />
|
<link href="@statics_path(layout_css.name)" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="@toolkit_path(fork_awesome_min_css.name)" rel="stylesheet" type="text/css" />
|
||||||
<meta property="og:title" content="@title" />
|
<meta property="og:title" content="@title" />
|
||||||
<meta property="og:description" content="@description" />
|
<meta property="og:description" content="@description" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
|
|
Loading…
Reference in a new issue