[backend/services] Check for profile URL and user URI when verifying links

This commit is contained in:
pancakes 2025-01-22 22:10:11 +10:00 committed by Laura Hausmann
parent fc07f55fe3
commit aa3262caea
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -1201,9 +1201,11 @@ public class UserService(
var document = await new HtmlParser().ParseDocumentAsync(html); var document = await new HtmlParser().ParseDocumentAsync(html);
userProfileField.IsVerified = userProfileField.IsVerified =
document.Links.Any(a => a.GetAttribute("href") == profileUrl document.Links.Any(a => (a.GetAttribute("rel")?.Contains("me")
&& (a.GetAttribute("rel")?.Contains("me") ?? false)
?? false)); && a.GetAttribute("href") == profileUrl
|| user.Uri != null
&& a.GetAttribute("href") == user.Uri);
} }
bgDbContext.Update(bgUser.UserProfile); bgDbContext.Update(bgUser.UserProfile);