More web ui search tweaks baaaaah I'm boring.

This commit is contained in:
default 2024-05-10 11:55:45 +02:00
parent 1632e009a4
commit 5d1577af3c
2 changed files with 13 additions and 6 deletions

11
data.c
View File

@ -2499,8 +2499,10 @@ xs_list *content_search(snac *user, const char *regex,
return xs_list_new();
xs_set seen;
xs_set skipped;
xs_set_init(&seen);
xs_set_init(&skipped);
if (max_secs == 0)
max_secs = 3;
@ -2592,13 +2594,18 @@ xs_list *content_search(snac *user, const char *regex,
xs *l = xs_regex_select_n(c, regex, 1);
if (xs_list_len(l)) {
if (skip > 0)
if (skip > 0) {
if (xs_set_add(&skipped, md5) == 1)
skip--;
else
}
else {
if (xs_set_add(&seen, md5) == 1)
show--;
}
}
}
xs_set_free(&skipped);
return xs_set_result(&seen);
}

2
html.c
View File

@ -2578,7 +2578,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
else
title = xs_fmt(L("Nothing found for '%s'"), q);
*body = html_timeline(&snac, tl, 0, skip, show, tl_len > 0, title, page, 1);
*body = html_timeline(&snac, tl, 0, skip, tl_len, tl_len > 0, title, page, 1);
*b_size = strlen(*body);
status = 200;
}