Skip to content

Commit 86e9c86

Browse files
committed
web: using template for HTML and CSS + add version info
1 parent e1d1e80 commit 86e9c86

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/web.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use axum::{
88
use std::path::PathBuf;
99
use std::sync::{Arc, Mutex};
1010

11+
const TEMPLATE: &str = include_str!("../static/index.html");
12+
const PICO_CSS: &str = include_str!("../static/pico.min.css");
13+
1114
#[derive(Clone)]
1215
pub struct AppState {
1316
pub config: Arc<Mutex<AppConfig>>,
@@ -22,7 +25,12 @@ pub fn app(state: Arc<AppState>) -> Router {
2225
}
2326

2427
async fn index() -> impl IntoResponse {
25-
Html(include_str!("../static/index.html"))
28+
let html = TEMPLATE
29+
.replace("{BUILD_DATE}", env!("BUILD_DATE"))
30+
.replace("{GIT_DATE}", env!("GIT_DATE"))
31+
.replace("{GIT_HASH}", env!("GIT_HASH"))
32+
.replace("{PICO_CSS}", PICO_CSS);
33+
Html(html)
2634
}
2735

2836
async fn get_config(State(state): State<Arc<AppState>>) -> impl IntoResponse {

0 commit comments

Comments
 (0)