mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
WIP: start work on aquatic_http_private
This commit is contained in:
parent
f0a662e474
commit
11829f98eb
11 changed files with 2821 additions and 22 deletions
21
aquatic_http_private/src/workers/socket/routes.rs
Normal file
21
aquatic_http_private/src/workers/socket/routes.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use axum::{
|
||||
extract::{Path, RawQuery},
|
||||
headers::UserAgent,
|
||||
http::StatusCode,
|
||||
Extension, TypedHeader,
|
||||
};
|
||||
use sqlx::mysql::MySqlPool;
|
||||
|
||||
use super::db;
|
||||
|
||||
pub async fn announce(
|
||||
Extension(pool): Extension<MySqlPool>,
|
||||
opt_user_agent: Option<TypedHeader<UserAgent>>,
|
||||
Path(user_token): Path<String>,
|
||||
RawQuery(query): RawQuery,
|
||||
) -> Result<String, (StatusCode, String)> {
|
||||
match db::announce(&pool).await {
|
||||
Ok(r) => Ok(format!("{:?}", r)),
|
||||
Err(err) => Err((StatusCode::INTERNAL_SERVER_ERROR, err.to_string())),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue