Browse Source

The shared post is really sent.

default 3 months ago
parent
commit
7f6047268e
2 changed files with 12 additions and 3 deletions
  1. 11 2
      html.c
  2. 1 1
      httpd.c

+ 11 - 2
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;

+ 1 - 1
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);