mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-21 22:37:43 +00:00
server/rest: add console to index
register the console template and render it when the 'console' parameter is given Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
9993f4d099
commit
054951682d
@ -319,11 +319,14 @@ fn get_index(username: Option<String>, token: Option<String>, api: &Arc<ApiConfi
|
|||||||
let token = token.unwrap_or_else(|| String::from(""));
|
let token = token.unwrap_or_else(|| String::from(""));
|
||||||
|
|
||||||
let mut debug = false;
|
let mut debug = false;
|
||||||
|
let mut template_file = "index";
|
||||||
|
|
||||||
if let Some(query_str) = parts.uri.query() {
|
if let Some(query_str) = parts.uri.query() {
|
||||||
for (k, v) in form_urlencoded::parse(query_str.as_bytes()).into_owned() {
|
for (k, v) in form_urlencoded::parse(query_str.as_bytes()).into_owned() {
|
||||||
if k == "debug" && v != "0" && v != "false" {
|
if k == "debug" && v != "0" && v != "false" {
|
||||||
debug = true;
|
debug = true;
|
||||||
|
} else if k == "console" {
|
||||||
|
template_file = "console";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,12 +340,12 @@ fn get_index(username: Option<String>, token: Option<String>, api: &Arc<ApiConfi
|
|||||||
|
|
||||||
let mut ct = "text/html";
|
let mut ct = "text/html";
|
||||||
|
|
||||||
let index = match api.render_template("index", &data) {
|
let index = match api.render_template(template_file, &data) {
|
||||||
Ok(index) => index,
|
Ok(index) => index,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
ct = "text/plain";
|
ct = "text/plain";
|
||||||
format!("Error rendering template: {}", err)
|
format!("Error rendering template: {}", err)
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Response::builder()
|
Response::builder()
|
||||||
|
Loading…
Reference in New Issue
Block a user