From acd1bf0ec081e13b46fad94d5ffbff4f2bb636e8 Mon Sep 17 00:00:00 2001 From: LDA Date: Thu, 15 Aug 2024 11:00:58 +0200 Subject: [PATCH] [MOD/WIP] Fix broken Cinny UIA and state changes --- .gitignore | 1 + src/Routes.c | 1 + src/Uia.c | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 185a166..ecaf4a3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ contrib/.vagrant src/Schema src/include/Schema man/mandoc.db +*swp diff --git a/src/Routes.c b/src/Routes.c index 1bd8f46..bbae407 100644 --- a/src/Routes.c +++ b/src/Routes.c @@ -78,6 +78,7 @@ RouterBuild(void) R("/_matrix/client/v3/rooms/(.*)/send/(.*)/(.*)", RouteSendEvent); R("/_matrix/client/v3/rooms/(.*)/state/(.*)/(.*)", RouteSendState); + R("/_matrix/client/v3/rooms/(.*)/state/(.*)", RouteSendState); R("/_matrix/client/v3/rooms/(.*)/event/(.*)", RouteFetchEvent); R("/_matrix/client/v3/rooms/(.*)/join", RouteJoinRoom); R("/_matrix/client/v3/rooms/(.*)/messages", RouteMessages); diff --git a/src/Uia.c b/src/Uia.c index 622d3a9..189677e 100644 --- a/src/Uia.c +++ b/src/Uia.c @@ -312,15 +312,16 @@ UiaComplete(Array * flows, HttpServerContext * context, Db * db, } } - /* TODO: The type may sometimes be omitted. */ + /* TODO: The type may sometimes be omitted. This means it is implied + * from context. */ val = HashMapGet(auth, "type"); if (!val || JsonValueType(val) != JSON_STRING) { - msg = "'auth->type' is unset or not a string."; - HttpResponseStatus(context, HTTP_BAD_REQUEST); - *response = MatrixErrorCreate(M_BAD_JSON, msg); - ret = 0; + /* TODO: Clients may want to retrieve the flowlist. + * Still stupid, but eh. */ + HttpResponseStatus(context, HTTP_UNAUTHORIZED); + ret = BuildResponse(flows, db, response, session, dbRef); goto finish; }