summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-10 11:30:00 +0200
committerdefault <nobody@localhost>2023-04-10 11:30:00 +0200
commit862dafd066b2276550f7125692a6564a6f141339 (patch)
tree2e45771330305e87af7ac6f7aa39be07225a206c /mastoapi.c
parentea49eba4047455c5c1a241ca91094ae3584d7a48 (diff)
Some timeline fixes.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 0d2f53e..8b62397 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -443,12 +443,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const char *since_id = xs_dict_get(args, "since_id");
// const char *min_id = xs_dict_get(args, "min_id");
const char *limit_s = xs_dict_get(args, "limit");
- int limit = 20;
- int cnt = 0;
+ int limit = 0;
+ int cnt = 0;
if (!xs_is_null(limit_s))
limit = atoi(limit_s);
+ if (limit == 0)
+ limit = 20;
+
xs *timeline = timeline_simple_list(&snac, "private", 0, XS_ALL);
xs *out = xs_list_new();
@@ -495,13 +498,17 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
if (xs_is_null(display_name) || *display_name == '\0')
display_name = xs_dict_get(actor, "preferredUsername");
- const char *id = xs_dict_get(actor, "id");
+ const char *id = xs_dict_get(actor, "id");
+ const char *pub = xs_dict_get(actor, "published");
xs *acct_md5 = xs_md5_hex(id, strlen(id));
acct = xs_dict_append(acct, "id", acct_md5);
acct = xs_dict_append(acct, "username", xs_dict_get(actor, "preferredUsername"));
acct = xs_dict_append(acct, "acct", xs_dict_get(actor, "preferredUsername"));
acct = xs_dict_append(acct, "display_name", display_name);
- acct = xs_dict_append(acct, "created_at", xs_dict_get(actor, "published"));
+
+ if (pub)
+ acct = xs_dict_append(acct, "created_at", pub);
+
acct = xs_dict_append(acct, "note", xs_dict_get(actor, "summary"));
acct = xs_dict_append(acct, "url", id);
@@ -624,6 +631,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
*body = xs_json_dumps_pp(out, 4);
*ctype = "application/json";
status = 200;
+
+// printf("%s\n", *body);
}
else {
status = 401; // unauthorized