Make acct webfinger prefix optional. Closes #1662"
This commit is contained in:
parent
9eecf1c902
commit
01d83064da
@ -20,7 +20,13 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
resource := r.URL.Query().Get("resource")
|
resource := r.URL.Query().Get("resource")
|
||||||
resourceComponents := strings.Split(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, "@")
|
userComponents := strings.Split(account, "@")
|
||||||
if len(userComponents) < 2 {
|
if len(userComponents) < 2 {
|
||||||
@ -32,7 +38,7 @@ func WebfingerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
if _, valid := data.GetFederatedInboxMap()[user]; !valid {
|
if _, valid := data.GetFederatedInboxMap()[user]; !valid {
|
||||||
// User is not valid
|
// User is not valid
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
log.Println("Webfinger request rejected")
|
log.Errorln("webfinger request rejected for user:", user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user