Fixed one post queries.

This commit is contained in:
default 2022-12-02 19:39:17 +01:00
parent 33c8a73c17
commit c06136a8ac
3 changed files with 8 additions and 8 deletions

View File

@ -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;

8
html.c
View File

@ -1067,11 +1067,13 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
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 *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);

1
snac.h
View File

@ -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);