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)
}
-xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int show, int show_more)
+xs_str *html_timeline(snac *user, const xs_list *list, int local,
+ int skip, int show, int show_more, char *tag)
/* returns the HTML for the timeline */
{
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
}
if (show_more) {
- const char *base_url = user ? user->actor : srv_baseurl;
+ xs *t = NULL;
+ xs *m = NULL;
+
+ if (tag) {
+ t = xs_fmt("%s?t=%s", srv_baseurl, tag);
+ m = xs_fmt("%s&skip=%d&show=%d", t, skip + show, show);
+ }
+ else {
+ t = xs_fmt("%s%s", user ? user->actor : srv_baseurl, local ? "" : "/admin");
+ m = xs_fmt("%s?&skip=%d&show=%d", t, skip + show, show);
+ }
xs *s1 = xs_fmt(
"<p>"
- "<a href=\"%s%s\" name=\"snac-more\">%s</a> - "
- "<a href=\"%s%s?skip=%d&show=%d\" name=\"snac-more\">%s</a>"
+ "<a href=\"%s\" name=\"snac-more\">%s</a> - "
+ "<a href=\"%s\" name=\"snac-more\">%s</a>"
"</p>\n",
- base_url, local ? "" : "/admin", L("Back to top"),
- base_url, local ? "" : "/admin", skip + show, show, L("More...")
+ t, L("Back to top"),
+ m, L("More...")
);
s = xs_str_cat(s, s1);
@@ -1968,7 +1979,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
xs *h = xs_str_localtime(0, "%Y-%m.html");
if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) {
- *body = html_timeline(&snac, NULL, 1, 0, 0, 0);
+ *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL);
*b_size = strlen(*body);
status = 200;
}
@@ -1986,7 +1997,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
xs *pins = pinned_list(&snac);
pins = xs_list_cat(pins, list);
- *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next));
+ *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL);
*b_size = strlen(*body);
status = 200;
@@ -2017,7 +2028,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
xs *pins = pinned_list(&snac);
pins = xs_list_cat(pins, list);
- *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next));
+ *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next), NULL);
*b_size = strlen(*body);
status = 200;
@@ -2065,7 +2076,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
list = xs_list_append(list, md5);
- *body = html_timeline(&snac, list, 1, 0, 0, 0);
+ *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL);
*b_size = strlen(*body);
status = 200;
}
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,
more = 1;
}
- *body = html_timeline(NULL, tl, 0, skip, show, more);
+ *body = html_timeline(NULL, tl, 0, skip, show, more, t);
}
else
if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
xs *tl = timeline_instance_list(0, 30);
- *body = html_timeline(NULL, tl, 0, 0, 0, 0);
+ *body = html_timeline(NULL, tl, 0, 0, 0, 0, NULL);
}
else
*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);
xs_str *encode_html_strict(const char *str);
xs_str *encode_html(const char *str);
-xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int show, int show_more);
+xs_str *html_timeline(snac *user, const xs_list *list, int local,
+ int skip, int show, int show_more, char *tag);
int html_get_handler(const xs_dict *req, const char *q_path,
char **body, int *b_size, char **ctype, xs_str **etag);