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

17
utils.c
View File

@ -605,14 +605,10 @@ void export_csv(snac *user)
xs_list_foreach(l, actor) {
xs *uid = NULL;
int status;
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
webfinger_request_fake(actor, NULL, &uid);
fprintf(f, "%s\n", uid);
}
else
snac_log(user, xs_fmt("Error resolving muted user %s %d", actor, status));
}
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))))
webfinger_request_fake(id, NULL, &uid);
fprintf(f, "%s,%s\n", ltitle, uid);
else
snac_log(user, xs_fmt("Error resolving list member %s %d", id, status));
}
}
}
@ -665,14 +658,10 @@ void export_csv(snac *user)
xs_list_foreach(fwing, actor) {
xs *uid = NULL;
int status;
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
webfinger_request_fake(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));
}
fclose(f);
}

View File

@ -133,11 +133,13 @@ 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, "/");
if (xs_list_len(l) > 3) {
/* i'll end up in hell for this */
*user = xs_fmt("%s@%s", xs_list_get(l, 2), xs_list_get(l, -1));
*user = xs_fmt("%s@%s", xs_list_get(l, -1), xs_list_get(l, 2));
status = HTTP_STATUS_RESET_CONTENT;
}
}
}
return status;
}