The /admin page now accepts ?q=regex for a content search.

This commit is contained in:
default 2024-05-09 10:04:45 +02:00
parent 7b0e9285af
commit a5766a6c83

13
html.c
View file

@ -2559,6 +2559,18 @@ int html_get_handler(const xs_dict *req, const char *q_path,
*body = xs_dup(uid); *body = xs_dup(uid);
status = 401; status = 401;
} }
else {
char *q = xs_dict_get(q_vars, "q");
if (q && *q) {
/* search by content */
int to = 0;
xs *tl = content_search(&snac, q, 1, 0, show, &to);
*body = html_timeline(&snac, tl, 0, 0, show, 0, NULL, "/admin", 1);
*b_size = strlen(*body);
status = 200;
}
else { else {
double t = history_mtime(&snac, "timeline.html_"); double t = history_mtime(&snac, "timeline.html_");
@ -2592,6 +2604,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
} }
} }
} }
}
else else
if (xs_startswith(p_path, "admin/p/")) { /** unique post by md5 **/ if (xs_startswith(p_path, "admin/p/")) { /** unique post by md5 **/
if (!login(&snac, req)) { if (!login(&snac, req)) {