Use webfinger_request_fake() in export_csv().

This commit is contained in:
default 2024-09-18 20:05:22 +02:00
parent ee63e2a78c
commit 836b66358d
2 changed files with 11 additions and 20 deletions

23
utils.c
View file

@ -605,13 +605,9 @@ void export_csv(snac *user)
xs_list_foreach(l, actor) {
xs *uid = NULL;
int status;
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
fprintf(f, "%s\n", uid);
}
else
snac_log(user, xs_fmt("Error resolving muted user %s %d", actor, status));
webfinger_request_fake(actor, NULL, &uid);
fprintf(f, "%s\n", uid);
}
fclose(f);
@ -639,12 +635,9 @@ void export_csv(snac *user)
if (valid_status(object_get_by_md5(md5, &actor))) {
const char *id = xs_dict_get(actor, "id");
xs *uid = NULL;
int status;
if (valid_status((status = webfinger_request(id, NULL, &uid))))
fprintf(f, "%s,%s\n", ltitle, uid);
else
snac_log(user, xs_fmt("Error resolving list member %s %d", id, status));
webfinger_request_fake(id, NULL, &uid);
fprintf(f, "%s,%s\n", ltitle, uid);
}
}
}
@ -665,13 +658,9 @@ void export_csv(snac *user)
xs_list_foreach(fwing, actor) {
xs *uid = NULL;
int status;
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
fprintf(f, "%s,%s,false,\n", uid, limited(user, actor, 0) ? "false" : "true");
}
else
snac_log(user, xs_fmt("Error resolving followed account %s %d", actor, status));
webfinger_request_fake(actor, NULL, &uid);
fprintf(f, "%s,%s,false,\n", uid, limited(user, actor, 0) ? "false" : "true");
}
fclose(f);

View file

@ -133,9 +133,11 @@ int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user)
if (xs_startswith(qs, "https:/") || xs_startswith(qs, "http:/")) {
xs *l = xs_split(qs, "/");
/* i'll end up in hell for this */
*user = xs_fmt("%s@%s", xs_list_get(l, 2), xs_list_get(l, -1));
status = HTTP_STATUS_RESET_CONTENT;
if (xs_list_len(l) > 3) {
/* i'll end up in hell for this */
*user = xs_fmt("%s@%s", xs_list_get(l, -1), xs_list_get(l, 2));
status = HTTP_STATUS_RESET_CONTENT;
}
}
}