commit c06136a8ac480a2ff350f751ddc710c3a5f264c3
parent 33c8a73c17667b117f1bb720a5a32c485fd7d130
Author: default <nobody@localhost>
Date: Fri, 2 Dec 2022 19:39:17 +0100
Fixed one post queries.
Diffstat:
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/activitypub.c b/activitypub.c
@@ -1128,10 +1128,7 @@ int activitypub_get_handler(d_char *req, char *q_path,
if (xs_startswith(p_path, "p/")) {
xs *id = xs_fmt("%s/%s", snac.actor, p_path);
- if ((msg = timeline_find(&snac, id)) != NULL)
- msg = xs_dict_del(msg, "_snac");
- else
- status = 404;
+ status = object_get(id, &msg, NULL);
}
else
status = 404;
diff --git a/html.c b/html.c
@@ -1066,12 +1066,14 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
else
if (xs_startswith(p_path, "p/")) {
/* a timeline with just one entry */
- xs *id = xs_fmt("%s/%s", snac.actor, p_path);
- xs *fn = _timeline_find_fn(&snac, id);
+ xs *id = xs_fmt("%s/%s", snac.actor, p_path);
+ xs *msg = NULL;
- if (fn != NULL) {
+ if (valid_status(object_get(id, &msg, NULL))) {
+ xs *md5 = xs_md5_hex(id, strlen(id));
xs *list = xs_list_new();
- list = xs_list_append(list, fn);
+
+ list = xs_list_append(list, md5);
*body = html_timeline(&snac, list, 1);
*b_size = strlen(*body);
diff --git a/snac.h b/snac.h
@@ -61,6 +61,7 @@ d_char *index_list(const char *fn, int max);
d_char *index_list_desc(const char *fn, int max);
int object_get_by_md5(const char *md5, d_char **obj, const char *type);
+int object_get(const char *id, d_char **obj, const char *type);
int object_del(const char *id);
int object_del_if_unref(const char *id);