chore: WebServer in config as vector for Multiples Webs
This commit is contained in:
parent
899566c9a2
commit
2f305ffecf
4 changed files with 23 additions and 14 deletions
|
|
@ -31,7 +31,7 @@ pub async fn login_handler (
|
|||
let mut ctx = reqenv.ctx();
|
||||
let req_module = "";
|
||||
let app_module: &str;
|
||||
if ! req_module.is_empty() && req_module != reqenv.config().default_module.as_str() {
|
||||
if ! req_module.is_empty() && req_module != reqenv.websrvr().default_module.as_str() {
|
||||
app_module = req_module;
|
||||
} else {
|
||||
app_module = "";
|
||||
|
|
@ -45,7 +45,7 @@ pub async fn login_handler (
|
|||
match reqenv
|
||||
.render_page(
|
||||
&mut ctx,
|
||||
reqenv.config().templates_path.as_str(),
|
||||
reqenv.websrvr().templates_path.as_str(),
|
||||
"login/index.html",
|
||||
"index.html",
|
||||
format!("login/{}.toml", lang.to_owned())
|
||||
|
|
@ -95,9 +95,9 @@ pub async fn loginin_handler(
|
|||
Ok(token) => // Ok(token.to_string()),o
|
||||
match reqenv.check_authentication(token.to_owned()).await {
|
||||
Ok(usrctx) => {
|
||||
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.config().resources_path,&body.mapkey,&usrctx.user_id);
|
||||
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.websrvr().resources_path,&body.mapkey,&usrctx.user_id);
|
||||
if ! std::path::Path::new(&path).exists() {
|
||||
path = format!("{}/profiles/{}/defs.yaml",reqenv.config().resources_path,&prfx);
|
||||
path = format!("{}/profiles/{}/defs.yaml",reqenv.websrvr().resources_path,&prfx);
|
||||
}
|
||||
let content = Profile::load_fs_content(path.into());
|
||||
// let lang = opts.lang.unwrap_or_else(|| String::from("es"));
|
||||
|
|
@ -144,9 +144,9 @@ pub async fn checkin_handler(
|
|||
// let allow_origin = reqenv.config().allow_origin;
|
||||
match &reqenv.check_authentication(body.data.to_owned()).await {
|
||||
Ok(usrctx) => { // Ok(token.to_string()),
|
||||
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.config().resources_path,&body.mapkey,&usrctx.user_id);
|
||||
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.websrvr().resources_path,&body.mapkey,&usrctx.user_id);
|
||||
if ! std::path::Path::new(&path).exists() {
|
||||
path = format!("{}/profiles/{}/defs.yaml",reqenv.config().resources_path,&body.mapkey);
|
||||
path = format!("{}/profiles/{}/defs.yaml",reqenv.websrvr().resources_path,&body.mapkey);
|
||||
}
|
||||
let content = Profile::load_fs_content(path.into());
|
||||
let res = Profile::to_yaml(content);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue