commit ddd2af7

default  ·  2024-05-05 09:11:32 +0000 UTC
parent 45357b8
Search by tag returns RSS if the appropriate header is defined.
1 files changed,  +9, -3
+9, -3
 1@@ -169,8 +169,6 @@ int server_get_handler(xs_dict *req, const char *q_path,
 2 {
 3     int status = 0;
 4 
 5-    (void)req;
 6-
 7     /* is it the server root? */
 8     if (*q_path == '\0') {
 9         xs_dict *q_vars = xs_dict_get(req, "q_vars");
10@@ -195,7 +193,15 @@ int server_get_handler(xs_dict *req, const char *q_path,
11                 more = 1;
12             }
13 
14-            *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0);
15+            char *accept = xs_dict_get(req, "accept");
16+            if (!xs_is_null(accept) && strcmp(accept, "application/rss+xml") == 0) {
17+                xs *link = xs_fmt("%s/?t=%s", srv_baseurl, t);
18+
19+                *body = timeline_to_rss(NULL, tl, link, link, link);
20+                *ctype = "application/rss+xml; charset=utf-8";
21+            }
22+            else
23+                *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0);
24         }
25         else
26         if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {