dig into actor url to verify id

This commit is contained in:
Ted Unangst 2019-06-03 03:20:03 -04:00
parent 170d3ee858
commit ed0c28b6a2
3 changed files with 26 additions and 8 deletions

View File

@ -929,3 +929,27 @@ func gofish(name string) string {
handlock.Unlock() handlock.Unlock()
return "" return ""
} }
func investigate(name string) string {
if name == "" {
return ""
}
if name[0] == '@' {
name = gofish(name)
}
if name == "" {
return ""
}
obj, err := GetJunk(name)
if err != nil {
log.Printf("error investigating honker: %s", err)
return ""
}
t, _ := jsongetstring(obj, "type")
id, _ := jsongetstring(obj, "id")
if t != "Person" {
log.Printf("it's not a person! %s", name)
return ""
}
return id
}

View File

@ -20,8 +20,7 @@ The easiest is probably their handle, the thing that resembles an email.
@name@example.com for example. @name@example.com for example.
Alternatively, one may directly enter the actor ID, which is a URL that looks Alternatively, one may directly enter the actor ID, which is a URL that looks
like https://example.com/users/name. Note that the commonly seen URL with like https://example.com/users/name.
@name in it is not their actor ID and won't work.
Followed honkers may be assigned to combos, listing all their honks together. Followed honkers may be assigned to combos, listing all their honks together.

View File

@ -1036,12 +1036,7 @@ func savehonker(w http.ResponseWriter, r *http.Request) {
if peep == "peep" { if peep == "peep" {
flavor = "peep" flavor = "peep"
} }
if url == "" { url = investigate(url)
return
}
if url[0] == '@' {
url = gofish(url)
}
if url == "" { if url == "" {
return return
} }