This commit is contained in:
parent
b0d1402431
commit
c419f92334
2 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,7 @@ pub struct Config {
|
||||||
pub port: Option<u16>,
|
pub port: Option<u16>,
|
||||||
pub mail: Option<String>,
|
pub mail: Option<String>,
|
||||||
pub lang: Option<String>,
|
pub lang: Option<String>,
|
||||||
|
pub onion: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
@ -36,6 +37,7 @@ impl Config {
|
||||||
port: test(a.port, d.port),
|
port: test(a.port, d.port),
|
||||||
mail: test(a.mail, d.mail),
|
mail: test(a.mail, d.mail),
|
||||||
lang: test(a.lang, d.lang),
|
lang: test(a.lang, d.lang),
|
||||||
|
onion: test(a.onion, d.onion),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use actix_files::Files;
|
use actix_files::Files;
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
use minify_html::{minify, Cfg};
|
use minify_html::{minify, Cfg};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -88,6 +88,10 @@ async fn main() -> io::Result<()> {
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(config.clone()))
|
.app_data(web::Data::new(config.clone()))
|
||||||
|
.wrap(DefaultHeaders::new().add((
|
||||||
|
"Onion-Location",
|
||||||
|
config.onion.as_deref().unwrap_or_default(),
|
||||||
|
)))
|
||||||
.service(index::page)
|
.service(index::page)
|
||||||
.service(agreements::security)
|
.service(agreements::security)
|
||||||
.service(agreements::humans)
|
.service(agreements::humans)
|
||||||
|
|
Loading…
Reference in a new issue