summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c18
-rw-r--r--httpd.c6
-rw-r--r--snac.h2
3 files changed, 16 insertions, 10 deletions
diff --git a/html.c b/html.c
index 95957a2..3ae9c65 100644
--- a/html.c
+++ b/html.c
@@ -1880,7 +1880,7 @@ xs_html *html_footer(void)
1880 1880
1881 1881
1882xs_str *html_timeline(snac *user, const xs_list *list, int local, 1882xs_str *html_timeline(snac *user, const xs_list *list, int local,
1883 int skip, int show, int show_more, char *tag) 1883 int skip, int show, int show_more, char *tag, char *page)
1884/* returns the HTML for the timeline */ 1884/* returns the HTML for the timeline */
1885{ 1885{
1886 xs_list *p = (xs_list *)list; 1886 xs_list *p = (xs_list *)list;
@@ -2003,12 +2003,15 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
2003 xs *m = NULL; 2003 xs *m = NULL;
2004 xs *ss = xs_fmt("skip=%d&show=%d", skip + show, show); 2004 xs *ss = xs_fmt("skip=%d&show=%d", skip + show, show);
2005 2005
2006 xs *url = page == NULL || user == NULL ?
2007 xs_dup(srv_baseurl) : xs_fmt("%s%s", user->actor, page);
2008
2006 if (tag) { 2009 if (tag) {
2007 t = xs_fmt("%s?t=%s", srv_baseurl, tag); 2010 t = xs_fmt("%s?t=%s", url, tag);
2008 m = xs_fmt("%s&%s", t, ss); 2011 m = xs_fmt("%s&%s", t, ss);
2009 } 2012 }
2010 else { 2013 else {
2011 t = xs_fmt("%s%s", user ? user->actor : srv_baseurl, local ? "" : "/admin"); 2014 t = xs_dup(url);
2012 m = xs_fmt("%s?%s", t, ss); 2015 m = xs_fmt("%s?%s", t, ss);
2013 } 2016 }
2014 2017
@@ -2401,7 +2404,8 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2401 xs *h = xs_str_localtime(0, "%Y-%m.html"); 2404 xs *h = xs_str_localtime(0, "%Y-%m.html");
2402 2405
2403 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) { 2406 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) {
2404 *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL); 2407 /** empty public timeline for private users **/
2408 *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL, "");
2405 *b_size = strlen(*body); 2409 *b_size = strlen(*body);
2406 status = 200; 2410 status = 200;
2407 } 2411 }
@@ -2419,7 +2423,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2419 xs *pins = pinned_list(&snac); 2423 xs *pins = pinned_list(&snac);
2420 pins = xs_list_cat(pins, list); 2424 pins = xs_list_cat(pins, list);
2421 2425
2422 *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL); 2426 *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL, "");
2423 2427
2424 *b_size = strlen(*body); 2428 *b_size = strlen(*body);
2425 status = 200; 2429 status = 200;
@@ -2456,7 +2460,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2456 xs *pins = pinned_list(&snac); 2460 xs *pins = pinned_list(&snac);
2457 pins = xs_list_cat(pins, list); 2461 pins = xs_list_cat(pins, list);
2458 2462
2459 *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next), NULL); 2463 *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next), NULL, "/admin");
2460 2464
2461 *b_size = strlen(*body); 2465 *b_size = strlen(*body);
2462 status = 200; 2466 status = 200;
@@ -2504,7 +2508,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2504 2508
2505 list = xs_list_append(list, md5); 2509 list = xs_list_append(list, md5);
2506 2510
2507 *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL); 2511 *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL, "");
2508 *b_size = strlen(*body); 2512 *b_size = strlen(*body);
2509 status = 200; 2513 status = 200;
2510 } 2514 }
diff --git a/httpd.c b/httpd.c
index fde40cb..d10c675 100644
--- a/httpd.c
+++ b/httpd.c
@@ -177,6 +177,7 @@ int server_get_handler(xs_dict *req, const char *q_path,
177 char *t = NULL; 177 char *t = NULL;
178 178
179 if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) { 179 if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
180 /** search by tag **/
180 int skip = 0; 181 int skip = 0;
181 int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries")); 182 int show = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
182 char *v; 183 char *v;
@@ -194,12 +195,13 @@ int server_get_handler(xs_dict *req, const char *q_path,
194 more = 1; 195 more = 1;
195 } 196 }
196 197
197 *body = html_timeline(NULL, tl, 0, skip, show, more, t); 198 *body = html_timeline(NULL, tl, 0, skip, show, more, t, NULL);
198 } 199 }
199 else 200 else
200 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { 201 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
202 /** instance timeline **/
201 xs *tl = timeline_instance_list(0, 30); 203 xs *tl = timeline_instance_list(0, 30);
202 *body = html_timeline(NULL, tl, 0, 0, 0, 0, NULL); 204 *body = html_timeline(NULL, tl, 0, 0, 0, 0, NULL, NULL);
203 } 205 }
204 else 206 else
205 *body = greeting_html(); 207 *body = greeting_html();
diff --git a/snac.h b/snac.h
index 8de3a83..bd7daaf 100644
--- a/snac.h
+++ b/snac.h
@@ -297,7 +297,7 @@ xs_str *sanitize(const char *content);
297xs_str *encode_html(const char *str); 297xs_str *encode_html(const char *str);
298 298
299xs_str *html_timeline(snac *user, const xs_list *list, int local, 299xs_str *html_timeline(snac *user, const xs_list *list, int local,
300 int skip, int show, int show_more, char *tag); 300 int skip, int show, int show_more, char *tag, char *page);
301 301
302int html_get_handler(const xs_dict *req, const char *q_path, 302int html_get_handler(const xs_dict *req, const char *q_path,
303 char **body, int *b_size, char **ctype, xs_str **etag); 303 char **body, int *b_size, char **ctype, xs_str **etag);