chore: WebServer in config as vector for Multiples Webs

This commit is contained in:
Jesús Pérez Lorenzo 2021-09-07 14:58:48 +01:00
parent 899566c9a2
commit 2f305ffecf
4 changed files with 23 additions and 14 deletions

View file

@ -60,7 +60,7 @@ pub async fn upload_handler (
let mut ctx = req.ctx();
let req_module = "";
let app_module: &str;
if ! req_module.is_empty() && req_module != req.config().default_module.as_str() {
if ! req_module.is_empty() && req_module != req.websrvr().default_module.as_str() {
app_module = req_module;
} else {
app_module = "";
@ -73,7 +73,7 @@ pub async fn upload_handler (
match req
.render_page(
&mut ctx,
req.config().templates_path.as_str(),
req.websrvr().templates_path.as_str(),
"upload/index.html",
"index.html",
format!("upload/{}.toml", lang.to_owned())
@ -135,7 +135,7 @@ pub async fn uploadin_handler(
// let allow_origin = req.config().allow_origin;
match req.user_authentication().await {
Ok(auth) => {
let mut files_path = format!("{}/{}", req.config().upload_path,&auth.user_id);
let mut files_path = format!("{}/{}", req.websrvr().upload_path,&auth.user_id);
if ! std::path::Path::new(&files_path).exists() {
std::fs::create_dir(&files_path).unwrap_or_else(|e| { println!("Error create dir {}: {}", &files_path,e); files_path = String::from("");});
if files_path.is_empty() {