Skip to content

Commit 535eb5d

Browse files
committed
feat: server identity endpoint
1 parent 97c5f69 commit 535eb5d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src-tauri/src/http/routes/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ mod data;
88
mod items;
99
mod oauth;
1010
mod overlay;
11+
mod server;
1112
mod sounds;
1213

1314
pub fn router() -> Router {
1415
Router::new()
16+
// Get server details
17+
.route("/server/details", get(server::details))
1518
// OAuth complete page and OAuth complete endpoint
1619
.route("/oauth", get(oauth::handle_oauth))
1720
.route("/oauth/complete", post(oauth::handle_oauth_complete))

src-tauri/src/http/routes/server.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use axum::Json;
2+
use serde::Serialize;
3+
4+
#[derive(Serialize)]
5+
pub struct ServerDetails {
6+
pub identifier: &'static str,
7+
}
8+
9+
const IDENTIFIER: &str = "VTFTK_SERVER";
10+
11+
/// GET /server/details
12+
///
13+
/// Get simple details about the server, used to check if a server
14+
/// is alive by clients
15+
pub async fn details() -> Json<ServerDetails> {
16+
Json(ServerDetails {
17+
identifier: IDENTIFIER,
18+
})
19+
}

0 commit comments

Comments
 (0)