Skip to content

Commit 15a50ed

Browse files
committed
Render the {{TITLE}}
1 parent 227b474 commit 15a50ed

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

vmm/src/console_beta.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<head>
99
<meta charset="UTF-8">
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11-
<title>{{TITLE}} | dstack-vmm</title>
11+
<title>{{TITLE}}</title>
1212
<style>
1313
/* SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
1414
SPDX-License-Identifier: Apache-2.0 */

vmm/src/main_routes.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,27 @@ macro_rules! file_or_include_str {
2727
};
2828
}
2929

30-
#[get("/")]
31-
async fn index(app: &State<App>) -> (ContentType, String) {
32-
let html = file_or_include_str!("console.html");
30+
fn replace_title(app: &App, html: &str) -> String {
3331
let title = if app.config.node_name.is_empty() {
34-
"dstack VM Management Console".to_string()
32+
"dstack-vmm".to_string()
3533
} else {
36-
format!("{} - dstack VM Management Console", app.config.node_name)
34+
format!("{} | dstack-vmm", app.config.node_name)
3735
};
38-
let html = html.replace("{{TITLE}}", &title);
36+
html.replace("{{TITLE}}", &title)
37+
}
38+
39+
#[get("/")]
40+
async fn index(app: &State<App>) -> (ContentType, String) {
41+
let html = file_or_include_str!("console.html");
42+
let html = replace_title(&app, &html);
3943
(ContentType::HTML, html)
4044
}
4145

4246
#[get("/beta")]
43-
async fn beta() -> (ContentType, String) {
44-
(ContentType::HTML, file_or_include_str!("console_beta.html"))
47+
async fn beta(app: &State<App>) -> (ContentType, String) {
48+
let html = file_or_include_str!("console_beta.html");
49+
let html = replace_title(&app, &html);
50+
(ContentType::HTML, html)
4551
}
4652

4753
#[get("/res/<path>")]

vmm/ui/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<head>
99
<meta charset="UTF-8">
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11-
<title>{{TITLE}} | dstack-vmm</title>
11+
<title>{{TITLE}}</title>
1212
<link rel="stylesheet" href="./styles/main.css">
1313
</head>
1414

0 commit comments

Comments
 (0)