diff --git a/src/krilld/http/server.rs b/src/krilld/http/server.rs index f4adf4d6..7f480d18 100644 --- a/src/krilld/http/server.rs +++ b/src/krilld/http/server.rs @@ -6,8 +6,8 @@ use std::io; use std::fs::File; use std::sync::{Arc, RwLock, RwLockReadGuard}; -use actix_web::{pred, fs, server}; -use actix_web::{App, FromRequest, HttpResponse}; +use actix_web::{pred, server}; +use actix_web::{App, FromRequest, HttpResponse }; use actix_web::dev::MessageBody; use actix_web::middleware; use actix_web::middleware::identity::CookieIdentityPolicy; @@ -30,10 +30,9 @@ use crate::krilld::krillserver::KrillServer; use crate::remote::rfc8183; use crate::remote::sigmsg::SignedMessage; -const NOT_FOUND: &[u8] = include_bytes!("../../../ui/dev/html/404.html"); +const NOT_FOUND: &[u8] = include_bytes!("../../../ui/public/404.html"); const LOGIN: &[u8] = include_bytes!("../../../ui/dev/html/login.html"); - //------------ PubServerApp -------------------------------------------------- pub struct PubServerApp(App>>>); @@ -43,7 +42,7 @@ pub struct PubServerApp(App>>>); /// impl PubServerApp { pub fn new(server: Arc>>) -> Self { - let mut app = App::with_state(server) + let app = App::with_state(server) .middleware(middleware::Logger::default()) .middleware(IdentityService::new( CookieIdentityPolicy::new(&[0; 32]) @@ -96,17 +95,7 @@ impl PubServerApp { |_req| HttpResponse::MethodNotAllowed()); }); - use std::env; - if env::var("KRILL_DEV_MODE").is_ok() { - app = app.handler( - "/ui/dev", - fs::StaticFiles::new("./ui/dev") - .unwrap() - .show_files_listing() - ); - } - - PubServerApp(with_statics(app)) + PubServerApp(app) } pub fn create_server( @@ -366,17 +355,6 @@ impl server::IntoHttpHandler for PubServerApp { } } -//------------ Definition of Statics ----------------------------------------- - -static CSS: &[u8] = b"text/css"; -static PNG: &[u8] = b"image/png"; - -fn with_statics(app: App) -> App { - statics!(app, - "css/custom.css" => CSS => "39e0abcc41c3653600f6d8eadb57b17246f1aca7", - "images/404.png" => PNG => "d48f938ae7a05a033d38f55cfa12a08fb3f3f8db", - ) -} //------------ HttpRequest --------------------------------------------------- diff --git a/src/krilld/http/statics.rs b/src/krilld/http/statics.rs index 7561f29d..15e2426a 100644 --- a/src/krilld/http/statics.rs +++ b/src/krilld/http/statics.rs @@ -13,6 +13,7 @@ use actix_web::http::StatusCode; /// 'const fn' are stable. So, be sure to use a value here that is unique /// to this resource, and this version of this resource. E.g. calculate its /// hash on the command line and use that in a &str. +#[allow(unused_macros)] macro_rules! statics { ( $app:expr, $( $path:expr => $mime:expr => $etag:expr, )* ) => {{ $app