summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c31
-rw-r--r--httpd.c4
-rw-r--r--snac.h3
3 files changed, 25 insertions, 13 deletions
diff --git a/html.c b/html.c
index 1220765..c3db33d 100644
--- a/html.c
+++ b/html.c
@@ -1542,7 +1542,8 @@ xs_str *html_footer(xs_str *s)
1542} 1542}
1543 1543
1544 1544
1545xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int show, int show_more) 1545xs_str *html_timeline(snac *user, const xs_list *list, int local,
1546 int skip, int show, int show_more, char *tag)
1546/* returns the HTML for the timeline */ 1547/* returns the HTML for the timeline */
1547{ 1548{
1548 xs_str *s = xs_str_new(NULL); 1549 xs_str *s = xs_str_new(NULL);
@@ -1628,15 +1629,25 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int
1628 } 1629 }
1629 1630
1630 if (show_more) { 1631 if (show_more) {
1631 const char *base_url = user ? user->actor : srv_baseurl; 1632 xs *t = NULL;
1633 xs *m = NULL;
1634
1635 if (tag) {
1636 t = xs_fmt("%s?t=%s", srv_baseurl, tag);
1637 m = xs_fmt("%s&skip=%d&show=%d", t, skip + show, show);
1638 }
1639 else {
1640 t = xs_fmt("%s%s", user ? user->actor : srv_baseurl, local ? "" : "/admin");
1641 m = xs_fmt("%s?&skip=%d&show=%d", t, skip + show, show);
1642 }
1632 1643
1633 xs *s1 = xs_fmt( 1644 xs *s1 = xs_fmt(
1634 "<p>" 1645 "<p>"
1635 "<a href=\"%s%s\" name=\"snac-more\">%s</a> - " 1646 "<a href=\"%s\" name=\"snac-more\">%s</a> - "
1636 "<a href=\"%s%s?skip=%d&show=%d\" name=\"snac-more\">%s</a>" 1647 "<a href=\"%s\" name=\"snac-more\">%s</a>"
1637 "</p>\n", 1648 "</p>\n",
1638 base_url, local ? "" : "/admin", L("Back to top"), 1649 t, L("Back to top"),
1639 base_url, local ? "" : "/admin", skip + show, show, L("More...") 1650 m, L("More...")
1640 ); 1651 );
1641 1652
1642 s = xs_str_cat(s, s1); 1653 s = xs_str_cat(s, s1);
@@ -1968,7 +1979,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
1968 xs *h = xs_str_localtime(0, "%Y-%m.html"); 1979 xs *h = xs_str_localtime(0, "%Y-%m.html");
1969 1980
1970 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) { 1981 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) {
1971 *body = html_timeline(&snac, NULL, 1, 0, 0, 0); 1982 *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL);
1972 *b_size = strlen(*body); 1983 *b_size = strlen(*body);
1973 status = 200; 1984 status = 200;
1974 } 1985 }
@@ -1986,7 +1997,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
1986 xs *pins = pinned_list(&snac); 1997 xs *pins = pinned_list(&snac);
1987 pins = xs_list_cat(pins, list); 1998 pins = xs_list_cat(pins, list);
1988 1999
1989 *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next)); 2000 *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL);
1990 2001
1991 *b_size = strlen(*body); 2002 *b_size = strlen(*body);
1992 status = 200; 2003 status = 200;
@@ -2017,7 +2028,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2017 xs *pins = pinned_list(&snac); 2028 xs *pins = pinned_list(&snac);
2018 pins = xs_list_cat(pins, list); 2029 pins = xs_list_cat(pins, list);
2019 2030
2020 *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next)); 2031 *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next), NULL);
2021 2032
2022 *b_size = strlen(*body); 2033 *b_size = strlen(*body);
2023 status = 200; 2034 status = 200;
@@ -2065,7 +2076,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2065 2076
2066 list = xs_list_append(list, md5); 2077 list = xs_list_append(list, md5);
2067 2078
2068 *body = html_timeline(&snac, list, 1, 0, 0, 0); 2079 *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL);
2069 *b_size = strlen(*body); 2080 *b_size = strlen(*body);
2070 status = 200; 2081 status = 200;
2071 } 2082 }
diff --git a/httpd.c b/httpd.c
index a912df2..c398c05 100644
--- a/httpd.c
+++ b/httpd.c
@@ -162,12 +162,12 @@ int server_get_handler(xs_dict *req, const char *q_path,
162 more = 1; 162 more = 1;
163 } 163 }
164 164
165 *body = html_timeline(NULL, tl, 0, skip, show, more); 165 *body = html_timeline(NULL, tl, 0, skip, show, more, t);
166 } 166 }
167 else 167 else
168 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { 168 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
169 xs *tl = timeline_instance_list(0, 30); 169 xs *tl = timeline_instance_list(0, 30);
170 *body = html_timeline(NULL, tl, 0, 0, 0, 0); 170 *body = html_timeline(NULL, tl, 0, 0, 0, 0, NULL);
171 } 171 }
172 else 172 else
173 *body = greeting_html(); 173 *body = greeting_html();
diff --git a/snac.h b/snac.h
index 8c02004..e2c042d 100644
--- a/snac.h
+++ b/snac.h
@@ -269,7 +269,8 @@ xs_str *sanitize(const char *content);
269xs_str *encode_html_strict(const char *str); 269xs_str *encode_html_strict(const char *str);
270xs_str *encode_html(const char *str); 270xs_str *encode_html(const char *str);
271 271
272xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int show, int show_more); 272xs_str *html_timeline(snac *user, const xs_list *list, int local,
273 int skip, int show, int show_more, char *tag);
273 274
274int html_get_handler(const xs_dict *req, const char *q_path, 275int html_get_handler(const xs_dict *req, const char *q_path,
275 char **body, int *b_size, char **ctype, xs_str **etag); 276 char **body, int *b_size, char **ctype, xs_str **etag);