summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-05-05 11:11:32 +0200
committerdefault <nobody@localhost>2024-05-05 11:11:32 +0200
commitddd2af73bd2b61b13e3b7d3928184d34d4729abd (patch)
treeb77b82f78347ecf29bede40f5f2162135cf92b5e /httpd.c
parent45357b8e6e36f973fc09c0a82a633e2d08b34eda (diff)
Search by tag returns RSS if the appropriate header is defined.
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/httpd.c b/httpd.c
index bda8159..30367c8 100644
--- a/httpd.c
+++ b/httpd.c
@@ -169,8 +169,6 @@ int server_get_handler(xs_dict *req, const char *q_path,
{
int status = 0;
- (void)req;
-
/* is it the server root? */
if (*q_path == '\0') {
xs_dict *q_vars = xs_dict_get(req, "q_vars");
@@ -195,7 +193,15 @@ int server_get_handler(xs_dict *req, const char *q_path,
more = 1;
}
- *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0);
+ char *accept = xs_dict_get(req, "accept");
+ if (!xs_is_null(accept) && strcmp(accept, "application/rss+xml") == 0) {
+ xs *link = xs_fmt("%s/?t=%s", srv_baseurl, t);
+
+ *body = timeline_to_rss(NULL, tl, link, link, link);
+ *ctype = "application/rss+xml; charset=utf-8";
+ }
+ else
+ *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0);
}
else
if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {