summaryrefslogtreecommitdiff
path: root/crates/chat-server/src/http.rs
diff options
context:
space:
mode:
authorDoan Luu Duc Tai <doan@luuduct.ai>2026-10-31 08:05:08 -0500
committerDoan Luu Duc Tai <doan@luuduct.ai>2026-10-31 08:05:08 -0500
commitfbb06ab09681079c01cc9b4eb13731ef17f4ab41 (patch)
tree9d052f079aa6e1db4e8b89d7f76529cd66d30c38 /crates/chat-server/src/http.rs
parentd809d86182ab802472ae7d5e74cab66ba7bfa397 (diff)
Show crypto download progress and centralize license links
Diffstat (limited to 'crates/chat-server/src/http.rs')
-rw-r--r--crates/chat-server/src/http.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/chat-server/src/http.rs b/crates/chat-server/src/http.rs
index 324c593..7394b71 100644
--- a/crates/chat-server/src/http.rs
+++ b/crates/chat-server/src/http.rs
@@ -20,7 +20,7 @@ use axum::{
body::Body,
extract::{DefaultBodyLimit, State},
http::{HeaderMap, HeaderValue, StatusCode},
- response::{IntoResponse, Response},
+ response::{IntoResponse, Redirect, Response},
routing::{get, post},
};
use serde_json::{Value, json};
@@ -94,6 +94,14 @@ async fn api(State(app): State<App>, headers: HeaderMap, Json(request): Json<Val
}
async fn asset(State(app): State<App>, uri: axum::http::Uri) -> Response {
+ if uri.path() == "/THIRD-PARTY-LICENSES.html" {
+ let Some(origin) = app.public.get("SITE_ORIGIN") else {
+ return secured(StatusCode::INTERNAL_SERVER_ERROR.into_response());
+ };
+ return secured(
+ Redirect::permanent(&format!("{origin}/THIRD-PARTY-LICENSES.html")).into_response(),
+ );
+ }
let (path, mime) = match uri.path() {
"/" => (
"crates/chat-server/web/index.html",
@@ -135,9 +143,6 @@ async fn asset(State(app): State<App>, uri: axum::http::Uri) -> Response {
},
"application/gzip",
),
- "/THIRD-PARTY-LICENSES.html" => {
- ("web/THIRD-PARTY-LICENSES.html", "text/html; charset=utf-8")
- }
"/LIMITATIONS.txt" => ("docs/CHAT-APPLICATION.txt", "text/plain; charset=utf-8"),
"/LICENSE" => ("LICENSE", "text/plain; charset=utf-8"),
_ => return secured(StatusCode::NOT_FOUND.into_response()),