diff options
| -rw-r--r-- | TODO.md | 4 | ||||
| -rw-r--r-- | html.c | 22 |
2 files changed, 20 insertions, 6 deletions
| @@ -2,8 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | ## Open | 3 | ## Open |
| 4 | 4 | ||
| 5 | Implement the user-setup web interface. | ||
| 6 | |||
| 7 | Implement the citations as @user@host in the reply textareas. | 5 | Implement the citations as @user@host in the reply textareas. |
| 8 | 6 | ||
| 9 | Implement the purge. | 7 | Implement the purge. |
| @@ -143,3 +141,5 @@ Implement an input queue (2022-10-01T20:27:52+0200). | |||
| 143 | Refactor HTML rendering because it's a mess and write build_timeline(), that generates a big structure with everything to show in a timeline, to be passed to the HTML renderer (2022-10-01T20:27:52+0200). | 141 | Refactor HTML rendering because it's a mess and write build_timeline(), that generates a big structure with everything to show in a timeline, to be passed to the HTML renderer (2022-10-01T20:27:52+0200). |
| 144 | 142 | ||
| 145 | Implement the helper thread (2022-10-01T20:56:46+0200). | 143 | Implement the helper thread (2022-10-01T20:56:46+0200). |
| 144 | |||
| 145 | Implement the user-setup web interface (2022-10-02T17:45:03+0200). | ||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "xs_regex.h" | 8 | #include "xs_regex.h" |
| 9 | #include "xs_set.h" | 9 | #include "xs_set.h" |
| 10 | #include "xs_openssl.h" | 10 | #include "xs_openssl.h" |
| 11 | #include "xs_time.h" | ||
| 11 | 12 | ||
| 12 | #include "snac.h" | 13 | #include "snac.h" |
| 13 | 14 | ||
| @@ -753,11 +754,24 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char * | |||
| 753 | 754 | ||
| 754 | if (p_path == NULL) { | 755 | if (p_path == NULL) { |
| 755 | /* public timeline */ | 756 | /* public timeline */ |
| 756 | xs *list = local_list(&snac, 0xfffffff); | 757 | xs *h = xs_str_localtime(0, "%Y-%m.html"); |
| 757 | 758 | ||
| 758 | *body = html_timeline(&snac, list, 1); | 759 | if (history_mtime(&snac, h) > timeline_mtime(&snac)) { |
| 759 | *b_size = strlen(*body); | 760 | snac_debug(&snac, 1, xs_fmt("serving cached local timeline")); |
| 760 | status = 200; | 761 | |
| 762 | *body = history_get(&snac, h); | ||
| 763 | *b_size = strlen(*body); | ||
| 764 | status = 200; | ||
| 765 | } | ||
| 766 | else { | ||
| 767 | xs *list = local_list(&snac, 0xfffffff); | ||
| 768 | |||
| 769 | *body = html_timeline(&snac, list, 1); | ||
| 770 | *b_size = strlen(*body); | ||
| 771 | status = 200; | ||
| 772 | |||
| 773 | history_add(&snac, h, *body, *b_size); | ||
| 774 | } | ||
| 761 | } | 775 | } |
| 762 | else | 776 | else |
| 763 | if (strcmp(p_path, "admin") == 0) { | 777 | if (strcmp(p_path, "admin") == 0) { |