diff options
| -rw-r--r-- | html.c | 24 |
1 files changed, 24 insertions, 0 deletions
| @@ -810,6 +810,30 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 810 | else | 810 | else |
| 811 | if (p_path && strcmp(p_path, "admin/action") == 0) { | 811 | if (p_path && strcmp(p_path, "admin/action") == 0) { |
| 812 | /* action on an entry */ | 812 | /* action on an entry */ |
| 813 | char *id = xs_dict_get(p_vars, "id"); | ||
| 814 | char *actor = xs_dict_get(p_vars, "actor"); | ||
| 815 | char *action = xs_dict_get(p_vars, "action"); | ||
| 816 | |||
| 817 | if (action == NULL) | ||
| 818 | return 404; | ||
| 819 | |||
| 820 | if (strcmp(action, "Like") == 0) { | ||
| 821 | xs *msg = msg_admiration(&snac, id, "Like"); | ||
| 822 | post(&snac, msg); | ||
| 823 | timeline_admire(&snac, id, snac.actor, 1); | ||
| 824 | |||
| 825 | status = 303; | ||
| 826 | } | ||
| 827 | else | ||
| 828 | if (strcmp(action, "Boost") == 0) { | ||
| 829 | xs *msg = msg_admiration(&snac, id, "Announce"); | ||
| 830 | post(&snac, msg); | ||
| 831 | timeline_admire(&snac, id, snac.actor, 0); | ||
| 832 | |||
| 833 | status = 303; | ||
| 834 | } | ||
| 835 | else | ||
| 836 | status = 404; | ||
| 813 | } | 837 | } |
| 814 | else | 838 | else |
| 815 | if (p_path && strcmp(p_path, "admin/user-setup") == 0) { | 839 | if (p_path && strcmp(p_path, "admin/user-setup") == 0) { |