Cleanup and perf

This commit is contained in:
nora 2025-07-03 19:44:03 +02:00
parent 61d78680e0
commit 79bb6d1eb0
6 changed files with 13 additions and 259 deletions

View file

@ -5,7 +5,7 @@ use axum::{
http::StatusCode,
response::{Html, IntoResponse, Response},
routing::get,
Json, Router,
Router,
};
use color_eyre::{eyre::Context, Result};
use serde::{Deserialize, Serialize};
@ -24,10 +24,7 @@ pub async fn webserver(db: Db) -> Result<()> {
.route("/build", get(web_build))
.route("/target", get(web_target))
.route("/nightly", get(web_nightly))
.route("/full-table", get(web_full_table))
.route("/index.css", get(index_css))
.route("/index.js", get(index_js))
.route("/full-mega-monster", get(full_mega_monster))
.with_state(AppState { db });
info!("Serving website on port 3000 (commit {})", crate::VERSION);
@ -240,9 +237,6 @@ async fn web_root(State(state): State<AppState>) -> impl IntoResponse {
}
}
async fn web_full_table() -> impl IntoResponse {
Html(include_str!("../static/full-table.html").replace("{{version}}", crate::VERSION))
}
async fn index_css() -> impl IntoResponse {
(
[(
@ -252,22 +246,6 @@ async fn index_css() -> impl IntoResponse {
include_str!("../static/index.css"),
)
}
async fn index_js() -> impl IntoResponse {
(
[(
axum::http::header::CONTENT_TYPE,
axum::http::HeaderValue::from_static("text/javascript"),
)],
include_str!("../static/index.js"),
)
}
async fn full_mega_monster(State(state): State<AppState>) -> impl IntoResponse {
state.db.full_mega_monster().await.map(Json).map_err(|err| {
error!(?err, "Error loading target state");
StatusCode::INTERNAL_SERVER_ERROR
})
}
#[derive(Serialize, Deserialize)]
struct TriggerBuildBody {