summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-16 06:41:13 +0200
committerdefault <nobody@localhost>2023-04-16 06:41:13 +0200
commitfd0440dd758ed49936df62f7d7c72cd6320ef8d5 (patch)
treee86d8106570d2347d302ef0919373ef0bb090316 /mastoapi.c
parent6640bd726f95d340e6fa01ea21fd32d2696bc8c5 (diff)
Don't strip the api version in mastoapi post handler.
Diffstat (limited to 'mastoapi.c')
-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,
printf("%s\n", j);
}*/
- xs *cmd = xs_replace(q_path, "/api/v1", "");
+ xs *cmd = xs_replace(q_path, "/api", "");
snac snac = {0};
int logged_in = process_auth_token(&snac, req);
- if (strcmp(cmd, "/apps") == 0) {
+ if (strcmp(cmd, "/v1/apps") == 0) {
const char *name = xs_dict_get(args, "client_name");
const char *ruri = xs_dict_get(args, "redirect_uris");
const char *scope = xs_dict_get(args, "scope");
@@ -1236,7 +1236,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
}
}
else
- if (strcmp(cmd, "/statuses") == 0) {
+ if (strcmp(cmd, "/v1/statuses") == 0) {
if (logged_in) {
/* post a new Note */
/* {
@@ -1290,7 +1290,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
status = 401;
}
else
- if (xs_startswith(cmd, "/statuses")) {
+ if (xs_startswith(cmd, "/v1/statuses")) {
if (logged_in) {
/* operations on a status */
xs *l = xs_split(cmd, "/");
@@ -1377,7 +1377,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
status = 401;
}
else
- if (strcmp(cmd, "/notifications/clear") == 0) {
+ if (strcmp(cmd, "/v1/notifications/clear") == 0) {
if (logged_in) {
notify_clear(&snac);
timeline_touch(&snac);
@@ -1390,7 +1390,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
status = 401;
}
else
- if (strcmp(cmd, "/push/subscription") == 0) {
+ if (strcmp(cmd, "/v1/push/subscription") == 0) {
/* I don't know what I'm doing */
if (logged_in) {
char *v;