diff options
| author | 2022-09-30 09:56:29 +0200 | |
|---|---|---|
| committer | 2022-09-30 09:56:29 +0200 | |
| commit | 3d544233a63a2105d8d91e7fd4f62f7703fef6e0 (patch) | |
| tree | 021cca6da8ae40a6fbc3e8fb73499f0f9777044b /html.c | |
| parent | Likes and Boosts can be done from the web interface. (diff) | |
| download | snac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.tar.gz snac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.tar.xz snac2-3d544233a63a2105d8d91e7fd4f62f7703fef6e0.zip | |
Timeline is cached.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 21 |
1 files changed, 17 insertions, 4 deletions
| @@ -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 |