add: icon resolver
add: config "no_track" file list option add: rainbeam-shared -> tetratto-shared add: l10n
This commit is contained in:
parent
b6fe2fba37
commit
d2ca9e23d3
40 changed files with 1107 additions and 583 deletions
|
@ -1,5 +1,10 @@
|
|||
use axum::response::IntoResponse;
|
||||
|
||||
/// `/public/favicon.svg`
|
||||
pub async fn favicon_request() -> impl IntoResponse {
|
||||
([("Content-Type", "image/svg+xml")], crate::assets::FAVICON)
|
||||
}
|
||||
|
||||
/// `/css/style.css`
|
||||
pub async fn style_css_request() -> impl IntoResponse {
|
||||
([("Content-Type", "text/css")], crate::assets::STYLE_CSS)
|
||||
|
|
|
@ -15,9 +15,10 @@ pub fn routes(config: &Config) -> Router {
|
|||
.route("/js/atto.js", get(assets::atto_js_request))
|
||||
.route("/js/loader.js", get(assets::loader_js_request))
|
||||
.nest_service(
|
||||
"/static",
|
||||
"/public",
|
||||
get_service(tower_http::services::ServeDir::new(&config.dirs.assets)),
|
||||
)
|
||||
.route("/public/favicon.svg", get(assets::favicon_request))
|
||||
// api
|
||||
.nest("/api/v1", api::v1::routes())
|
||||
// pages
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{State, assets::initial_context, get_user_from_token};
|
||||
use crate::{State, assets::initial_context, get_lang, get_user_from_token};
|
||||
use axum::{
|
||||
Extension,
|
||||
response::{Html, IntoResponse, Redirect},
|
||||
|
@ -14,7 +14,9 @@ pub async fn login_request(jar: CookieJar, Extension(data): Extension<State>) ->
|
|||
return Err(Redirect::to("/"));
|
||||
}
|
||||
|
||||
let mut context = initial_context(&data.0.0, &user);
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0, lang, &user);
|
||||
|
||||
Ok(Html(
|
||||
data.1.render("auth/login.html", &mut context).unwrap(),
|
||||
))
|
||||
|
@ -32,7 +34,9 @@ pub async fn register_request(
|
|||
return Err(Redirect::to("/"));
|
||||
}
|
||||
|
||||
let mut context = initial_context(&data.0.0, &user);
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0, lang, &user);
|
||||
|
||||
Ok(Html(
|
||||
data.1.render("auth/register.html", &mut context).unwrap(),
|
||||
))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{State, assets::initial_context, get_user_from_token};
|
||||
use crate::{State, assets::initial_context, get_lang, get_user_from_token};
|
||||
use axum::{
|
||||
Extension,
|
||||
response::{Html, IntoResponse},
|
||||
|
@ -10,6 +10,8 @@ pub async fn index_request(jar: CookieJar, Extension(data): Extension<State>) ->
|
|||
let data = data.read().await;
|
||||
let user = get_user_from_token!((jar, data.0) <optional>);
|
||||
|
||||
let mut context = initial_context(&data.0.0, &user);
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0, lang, &user);
|
||||
|
||||
Html(data.1.render("misc/index.html", &mut context).unwrap())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue