From b3038057f813717c5afb0d03049aa3dd8de87717 Mon Sep 17 00:00:00 2001 From: Leechael Yim Date: Mon, 27 Oct 2025 23:54:37 +0800 Subject: [PATCH] feat: customize site name for VMM --- vmm/src/config.rs | 4 ++++ vmm/src/console.html | 2 +- vmm/src/main_routes.rs | 11 +++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 999b4a211..343652263 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -265,6 +265,10 @@ pub struct Config { /// The URL of the KMS server pub kms_url: String, + /// Node name (optional, used as prefix in UI title) + #[serde(default)] + pub node_name: String, + /// CVM configuration pub cvm: CvmConfig, /// Gateway configuration diff --git a/vmm/src/console.html b/vmm/src/console.html index c07a6f4e1..f9d0bd78e 100644 --- a/vmm/src/console.html +++ b/vmm/src/console.html @@ -10,7 +10,7 @@ - dstack VM Management Console + {{TITLE}} (ContentType, String) { - (ContentType::HTML, file_or_include_str!("console.html")) +async fn index(app: &State) -> (ContentType, String) { + let html = file_or_include_str!("console.html"); + let title = if app.config.node_name.is_empty() { + "dstack VM Management Console".to_string() + } else { + format!("{} - dstack VM Management Console", app.config.node_name) + }; + let html = html.replace("{{TITLE}}", &title); + (ContentType::HTML, html) } #[get("/res/")]