diff options
| author | 2025-06-07 07:53:00 +0200 | |
|---|---|---|
| committer | 2025-06-07 07:53:00 +0200 | |
| commit | d5dbdad930d44d9345bec03d0f2ce4076cb028a8 (patch) | |
| tree | 15ec3540abf601860aeebb608d15af2ac49a3ac1 /utils.c | |
| parent | Always show the 'pending follow confirmations' if there are any. (diff) | |
| download | snac2-d5dbdad930d44d9345bec03d0f2ce4076cb028a8.tar.gz snac2-d5dbdad930d44d9345bec03d0f2ce4076cb028a8.tar.xz snac2-d5dbdad930d44d9345bec03d0f2ce4076cb028a8.zip | |
If a metadata value is an account handle, it's also verified using webfinger.
Diffstat (limited to '')
| -rw-r--r-- | utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -488,6 +488,18 @@ void verify_links(snac *user) | |||
| 488 | 488 | ||
| 489 | int c = 0; | 489 | int c = 0; |
| 490 | while (metadata && xs_dict_next(metadata, &k, &v, &c)) { | 490 | while (metadata && xs_dict_next(metadata, &k, &v, &c)) { |
| 491 | xs *wfinger = NULL; | ||
| 492 | const char *ov = NULL; | ||
| 493 | |||
| 494 | /* is it an account handle? */ | ||
| 495 | if (*v == '@' && strchr(v + 1, '@')) { | ||
| 496 | /* resolve it via webfinger */ | ||
| 497 | if (valid_status(webfinger_request(v, &wfinger, NULL)) && xs_is_string(wfinger)) { | ||
| 498 | ov = v; | ||
| 499 | v = wfinger; | ||
| 500 | } | ||
| 501 | } | ||
| 502 | |||
| 491 | /* not an https link? skip */ | 503 | /* not an https link? skip */ |
| 492 | if (!xs_startswith(v, "https:/" "/")) | 504 | if (!xs_startswith(v, "https:/" "/")) |
| 493 | continue; | 505 | continue; |
| @@ -563,6 +575,10 @@ void verify_links(snac *user) | |||
| 563 | 575 | ||
| 564 | user->links = xs_dict_set(user->links, v, verified_time); | 576 | user->links = xs_dict_set(user->links, v, verified_time); |
| 565 | 577 | ||
| 578 | /* also add the original value if it was 'resolved' */ | ||
| 579 | if (xs_is_string(ov)) | ||
| 580 | user->links = xs_dict_set(user->links, ov, v); | ||
| 581 | |||
| 566 | vfied = 1; | 582 | vfied = 1; |
| 567 | } | 583 | } |
| 568 | else | 584 | else |