summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/html.c b/html.c
index fc42fb3..fd6fbdf 100644
--- a/html.c
+++ b/html.c
@@ -713,11 +713,24 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
713 if (!login(&snac, req)) 713 if (!login(&snac, req))
714 status = 401; 714 status = 401;
715 else { 715 else {
716 xs *list = timeline_list(&snac, 0xfffffff); 716 if (history_mtime(&snac, "_timeline.html") > timeline_mtime(&snac)) {
717 snac_debug(&snac, 1, xs_fmt("serving cached timeline"));
717 718
718 *body = html_timeline(&snac, list, 0); 719 *body = history_get(&snac, "_timeline.html");
719 *b_size = strlen(*body); 720 *b_size = strlen(*body);
720 status = 200; 721 status = 200;
722 }
723 else {
724 snac_debug(&snac, 1, xs_fmt("building timeline"));
725
726 xs *list = timeline_list(&snac, 0xfffffff);
727
728 *body = html_timeline(&snac, list, 0);
729 *b_size = strlen(*body);
730 status = 200;
731
732 history_add(&snac, "_timeline.html", *body, *b_size);
733 }
721 } 734 }
722 } 735 }
723 else 736 else