diff options
| author | 2022-10-02 18:16:58 +0200 | |
|---|---|---|
| committer | 2022-10-02 18:16:58 +0200 | |
| commit | f82124a705d9c5350b92fba6a03c556c1fd5b2b0 (patch) | |
| tree | 0382d0058097f25340de8077c5498a46b05736bd /html.c | |
| parent | Implemented local timeline cache. (diff) | |
| download | snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.tar.gz snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.tar.xz snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.zip | |
The history is shown at the bottom of the local timeline.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 29 |
1 files changed, 29 insertions, 0 deletions
| @@ -483,6 +483,10 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 483 | xs *actor_o = NULL; | 483 | xs *actor_o = NULL; |
| 484 | char *actor; | 484 | char *actor; |
| 485 | 485 | ||
| 486 | /* do not show non-public messages in the public timeline */ | ||
| 487 | if (local && !is_msg_public(snac, msg)) | ||
| 488 | return os; | ||
| 489 | |||
| 486 | /* return if already seen */ | 490 | /* return if already seen */ |
| 487 | if (xs_set_add(seen, id) == 0) | 491 | if (xs_set_add(seen, id) == 0) |
| 488 | return os; | 492 | return os; |
| @@ -720,6 +724,31 @@ d_char *html_timeline(snac *snac, char *list, int local) | |||
| 720 | 724 | ||
| 721 | s = xs_str_cat(s, "</div>\n"); | 725 | s = xs_str_cat(s, "</div>\n"); |
| 722 | 726 | ||
| 727 | if (local) { | ||
| 728 | xs *s1 = xs_fmt( | ||
| 729 | "<div class=\"snac-history\">\n" | ||
| 730 | "<p class=\"snac-history-title\">%s</p><ul>\n", | ||
| 731 | L("History") | ||
| 732 | ); | ||
| 733 | |||
| 734 | s = xs_str_cat(s, s1); | ||
| 735 | |||
| 736 | xs *list = history_list(snac); | ||
| 737 | char *p, *v; | ||
| 738 | |||
| 739 | p = list; | ||
| 740 | while (xs_list_iter(&p, &v)) { | ||
| 741 | xs *fn = xs_replace(v, ".html", ""); | ||
| 742 | xs *s1 = xs_fmt( | ||
| 743 | "<li><a href=\"%s/h/%s\">%s</li>\n", | ||
| 744 | snac->actor, v, fn); | ||
| 745 | |||
| 746 | s = xs_str_cat(s, s1); | ||
| 747 | } | ||
| 748 | |||
| 749 | s = xs_str_cat(s, "</ul></div>\n"); | ||
| 750 | } | ||
| 751 | |||
| 723 | s = html_user_footer(snac, s); | 752 | s = html_user_footer(snac, s); |
| 724 | 753 | ||
| 725 | { | 754 | { |