Remove LazyLock (incompatible with older Rusts)
This commit is contained in:
parent
c60f36540e
commit
2c85624ec2
1 changed files with 28 additions and 34 deletions
|
|
@ -6,7 +6,7 @@ mod playlist;
|
||||||
mod streaming;
|
mod streaming;
|
||||||
mod torrents;
|
mod torrents;
|
||||||
|
|
||||||
use std::sync::{Arc, LazyLock};
|
use std::sync::Arc;
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
response::{IntoResponse, Redirect},
|
response::{IntoResponse, Redirect},
|
||||||
|
|
@ -32,8 +32,7 @@ async fn h_api_root(parts: Parts) -> impl IntoResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static API_ROOT_JSON: LazyLock<Arc<serde_json::Value>> = LazyLock::new(|| {
|
let json = serde_json::json!({
|
||||||
Arc::new(serde_json::json!({
|
|
||||||
"apis": {
|
"apis": {
|
||||||
"GET /": "list all available APIs",
|
"GET /": "list all available APIs",
|
||||||
"GET /dht/stats": "DHT stats",
|
"GET /dht/stats": "DHT stats",
|
||||||
|
|
@ -59,14 +58,9 @@ async fn h_api_root(parts: Parts) -> impl IntoResponse {
|
||||||
},
|
},
|
||||||
"server": "rqbit",
|
"server": "rqbit",
|
||||||
"version": env!("CARGO_PKG_VERSION"),
|
"version": env!("CARGO_PKG_VERSION"),
|
||||||
}))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(
|
([("Content-Type", "application/json")], axum::Json(json)).into_response()
|
||||||
[("Content-Type", "application/json")],
|
|
||||||
axum::Json(API_ROOT_JSON.clone()),
|
|
||||||
)
|
|
||||||
.into_response()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_api_router(state: ApiState) -> Router {
|
pub fn make_api_router(state: ApiState) -> Router {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue