aboutsummaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2026-06-29 17:43:24 +0000
committerRuben Beltran del Rio <git@r.bdr.sh>2026-06-29 17:43:24 +0000
commit15d4dfc538dce7bfce4b0926b77f7f200cca99ff (patch)
treef0dbceb404d2bab3896ffd6b42ec4b41f8f01c7e /mastoapi.c
parent30849656518854f1ff5af2ad8e583ceb199d1fbd (diff)
parent25ccc2599aa722b0552193961d4cda15928112d8 (diff)
Merge branch 'master'HEADmain
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 9f79b97..cf2f53e 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -355,6 +355,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
else
if (strcmp(cmd, "/token") == 0) { /** **/
xs *wrk = NULL;
+ xs *codewrk = NULL;
const char *gtype = xs_dict_get(args, "grant_type");
const char *code = xs_dict_get(args, "code");
const char *cid = xs_dict_get(args, "client_id");
@@ -387,7 +388,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
I'm not sure of the impacts of this right now, but Subway Tooter does not
provide a code so one must be generated */
if (xs_is_null(code)){
- code = random_str();
+ code = codewrk = random_str();
}
if (gtype && code && cid && csec && ruri) {
xs *app = app_get(cid);
@@ -3435,6 +3436,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
xs *n_msg = msg_repulsion(&snac, id, "Like");
if (n_msg != NULL) {
+ object_user_cache_del(&snac, id, "admire");
enqueue_message(&snac, n_msg);
out = mastoapi_status(&snac, msg);
@@ -3456,6 +3458,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
xs *n_msg = msg_emoji_unreact(&snac, id, content);
if (n_msg != NULL) {
+ object_user_cache_del(&snac, id, "admire");
enqueue_message(&snac, n_msg);
out = mastoapi_status(&snac, msg);
@@ -4205,17 +4208,37 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path,
if (valid_status(timeline_get_by_md5(&snac, md5, &msg))) {
const char *content = xs_dict_get(args, "status");
xs *atls = xs_list_new();
- xs *f_content = not_really_markdown(content, &atls, NULL);
+ xs *tag = xs_list_new();
+ xs *f_content0 = not_really_markdown(content, &atls, &tag);
+ xs *f_content = process_tags(&snac, f_content0, &tag);
/* replace fields with new content */
msg = xs_dict_set(msg, "sourceContent", content);
msg = xs_dict_set(msg, "content", f_content);
+ xs *content_map = xs_dup(xs_dict_get(msg, "contentMap"));
+ if (xs_is_dict(content_map)) {
+ /* get the first pair */
+ const char *k, *v;
+ int c = 0;
+
+ if (xs_dict_next(content_map, &k, &v, &c)) {
+ content_map = xs_dict_set(content_map, k, f_content);
+ msg = xs_dict_set(msg, "contentMap", content_map);
+ }
+ }
+
xs *updated = xs_str_utctime(0, ISO_DATE_SPEC);
msg = xs_dict_set(msg, "updated", updated);
+ msg = xs_dict_set(msg, "tag", tag);
+
/* overwrite object, not updating the indexes */
- object_add_ow(xs_dict_get(msg, "id"), msg);
+ const char *id = xs_dict_get(msg, "id");
+
+ object_add_ow(id, msg);
+
+ tag_index(id, msg);
/* update message */
xs *c_msg = msg_update(&snac, msg);