Managed to load server configuration from WebUI

This commit is contained in:
2024-04-29 22:14:16 +02:00
parent 955067ad9c
commit 46648db093
15 changed files with 2159 additions and 13 deletions

View File

@ -6,6 +6,7 @@ use std::fmt::{Display, Formatter};
use std::io::ErrorKind;
pub mod auth_controller;
pub mod server_controller;
/// Custom error to ease controller writing
#[derive(Debug)]

View File

@ -0,0 +1,17 @@
use crate::app_config::AppConfig;
use crate::controllers::HttpResult;
use crate::extractors::auth_extractor::AuthExtractor;
use actix_web::HttpResponse;
#[derive(serde::Serialize)]
struct ServerConfig {
authenticated: bool,
disable_auth: bool,
}
pub async fn config(auth: AuthExtractor) -> HttpResult {
Ok(HttpResponse::Ok().json(ServerConfig {
authenticated: auth.is_authenticated(),
disable_auth: AppConfig::get().unsecure_disable_login,
}))
}