summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-04-16 06:41:13 +0200
committerGravatar default2023-04-16 06:41:13 +0200
commitfd0440dd758ed49936df62f7d7c72cd6320ef8d5 (patch)
treee86d8106570d2347d302ef0919373ef0bb090316
parentUpdated RELEASE_NOTES. (diff)
downloadpenes-snac2-fd0440dd758ed49936df62f7d7c72cd6320ef8d5.tar.gz
penes-snac2-fd0440dd758ed49936df62f7d7c72cd6320ef8d5.tar.xz
penes-snac2-fd0440dd758ed49936df62f7d7c72cd6320ef8d5.zip
Don't strip the api version in mastoapi post handler.
-rw-r--r--mastoapi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 5ab1282..1668718 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1194,12 +1194,12 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1194 printf("%s\n", j); 1194 printf("%s\n", j);
1195 }*/ 1195 }*/
1196 1196
1197 xs *cmd = xs_replace(q_path, "/api/v1", ""); 1197 xs *cmd = xs_replace(q_path, "/api", "");
1198 1198
1199 snac snac = {0}; 1199 snac snac = {0};
1200 int logged_in = process_auth_token(&snac, req); 1200 int logged_in = process_auth_token(&snac, req);
1201 1201
1202 if (strcmp(cmd, "/apps") == 0) { 1202 if (strcmp(cmd, "/v1/apps") == 0) {
1203 const char *name = xs_dict_get(args, "client_name"); 1203 const char *name = xs_dict_get(args, "client_name");
1204 const char *ruri = xs_dict_get(args, "redirect_uris"); 1204 const char *ruri = xs_dict_get(args, "redirect_uris");
1205 const char *scope = xs_dict_get(args, "scope"); 1205 const char *scope = xs_dict_get(args, "scope");
@@ -1236,7 +1236,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1236 } 1236 }
1237 } 1237 }
1238 else 1238 else
1239 if (strcmp(cmd, "/statuses") == 0) { 1239 if (strcmp(cmd, "/v1/statuses") == 0) {
1240 if (logged_in) { 1240 if (logged_in) {
1241 /* post a new Note */ 1241 /* post a new Note */
1242/* { 1242/* {
@@ -1290,7 +1290,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1290 status = 401; 1290 status = 401;
1291 } 1291 }
1292 else 1292 else
1293 if (xs_startswith(cmd, "/statuses")) { 1293 if (xs_startswith(cmd, "/v1/statuses")) {
1294 if (logged_in) { 1294 if (logged_in) {
1295 /* operations on a status */ 1295 /* operations on a status */
1296 xs *l = xs_split(cmd, "/"); 1296 xs *l = xs_split(cmd, "/");
@@ -1377,7 +1377,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1377 status = 401; 1377 status = 401;
1378 } 1378 }
1379 else 1379 else
1380 if (strcmp(cmd, "/notifications/clear") == 0) { 1380 if (strcmp(cmd, "/v1/notifications/clear") == 0) {
1381 if (logged_in) { 1381 if (logged_in) {
1382 notify_clear(&snac); 1382 notify_clear(&snac);
1383 timeline_touch(&snac); 1383 timeline_touch(&snac);
@@ -1390,7 +1390,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1390 status = 401; 1390 status = 401;
1391 } 1391 }
1392 else 1392 else
1393 if (strcmp(cmd, "/push/subscription") == 0) { 1393 if (strcmp(cmd, "/v1/push/subscription") == 0) {
1394 /* I don't know what I'm doing */ 1394 /* I don't know what I'm doing */
1395 if (logged_in) { 1395 if (logged_in) {
1396 char *v; 1396 char *v;