commit fd0440d
default
·
2023-04-16 04:41:13 +0000 UTC
parent 6640bd7
Don't strip the api version in mastoapi post handler.
1 files changed,
+6,
-6
+6,
-6
1@@ -1194,12 +1194,12 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2 printf("%s\n", j);
3 }*/
4
5- xs *cmd = xs_replace(q_path, "/api/v1", "");
6+ xs *cmd = xs_replace(q_path, "/api", "");
7
8 snac snac = {0};
9 int logged_in = process_auth_token(&snac, req);
10
11- if (strcmp(cmd, "/apps") == 0) {
12+ if (strcmp(cmd, "/v1/apps") == 0) {
13 const char *name = xs_dict_get(args, "client_name");
14 const char *ruri = xs_dict_get(args, "redirect_uris");
15 const char *scope = xs_dict_get(args, "scope");
16@@ -1236,7 +1236,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
17 }
18 }
19 else
20- if (strcmp(cmd, "/statuses") == 0) {
21+ if (strcmp(cmd, "/v1/statuses") == 0) {
22 if (logged_in) {
23 /* post a new Note */
24 /* {
25@@ -1290,7 +1290,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
26 status = 401;
27 }
28 else
29- if (xs_startswith(cmd, "/statuses")) {
30+ if (xs_startswith(cmd, "/v1/statuses")) {
31 if (logged_in) {
32 /* operations on a status */
33 xs *l = xs_split(cmd, "/");
34@@ -1377,7 +1377,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
35 status = 401;
36 }
37 else
38- if (strcmp(cmd, "/notifications/clear") == 0) {
39+ if (strcmp(cmd, "/v1/notifications/clear") == 0) {
40 if (logged_in) {
41 notify_clear(&snac);
42 timeline_touch(&snac);
43@@ -1390,7 +1390,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
44 status = 401;
45 }
46 else
47- if (strcmp(cmd, "/push/subscription") == 0) {
48+ if (strcmp(cmd, "/v1/push/subscription") == 0) {
49 /* I don't know what I'm doing */
50 if (logged_in) {
51 char *v;