snac2

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

commit 9fcff1467e0eb4a095373de5f27e10fa8200fa16
parent e2a8a9cb9d717f31eb55f7dd9384d67b1b969dc3
Author: default <nobody@localhost>
Date:   Sun,  5 Jan 2025 16:53:30 +0100

New configuration directive "max_public_entries".

Diffstat:
Mactivitypub.c | 6+++---
Mhtml.c | 4+++-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/activitypub.c b/activitypub.c @@ -2919,12 +2919,12 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path, xs *id = xs_fmt("%s/%s", snac.actor, p_path); xs *list = xs_list_new(); const char *v; - int tc = 0; + int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20")); /* get the public outbox or the pinned list */ - xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, 20) : pinned_list(&snac); + xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, cnt) : pinned_list(&snac); - while (xs_list_next(elems, &v, &tc)) { + xs_list_foreach(elems, v) { xs *i = NULL; if (valid_status(object_get_by_md5(v, &i))) { diff --git a/html.c b/html.c @@ -3423,7 +3423,9 @@ int html_get_handler(const xs_dict *req, const char *q_path, if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) return HTTP_STATUS_FORBIDDEN; - xs *elems = timeline_simple_list(&snac, "public", 0, 20); + int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20")); + + xs *elems = timeline_simple_list(&snac, "public", 0, cnt); xs *bio = xs_dup(xs_dict_get(snac.config, "bio")); xs *rss_title = xs_fmt("%s (@%s@%s)",