commit 914bb61
default
·
2025-01-04 14:55:47 +0000 UTC
parent a504544
More search by URL tweaks.
1 files changed,
+17,
-23
M
html.c
M
html.c
+17,
-23
1@@ -3080,36 +3080,30 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2 q = url_acct;
3 }
4 else {
5- /* if it's not already here, try to bring it to the user's timeline */
6- xs *md5 = xs_md5_hex(q, strlen(q));
7+ /* bring it to the user's timeline */
8+ xs *object = NULL;
9+ int status;
10
11- if (!timeline_here(&snac, md5)) {
12- xs *object = NULL;
13- int status;
14+ status = activitypub_request(&snac, q, &object);
15+ snac_debug(&snac, 1, xs_fmt("Request searched URL %s %d", q, status));
16
17- status = activitypub_request(&snac, q, &object);
18- snac_debug(&snac, 1, xs_fmt("Request searched URL %s %d", q, status));
19+ if (valid_status(status)) {
20+ /* got it; also request the actor */
21+ const char *attr_to = get_atto(object);
22
23- if (valid_status(status)) {
24- /* got it; also request the actor */
25- const char *attr_to = get_atto(object);
26+ if (!xs_is_null(attr_to)) {
27+ status = actor_request(&snac, attr_to, &actor_obj);
28
29- if (!xs_is_null(attr_to)) {
30- status = actor_request(&snac, attr_to, &actor_obj);
31+ if (valid_status(status)) {
32+ /* reset the query string to be the real id */
33+ url_acct = xs_dup(xs_dict_get(object, "id"));
34+ q = url_acct;
35
36- snac_debug(&snac, 1, xs_fmt("Request author %s of %s %d", attr_to, q, status));
37+ /* add the post to the timeline */
38+ xs *md5 = xs_md5_hex(q, strlen(q));
39
40- if (valid_status(status)) {
41- /* reset the query string to be the real id */
42- url_acct = xs_dup(xs_dict_get(object, "id"));
43- q = url_acct;
44-
45- /* add the actor */
46- actor_add(attr_to, actor_obj);
47-
48- /* add the post to the timeline */
49+ if (!timeline_here(&snac, md5))
50 timeline_add(&snac, q, object);
51- }
52 }
53 }
54 }