commit 862dafd
default
·
2023-04-10 09:30:00 +0000 UTC
parent ea49eba
Some timeline fixes.
1 files changed,
+13,
-4
+13,
-4
1@@ -443,12 +443,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 const char *since_id = xs_dict_get(args, "since_id");
3 // const char *min_id = xs_dict_get(args, "min_id");
4 const char *limit_s = xs_dict_get(args, "limit");
5- int limit = 20;
6- int cnt = 0;
7+ int limit = 0;
8+ int cnt = 0;
9
10 if (!xs_is_null(limit_s))
11 limit = atoi(limit_s);
12
13+ if (limit == 0)
14+ limit = 20;
15+
16 xs *timeline = timeline_simple_list(&snac, "private", 0, XS_ALL);
17
18 xs *out = xs_list_new();
19@@ -495,13 +498,17 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
20 if (xs_is_null(display_name) || *display_name == '\0')
21 display_name = xs_dict_get(actor, "preferredUsername");
22
23- const char *id = xs_dict_get(actor, "id");
24+ const char *id = xs_dict_get(actor, "id");
25+ const char *pub = xs_dict_get(actor, "published");
26 xs *acct_md5 = xs_md5_hex(id, strlen(id));
27 acct = xs_dict_append(acct, "id", acct_md5);
28 acct = xs_dict_append(acct, "username", xs_dict_get(actor, "preferredUsername"));
29 acct = xs_dict_append(acct, "acct", xs_dict_get(actor, "preferredUsername"));
30 acct = xs_dict_append(acct, "display_name", display_name);
31- acct = xs_dict_append(acct, "created_at", xs_dict_get(actor, "published"));
32+
33+ if (pub)
34+ acct = xs_dict_append(acct, "created_at", pub);
35+
36 acct = xs_dict_append(acct, "note", xs_dict_get(actor, "summary"));
37 acct = xs_dict_append(acct, "url", id);
38
39@@ -624,6 +631,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
40 *body = xs_json_dumps_pp(out, 4);
41 *ctype = "application/json";
42 status = 200;
43+
44+// printf("%s\n", *body);
45 }
46 else {
47 status = 401; // unauthorized