mirror of
https://github.com/Xevion/banner.git
synced 2025-12-05 23:14:20 -06:00
feat: display project version on frontend
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -218,7 +218,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "banner"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "banner"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
edition = "2024"
|
||||
default-run = "banner"
|
||||
|
||||
|
||||
@@ -102,9 +102,8 @@ pub fn create_router(state: BannerState) -> Router {
|
||||
};
|
||||
|
||||
// Format latency, status, and code
|
||||
let (latency_str, status, code) = (
|
||||
let (latency_str, status) = (
|
||||
format!("{latency:.2?}"),
|
||||
response.status().as_u16(),
|
||||
format!(
|
||||
"{} {}",
|
||||
response.status().as_u16(),
|
||||
@@ -114,19 +113,9 @@ pub fn create_router(state: BannerState) -> Router {
|
||||
|
||||
// Log in warn if latency is above threshold, otherwise debug
|
||||
if latency > latency_threshold {
|
||||
warn!(
|
||||
latency = latency_str,
|
||||
status = status,
|
||||
code = code,
|
||||
"Response"
|
||||
);
|
||||
warn!(latency = latency_str, status = status, "Response");
|
||||
} else {
|
||||
debug!(
|
||||
latency = latency_str,
|
||||
status = status,
|
||||
code = code,
|
||||
"Response"
|
||||
);
|
||||
debug!(latency = latency_str, status = status, "Response");
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -227,6 +216,7 @@ async fn status(State(_state): State<BannerState>) -> Json<Value> {
|
||||
// For now, return basic status without accessing private fields
|
||||
Json(json!({
|
||||
"status": "operational",
|
||||
"version": env!("CARGO_PKG_VERSION"),
|
||||
"bot": {
|
||||
"status": "running",
|
||||
"uptime": "TODO: implement uptime tracking"
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface HealthResponse {
|
||||
|
||||
export interface StatusResponse {
|
||||
status: string;
|
||||
version: string;
|
||||
bot: {
|
||||
status: string;
|
||||
uptime: string;
|
||||
|
||||
@@ -234,27 +234,54 @@ function App() {
|
||||
</Flex>
|
||||
</Card>
|
||||
)}
|
||||
{status?.git?.commit && (
|
||||
<Flex justify="center" style={{ marginTop: "12px" }}>
|
||||
<Text
|
||||
size="1"
|
||||
style={{
|
||||
color: "#8B949E",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
<a
|
||||
href={`https://github.com/Xevion/banner/commit/${status.git.commit}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
{(status?.git?.commit || status?.version) && (
|
||||
<Flex
|
||||
justify="center"
|
||||
style={{ marginTop: "12px" }}
|
||||
gap="2"
|
||||
align="center"
|
||||
>
|
||||
{status?.version && (
|
||||
<Text
|
||||
size="1"
|
||||
style={{
|
||||
color: "inherit",
|
||||
color: "#8B949E",
|
||||
}}
|
||||
>
|
||||
v{status.version}
|
||||
</Text>
|
||||
)}
|
||||
{status?.version && status?.git?.commit && (
|
||||
<div
|
||||
style={{
|
||||
width: "1px",
|
||||
height: "12px",
|
||||
backgroundColor: "#8B949E",
|
||||
opacity: 0.3,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{status?.git?.commit && (
|
||||
<Text
|
||||
size="1"
|
||||
style={{
|
||||
color: "#8B949E",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
</Text>
|
||||
<a
|
||||
href={`https://github.com/Xevion/banner/commit/${status.git.commit}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
style={{
|
||||
color: "inherit",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
</Text>
|
||||
)}
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
|
||||
Reference in New Issue
Block a user