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_list_foreach(l, actor) {
xs *uid = NULL; 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); fprintf(f, "%s\n", uid);
}
else
snac_log(user, xs_fmt("Error resolving muted user %s %d", actor, status));
} }
fclose(f); fclose(f);
@ -639,12 +635,9 @@ void export_csv(snac *user)
if (valid_status(object_get_by_md5(md5, &actor))) { if (valid_status(object_get_by_md5(md5, &actor))) {
const char *id = xs_dict_get(actor, "id"); const char *id = xs_dict_get(actor, "id");
xs *uid = NULL; 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); fprintf(f, "%s,%s\n", ltitle, uid);
else
snac_log(user, xs_fmt("Error resolving list member %s %d", id, status));
} }
} }
} }
@ -665,13 +658,9 @@ void export_csv(snac *user)
xs_list_foreach(fwing, actor) { xs_list_foreach(fwing, actor) {
xs *uid = NULL; 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"); 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); 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:/")) { if (xs_startswith(qs, "https:/") || xs_startswith(qs, "http:/")) {
xs *l = xs_split(qs, "/"); xs *l = xs_split(qs, "/");
/* i'll end up in hell for this */ if (xs_list_len(l) > 3) {
*user = xs_fmt("%s@%s", xs_list_get(l, 2), xs_list_get(l, -1)); /* i'll end up in hell for this */
status = HTTP_STATUS_RESET_CONTENT; *user = xs_fmt("%s@%s", xs_list_get(l, -1), xs_list_get(l, 2));
status = HTTP_STATUS_RESET_CONTENT;
}
} }
} }