commit 9fcff14

default  ·  2025-01-05 15:53:30 +0000 UTC
parent e2a8a9c
New configuration directive "max_public_entries".
2 files changed,  +6, -4
M html.c
+3, -3
 1@@ -2919,12 +2919,12 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
 2         xs *id = xs_fmt("%s/%s", snac.actor, p_path);
 3         xs *list = xs_list_new();
 4         const char *v;
 5-        int tc = 0;
 6+        int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20"));
 7 
 8         /* get the public outbox or the pinned list */
 9-        xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, 20) : pinned_list(&snac);
10+        xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, cnt) : pinned_list(&snac);
11 
12-        while (xs_list_next(elems, &v, &tc)) {
13+        xs_list_foreach(elems, v) {
14             xs *i = NULL;
15 
16             if (valid_status(object_get_by_md5(v, &i))) {
M html.c
+3, -1
 1@@ -3423,7 +3423,9 @@ int html_get_handler(const xs_dict *req, const char *q_path,
 2         if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE)
 3             return HTTP_STATUS_FORBIDDEN;
 4 
 5-        xs *elems = timeline_simple_list(&snac, "public", 0, 20);
 6+        int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20"));
 7+
 8+        xs *elems = timeline_simple_list(&snac, "public", 0, cnt);
 9         xs *bio   = xs_dup(xs_dict_get(snac.config, "bio"));
10 
11         xs *rss_title = xs_fmt("%s (@%s@%s)",