From df8ebbd3e0e5b5edcfcbaa72ce7b6072dd25e597 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Tue, 7 Jul 2026 08:43:26 -0700 Subject: [PATCH] feat: add /build route (#6644) --- apps/labrinth/src/routes/index.rs | 17 ++++++++++++----- apps/labrinth/src/routes/mod.rs | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/labrinth/src/routes/index.rs b/apps/labrinth/src/routes/index.rs index 9a0f7ae568..96a5c17f50 100644 --- a/apps/labrinth/src/routes/index.rs +++ b/apps/labrinth/src/routes/index.rs @@ -1,9 +1,8 @@ use actix_web::{HttpResponse, get}; use serde_json::json; -#[get("/")] -pub async fn index_get() -> HttpResponse { - let data = json!({ +fn build_info() -> serde_json::Value { + json!({ "name": "modrinth-labrinth", "version": env!("CARGO_PKG_VERSION"), "documentation": "https://docs.modrinth.com", @@ -14,7 +13,15 @@ pub async fn index_get() -> HttpResponse { "git_hash": option_env!("GIT_HASH").unwrap_or("unknown"), "profile": env!("COMPILATION_PROFILE"), } - }); + }) +} - HttpResponse::Ok().json(data) +#[get("/")] +pub async fn index_get() -> HttpResponse { + HttpResponse::Ok().json(build_info()) +} + +#[get("/build")] +pub async fn build_get() -> HttpResponse { + HttpResponse::Ok().json(build_info()) } diff --git a/apps/labrinth/src/routes/mod.rs b/apps/labrinth/src/routes/mod.rs index 509e3c998a..e9e606deba 100644 --- a/apps/labrinth/src/routes/mod.rs +++ b/apps/labrinth/src/routes/mod.rs @@ -138,6 +138,7 @@ pub fn root_config(cfg: &mut web::ServiceConfig) { web::scope("") .wrap(default_cors()) .service(index::index_get) + .service(index::build_get) .service(Files::new("/", "assets/")), ); }