global: snapshot

This commit is contained in:
nym21
2025-03-11 15:36:40 +01:00
parent db70b05088
commit 64d73b93e4
19 changed files with 275 additions and 324 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ fn any_handler(
.websites_path
.as_ref()
.expect("Should never reach here is websites_path is None")
.join(app_state.frontend.to_folder_name());
.join(app_state.website.to_folder_name());
let instant = Instant::now();
+5 -5
View File
@@ -3,19 +3,19 @@ use axum::{Router, routing::get};
use super::AppState;
mod file;
mod frontend;
mod minify;
mod website;
use file::{file_handler, index_handler};
pub use frontend::Frontend;
pub use website::Website;
pub trait FilesRoutes {
fn add_website_routes(self, frontend: Frontend) -> Self;
fn add_website_routes(self, website: Website) -> Self;
}
impl FilesRoutes for Router<AppState> {
fn add_website_routes(self, frontend: Frontend) -> Self {
if frontend.is_some() {
fn add_website_routes(self, website: Website) -> Self {
if website.is_some() {
self.route("/{*path}", get(file_handler))
.route("/", get(index_handler))
} else {
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, ValueEnum,
)]
pub enum Frontend {
pub enum Website {
#[default]
None,
#[value(name = "kibo.money")]
@@ -12,7 +12,7 @@ pub enum Frontend {
Custom,
}
impl Frontend {
impl Website {
pub fn is_none(&self) -> bool {
self == &Self::None
}