snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 7f6047268e915a3d8fac07103445d6e3fcc7ecc0
parent d135b3d8f0a90a2d3fbf1136a834a761349f0bd6
Author: default <nobody@localhost>
Date:   Wed,  1 Jan 2025 13:37:35 +0100

The shared post is really sent.

Diffstat:
Mhtml.c | 13+++++++++++--
Mhttpd.c | 2+-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c @@ -3514,9 +3514,18 @@ int html_get_handler(const xs_dict *req, const char *q_path, status = HTTP_STATUS_UNAUTHORIZED; } else { - const char *content = xs_dict_get(q_vars, "content"); + const char *b64 = xs_dict_get(q_vars, "content"); + int sz; + xs *content = xs_base64_dec(b64, &sz); + xs *msg = msg_note(&snac, content, NULL, NULL, NULL, 0); + xs *c_msg = msg_create(&snac, msg); + + timeline_add(&snac, xs_dict_get(msg, "id"), msg); + + enqueue_message(&snac, c_msg); + + snac_debug(&snac, 1, xs_fmt("web action 'share' received")); - srv_log(xs_fmt("shared post %s", content)); *body = xs_fmt("%s/admin", snac.actor); *b_size = strlen(*body); status = HTTP_STATUS_SEE_OTHER; diff --git a/httpd.c b/httpd.c @@ -282,7 +282,7 @@ int server_get_handler(xs_dict *req, const char *q_path, xs *s = NULL; if (xs_type(text) == XSTYPE_STRING) - s = xs_fmt("%s\n\n%s\n", text, url); + s = xs_fmt("%s:\n\n%s\n", text, url); else s = xs_fmt("%s\n", url);