Make acct webfinger prefix optional. Closes #1662"

This commit is contained in:
Gabe Kangas 2022-01-12 19:55:10 -08:00
parent 9eecf1c902
commit 01d83064da
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA

View File

@ -20,7 +20,13 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
resource := r.URL.Query().Get("resource")
resourceComponents := strings.Split(resource, ":")
account := resourceComponents[1]
var account string
if len(resourceComponents) == 2 {
account = resourceComponents[1]
} else {
account = resourceComponents[0]
}
userComponents := strings.Split(account, "@")
if len(userComponents) < 2 {
@ -32,7 +38,7 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
if _, valid := data.GetFederatedInboxMap()[user]; !valid {
// User is not valid
w.WriteHeader(http.StatusNotFound)
log.Println("Webfinger request rejected")
log.Errorln("webfinger request rejected for user:", user)
return
}