summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-09-30 09:29:28 +0200
committerdefault <nobody@localhost>2022-09-30 09:29:28 +0200
commit41767992960f4a60a34b212d9ae3d25e9ca2a3f8 (patch)
tree05ab8b9f3dc3ff8e6e02765f66b5554532f48721 /html.c
parent118ebac622b387973d60075f3a22d92ef3d8dd46 (diff)
Likes and Boosts can be done from the web interface.
Diffstat (limited to 'html.c')
-rw-r--r--html.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/html.c b/html.c
index 66c35f1..fc42fb3 100644
--- a/html.c
+++ b/html.c
@@ -810,6 +810,30 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
else
if (p_path && strcmp(p_path, "admin/action") == 0) {
/* action on an entry */
+ char *id = xs_dict_get(p_vars, "id");
+ char *actor = xs_dict_get(p_vars, "actor");
+ char *action = xs_dict_get(p_vars, "action");
+
+ if (action == NULL)
+ return 404;
+
+ if (strcmp(action, "Like") == 0) {
+ xs *msg = msg_admiration(&snac, id, "Like");
+ post(&snac, msg);
+ timeline_admire(&snac, id, snac.actor, 1);
+
+ status = 303;
+ }
+ else
+ if (strcmp(action, "Boost") == 0) {
+ xs *msg = msg_admiration(&snac, id, "Announce");
+ post(&snac, msg);
+ timeline_admire(&snac, id, snac.actor, 0);
+
+ status = 303;
+ }
+ else
+ status = 404;
}
else
if (p_path && strcmp(p_path, "admin/user-setup") == 0) {