diff options
| author | 2022-09-29 13:15:57 +0200 | |
|---|---|---|
| committer | 2022-09-29 13:15:57 +0200 | |
| commit | f124d7accb912b365df2f03c1e1cba12b9d0f055 (patch) | |
| tree | f20692bac01434d4884521dcb72e2865019d7524 | |
| parent | Use SIGTRAP instead of the signal number in raise(). (diff) | |
| download | snac2-f124d7accb912b365df2f03c1e1cba12b9d0f055.tar.gz snac2-f124d7accb912b365df2f03c1e1cba12b9d0f055.tar.xz snac2-f124d7accb912b365df2f03c1e1cba12b9d0f055.zip | |
Added support for one-entry timeline.
| -rw-r--r-- | html.c | 17 | ||||
| -rw-r--r-- | snac.h | 1 |
2 files changed, 15 insertions, 3 deletions
| @@ -721,15 +721,26 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char * | |||
| 721 | } | 721 | } |
| 722 | } | 722 | } |
| 723 | else | 723 | else |
| 724 | if (xs_startswith(p_path, "p/") == 0) { | 724 | if (xs_startswith(p_path, "p/")) { |
| 725 | /* a timeline with just one entry */ | 725 | /* a timeline with just one entry */ |
| 726 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); | ||
| 727 | xs *fn = _timeline_find_fn(&snac, id); | ||
| 728 | |||
| 729 | if (fn != NULL) { | ||
| 730 | xs *list = xs_list_new(); | ||
| 731 | list = xs_list_append(list, fn); | ||
| 732 | |||
| 733 | *body = html_timeline(&snac, list, 1); | ||
| 734 | *b_size = strlen(*body); | ||
| 735 | status = 200; | ||
| 736 | } | ||
| 726 | } | 737 | } |
| 727 | else | 738 | else |
| 728 | if (xs_startswith(p_path, "s/") == 0) { | 739 | if (xs_startswith(p_path, "s/")) { |
| 729 | /* a static file */ | 740 | /* a static file */ |
| 730 | } | 741 | } |
| 731 | else | 742 | else |
| 732 | if (xs_startswith(p_path, "h/") == 0) { | 743 | if (xs_startswith(p_path, "h/")) { |
| 733 | /* an entry from the history */ | 744 | /* an entry from the history */ |
| 734 | } | 745 | } |
| 735 | else | 746 | else |
| @@ -61,6 +61,7 @@ int follower_check(snac *snac, char *actor); | |||
| 61 | d_char *follower_list(snac *snac); | 61 | d_char *follower_list(snac *snac); |
| 62 | 62 | ||
| 63 | int timeline_here(snac *snac, char *id); | 63 | int timeline_here(snac *snac, char *id); |
| 64 | d_char *_timeline_find_fn(snac *snac, char *id); | ||
| 64 | d_char *timeline_find(snac *snac, char *id); | 65 | d_char *timeline_find(snac *snac, char *id); |
| 65 | void timeline_del(snac *snac, char *id); | 66 | void timeline_del(snac *snac, char *id); |
| 66 | d_char *timeline_get(snac *snac, char *fn); | 67 | d_char *timeline_get(snac *snac, char *fn); |