diff options
| author | 2022-12-02 19:39:17 +0100 | |
|---|---|---|
| committer | 2022-12-02 19:39:17 +0100 | |
| commit | c06136a8ac480a2ff350f751ddc710c3a5f264c3 (patch) | |
| tree | 90a01acdc2f13ed9b285eee4791bec36a70632f8 | |
| parent | Fixed RSS and outbox to use the new data storage. (diff) | |
| download | snac2-c06136a8ac480a2ff350f751ddc710c3a5f264c3.tar.gz snac2-c06136a8ac480a2ff350f751ddc710c3a5f264c3.tar.xz snac2-c06136a8ac480a2ff350f751ddc710c3a5f264c3.zip | |
Fixed one post queries.
| -rw-r--r-- | activitypub.c | 5 | ||||
| -rw-r--r-- | html.c | 10 | ||||
| -rw-r--r-- | snac.h | 1 |
3 files changed, 8 insertions, 8 deletions
diff --git a/activitypub.c b/activitypub.c index 8a5dd3c..764f69d 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1128,10 +1128,7 @@ int activitypub_get_handler(d_char *req, char *q_path, | |||
| 1128 | if (xs_startswith(p_path, "p/")) { | 1128 | if (xs_startswith(p_path, "p/")) { |
| 1129 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); | 1129 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); |
| 1130 | 1130 | ||
| 1131 | if ((msg = timeline_find(&snac, id)) != NULL) | 1131 | status = object_get(id, &msg, NULL); |
| 1132 | msg = xs_dict_del(msg, "_snac"); | ||
| 1133 | else | ||
| 1134 | status = 404; | ||
| 1135 | } | 1132 | } |
| 1136 | else | 1133 | else |
| 1137 | status = 404; | 1134 | status = 404; |
| @@ -1066,12 +1066,14 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char * | |||
| 1066 | else | 1066 | else |
| 1067 | if (xs_startswith(p_path, "p/")) { | 1067 | if (xs_startswith(p_path, "p/")) { |
| 1068 | /* a timeline with just one entry */ | 1068 | /* a timeline with just one entry */ |
| 1069 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); | 1069 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); |
| 1070 | xs *fn = _timeline_find_fn(&snac, id); | 1070 | xs *msg = NULL; |
| 1071 | 1071 | ||
| 1072 | if (fn != NULL) { | 1072 | if (valid_status(object_get(id, &msg, NULL))) { |
| 1073 | xs *md5 = xs_md5_hex(id, strlen(id)); | ||
| 1073 | xs *list = xs_list_new(); | 1074 | xs *list = xs_list_new(); |
| 1074 | list = xs_list_append(list, fn); | 1075 | |
| 1076 | list = xs_list_append(list, md5); | ||
| 1075 | 1077 | ||
| 1076 | *body = html_timeline(&snac, list, 1); | 1078 | *body = html_timeline(&snac, list, 1); |
| 1077 | *b_size = strlen(*body); | 1079 | *b_size = strlen(*body); |
| @@ -61,6 +61,7 @@ d_char *index_list(const char *fn, int max); | |||
| 61 | d_char *index_list_desc(const char *fn, int max); | 61 | d_char *index_list_desc(const char *fn, int max); |
| 62 | 62 | ||
| 63 | int object_get_by_md5(const char *md5, d_char **obj, const char *type); | 63 | int object_get_by_md5(const char *md5, d_char **obj, const char *type); |
| 64 | int object_get(const char *id, d_char **obj, const char *type); | ||
| 64 | int object_del(const char *id); | 65 | int object_del(const char *id); |
| 65 | int object_del_if_unref(const char *id); | 66 | int object_del_if_unref(const char *id); |
| 66 | 67 | ||