diff options
| author | 2024-05-05 11:11:32 +0200 | |
|---|---|---|
| committer | 2024-05-05 11:11:32 +0200 | |
| commit | ddd2af73bd2b61b13e3b7d3928184d34d4729abd (patch) | |
| tree | b77b82f78347ecf29bede40f5f2162135cf92b5e /httpd.c | |
| parent | New function timeline_to_rss(). (diff) | |
| download | penes-snac2-ddd2af73bd2b61b13e3b7d3928184d34d4729abd.tar.gz penes-snac2-ddd2af73bd2b61b13e3b7d3928184d34d4729abd.tar.xz penes-snac2-ddd2af73bd2b61b13e3b7d3928184d34d4729abd.zip | |
Search by tag returns RSS if the appropriate header is defined.
Diffstat (limited to '')
| -rw-r--r-- | httpd.c | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -169,8 +169,6 @@ int server_get_handler(xs_dict *req, const char *q_path, | |||
| 169 | { | 169 | { |
| 170 | int status = 0; | 170 | int status = 0; |
| 171 | 171 | ||
| 172 | (void)req; | ||
| 173 | |||
| 174 | /* is it the server root? */ | 172 | /* is it the server root? */ |
| 175 | if (*q_path == '\0') { | 173 | if (*q_path == '\0') { |
| 176 | xs_dict *q_vars = xs_dict_get(req, "q_vars"); | 174 | 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, | |||
| 195 | more = 1; | 193 | more = 1; |
| 196 | } | 194 | } |
| 197 | 195 | ||
| 198 | *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0); | 196 | char *accept = xs_dict_get(req, "accept"); |
| 197 | if (!xs_is_null(accept) && strcmp(accept, "application/rss+xml") == 0) { | ||
| 198 | xs *link = xs_fmt("%s/?t=%s", srv_baseurl, t); | ||
| 199 | |||
| 200 | *body = timeline_to_rss(NULL, tl, link, link, link); | ||
| 201 | *ctype = "application/rss+xml; charset=utf-8"; | ||
| 202 | } | ||
| 203 | else | ||
| 204 | *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL, 0); | ||
| 199 | } | 205 | } |
| 200 | else | 206 | else |
| 201 | if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { | 207 | if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { |