diff options
| author | 2025-01-04 15:55:47 +0100 | |
|---|---|---|
| committer | 2025-01-04 15:55:47 +0100 | |
| commit | 914bb61dad2bc8db81cc43c832fadfbda816bc9b (patch) | |
| tree | 7bbf23d8322c639e44d034ebfa21603530dd115b | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-914bb61dad2bc8db81cc43c832fadfbda816bc9b.tar.gz snac2-914bb61dad2bc8db81cc43c832fadfbda816bc9b.tar.xz snac2-914bb61dad2bc8db81cc43c832fadfbda816bc9b.zip | |
More search by URL tweaks.
| -rw-r--r-- | html.c | 40 |
1 files changed, 17 insertions, 23 deletions
| @@ -3080,36 +3080,30 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 3080 | q = url_acct; | 3080 | q = url_acct; |
| 3081 | } | 3081 | } |
| 3082 | else { | 3082 | else { |
| 3083 | /* if it's not already here, try to bring it to the user's timeline */ | 3083 | /* bring it to the user's timeline */ |
| 3084 | xs *md5 = xs_md5_hex(q, strlen(q)); | 3084 | xs *object = NULL; |
| 3085 | int status; | ||
| 3085 | 3086 | ||
| 3086 | if (!timeline_here(&snac, md5)) { | 3087 | status = activitypub_request(&snac, q, &object); |
| 3087 | xs *object = NULL; | 3088 | snac_debug(&snac, 1, xs_fmt("Request searched URL %s %d", q, status)); |
| 3088 | int status; | ||
| 3089 | 3089 | ||
| 3090 | status = activitypub_request(&snac, q, &object); | 3090 | if (valid_status(status)) { |
| 3091 | snac_debug(&snac, 1, xs_fmt("Request searched URL %s %d", q, status)); | 3091 | /* got it; also request the actor */ |
| 3092 | const char *attr_to = get_atto(object); | ||
| 3092 | 3093 | ||
| 3093 | if (valid_status(status)) { | 3094 | if (!xs_is_null(attr_to)) { |
| 3094 | /* got it; also request the actor */ | 3095 | status = actor_request(&snac, attr_to, &actor_obj); |
| 3095 | const char *attr_to = get_atto(object); | ||
| 3096 | 3096 | ||
| 3097 | if (!xs_is_null(attr_to)) { | 3097 | if (valid_status(status)) { |
| 3098 | status = actor_request(&snac, attr_to, &actor_obj); | 3098 | /* reset the query string to be the real id */ |
| 3099 | url_acct = xs_dup(xs_dict_get(object, "id")); | ||
| 3100 | q = url_acct; | ||
| 3099 | 3101 | ||
| 3100 | snac_debug(&snac, 1, xs_fmt("Request author %s of %s %d", attr_to, q, status)); | 3102 | /* add the post to the timeline */ |
| 3103 | xs *md5 = xs_md5_hex(q, strlen(q)); | ||
| 3101 | 3104 | ||
| 3102 | if (valid_status(status)) { | 3105 | if (!timeline_here(&snac, md5)) |
| 3103 | /* reset the query string to be the real id */ | ||
| 3104 | url_acct = xs_dup(xs_dict_get(object, "id")); | ||
| 3105 | q = url_acct; | ||
| 3106 | |||
| 3107 | /* add the actor */ | ||
| 3108 | actor_add(attr_to, actor_obj); | ||
| 3109 | |||
| 3110 | /* add the post to the timeline */ | ||
| 3111 | timeline_add(&snac, q, object); | 3106 | timeline_add(&snac, q, object); |
| 3112 | } | ||
| 3113 | } | 3107 | } |
| 3114 | } | 3108 | } |
| 3115 | } | 3109 | } |