This commit is contained in:
JMARyA 2023-09-14 17:42:06 +02:00
parent 2b903cccda
commit 8717757fbb
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 216 additions and 259 deletions

459
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,6 @@ mod msg;
mod notification;
mod pages;
use std::sync::Arc;
use tokio::sync::Mutex;
use actix_web::{web, App, HttpServer};
@ -15,15 +14,10 @@ async fn main() -> std::io::Result<()> {
env_logger::init();
let conf = config::Config::new();
let csrf = Arc::new(Mutex::new(web_base::csrf::CSRF::new()));
web_base::bootstrap::cache_bootstrap().await;
web_base::cache_bootstrap().await;
HttpServer::new(move || {
let logger = actix_web::middleware::Logger::default();
let app = App::new()
.wrap(logger)
.app_data(web::Data::new(conf.clone()))
web_base::map!(web_base::Site::new().enable_bootstrap(true), |x: App<_>| {
x.app_data(web::Data::new(conf.clone()))
.service(pages::index::index)
// Assets
.service(pages::assets::wallpaper)
@ -31,9 +25,7 @@ async fn main() -> std::io::Result<()> {
.service(pages::index::public_key)
.service(pages::index::mirrors)
.service(pages::index::message_page)
.service(pages::index::message_post);
web_base::assign_pages(csrf.clone(), app)
.service(pages::index::message_post)
})
.bind(("0.0.0.0", 8080))?
.run()