Make most links typesafe

This commit is contained in:
Joscha 2023-08-13 20:24:37 +02:00
parent 30ddf1e9b2
commit e64ea7ac12
10 changed files with 82 additions and 100 deletions

View file

@ -12,7 +12,7 @@ mod worker;
use axum::{routing::get, Router};
use axum_extra::routing::RouterExt;
use crate::{config::Config, somehow};
use crate::somehow;
use self::{
admin::queue::post_admin_queue_add,
@ -28,34 +28,6 @@ use self::{
use super::Server;
pub enum Tab {
None,
Index,
Queue,
}
#[derive(Clone)]
pub struct Base {
root: String,
repo_name: String,
current: &'static str,
}
impl Base {
pub fn new(config: &Config, tab: Tab) -> Self {
let current = match tab {
Tab::None => "",
Tab::Index => "index",
Tab::Queue => "queue",
};
Self {
root: config.web_base.clone(),
repo_name: config.repo_name.clone(),
current,
}
}
}
pub async fn run(server: Server) -> somehow::Result<()> {
// TODO Add text body to body-less status codes