summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2022-09-30 09:56:29 +0200
committerGravatar default2022-09-30 09:56:29 +0200
commit3d544233a63a2105d8d91e7fd4f62f7703fef6e0 (patch)
tree021cca6da8ae40a6fbc3e8fb73499f0f9777044b /html.c
parentLikes and Boosts can be done from the web interface. (diff)
downloadsnac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.tar.gz
snac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.tar.xz
snac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.zip
Timeline is cached.
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