add empty follow collections
This commit is contained in:
parent
723efee364
commit
23cea380b0
|
@ -695,6 +695,8 @@ func asjonker(user *WhatAbout) map[string]interface{} {
|
||||||
j["type"] = "Person"
|
j["type"] = "Person"
|
||||||
j["inbox"] = user.URL + "/inbox"
|
j["inbox"] = user.URL + "/inbox"
|
||||||
j["outbox"] = user.URL + "/outbox"
|
j["outbox"] = user.URL + "/outbox"
|
||||||
|
j["followers"] = user.URL + "/followers"
|
||||||
|
j["following"] = user.URL + "/following"
|
||||||
j["name"] = user.Display
|
j["name"] = user.Display
|
||||||
j["preferredUsername"] = user.Name
|
j["preferredUsername"] = user.Name
|
||||||
j["summary"] = about
|
j["summary"] = about
|
||||||
|
|
25
honk.go
25
honk.go
|
@ -395,6 +395,29 @@ func outbox(w http.ResponseWriter, r *http.Request) {
|
||||||
WriteJunk(w, j)
|
WriteJunk(w, j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func emptiness(w http.ResponseWriter, r *http.Request) {
|
||||||
|
name := mux.Vars(r)["name"]
|
||||||
|
user, err := butwhatabout(name)
|
||||||
|
if err != nil {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
colname := "/followers"
|
||||||
|
if strings.HasSuffix(r.URL.Path, "/following") {
|
||||||
|
colname = "/following"
|
||||||
|
}
|
||||||
|
j := NewJunk()
|
||||||
|
j["@context"] = itiswhatitis
|
||||||
|
j["id"] = user.URL + colname
|
||||||
|
j["type"] = "OrderedCollection"
|
||||||
|
j["totalItems"] = 0
|
||||||
|
j["orderedItems"] = []interface{}{}
|
||||||
|
|
||||||
|
w.Header().Set("Cache-Control", "max-age=60")
|
||||||
|
w.Header().Set("Content-Type", theonetruename)
|
||||||
|
WriteJunk(w, j)
|
||||||
|
}
|
||||||
|
|
||||||
func viewuser(w http.ResponseWriter, r *http.Request) {
|
func viewuser(w http.ResponseWriter, r *http.Request) {
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
user, err := butwhatabout(name)
|
user, err := butwhatabout(name)
|
||||||
|
@ -1135,6 +1158,8 @@ func serve() {
|
||||||
getters.HandleFunc("/u/{name:[[:alnum:]]+}/rss", showrss)
|
getters.HandleFunc("/u/{name:[[:alnum:]]+}/rss", showrss)
|
||||||
posters.HandleFunc("/u/{name:[[:alnum:]]+}/inbox", inbox)
|
posters.HandleFunc("/u/{name:[[:alnum:]]+}/inbox", inbox)
|
||||||
getters.HandleFunc("/u/{name:[[:alnum:]]+}/outbox", outbox)
|
getters.HandleFunc("/u/{name:[[:alnum:]]+}/outbox", outbox)
|
||||||
|
getters.HandleFunc("/u/{name:[[:alnum:]]+}/followers", emptiness)
|
||||||
|
getters.HandleFunc("/u/{name:[[:alnum:]]+}/following", emptiness)
|
||||||
getters.HandleFunc("/a", avatate)
|
getters.HandleFunc("/a", avatate)
|
||||||
getters.HandleFunc("/t", viewconvoy)
|
getters.HandleFunc("/t", viewconvoy)
|
||||||
getters.HandleFunc("/d/{xid:[[:alnum:].]+}", servefile)
|
getters.HandleFunc("/d/{xid:[[:alnum:].]+}", servefile)
|
||||||
|
|
Loading…
Reference in New Issue