Managed to load server configuration from WebUI
This commit is contained in:
@ -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)]
|
||||
|
17
remote_backend/src/controllers/server_controller.rs
Normal file
17
remote_backend/src/controllers/server_controller.rs
Normal 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,
|
||||
}))
|
||||
}
|
Reference in New Issue
Block a user