Skip to content

Commit

Permalink
add version to status page
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Sep 14, 2024
1 parent 010a0fb commit edc1911
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub enum RequestKind {
#[template(path = "index.html", escape = "none")]
struct IndexTemplate {
access: bool,
version : &'static str,
}

pub async fn logout_handler(resolver: &Arc<Resolver>, req: Request<Body>) -> impl IntoResponse {
Expand Down Expand Up @@ -119,7 +120,7 @@ pub async fn status_handler(resolver: &Arc<Resolver>, req: RequestKind) -> impl
Ok((Some(session), cookie)) => {
session.touch();

let index = IndexTemplate { access: true };
let index = IndexTemplate { access: true, version : crate::VERSION };

if let Some(cookie) = cookie {
Response::builder()
Expand Down Expand Up @@ -151,11 +152,11 @@ pub async fn status_handler(resolver: &Arc<Resolver>, req: RequestKind) -> impl
.body(Body::from(msg))
.unwrap(),
Err(Error::Unauthorized) => {
let index = IndexTemplate { access: false };
let index = IndexTemplate { access: false, version : crate::VERSION };
NoCacheHtml(index.render().unwrap()).into_response()
}
_ => {
let index = IndexTemplate { access: false };
let index = IndexTemplate { access: false, version : crate::VERSION };
NoCacheHtml(index.render().unwrap()).into_response()
}
}
Expand Down
2 changes: 2 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
<div class="menu">
<table>
<tr>
<td>Resolver v{{ version }}</td>
<td>|</td>
<td><input type="checkbox" id="offline" checked> <label for="offline">Offline</label></td>
<td><input type="checkbox" id="delegators"> <label for="delegators">Delegators</label></td>
<td><input type="checkbox" id="fqdn" checked> <label for="fqdn">FQDN</label></td>
Expand Down

0 comments on commit edc1911

Please sign in to comment.