Finished moving to client.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2026-03-26 08:26:01 -04:00
parent 24edca6415
commit 678e433632
2 changed files with 8 additions and 146 deletions

View File

@@ -55,7 +55,7 @@ async fn create_app(state: MoreThanText) -> Router {
#[allow(dead_code)]
#[derive(Clone)]
struct SessionID(Uuid);
struct SessionID(String);
impl<S> FromRequestParts<S> for SessionID
where
@@ -73,9 +73,11 @@ where
let requested = req_id.clone();
let (tx, mut rx) = channel(1);
spawn(async move {
tx.send(state.validate_session(requested, None))
.await
.unwrap();
let id = match requested {
Some(data) => state.client_with_session(data, None).session_id(),
None => state.client().session_id(),
};
tx.send(id).await.unwrap();
});
let id = rx.recv().await.unwrap();
if !req_id.is_some_and(|x| x == id.to_string()) {
@@ -86,7 +88,7 @@ where
}
async fn mtt_conn(
_sess_id: SessionID,
sess_id: SessionID,
method: Method,
path: Path<HashMap<String, String>>,
state: State<MoreThanText>,
@@ -94,6 +96,7 @@ async fn mtt_conn(
) -> impl IntoResponse {
let (tx, mut rx) = channel(1);
spawn(async move {
let client = state.client_with_session(sess_id.0, None);
match method {
Method::GET => match path.get("document") {
Some(doc) => tx.send(state.get_document(doc, "home")).await.unwrap(),