diff --git a/activity.go b/activity.go index 9992cb2..da57ca0 100644 --- a/activity.go +++ b/activity.go @@ -1061,8 +1061,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { } var tags []junk.Junk - g := bunchofgrapes(h.Noise) - for _, m := range g { + for _, m := range bunchofgrapes(h.Noise) { t := junk.New() t["type"] = "Mention" t["name"] = m.who @@ -1077,8 +1076,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { t["name"] = o tags = append(tags, t) } - herd := herdofemus(h.Noise) - for _, e := range herd { + for _, e := range herdofemus(h.Noise) { t := junk.New() t["id"] = e.ID t["type"] = "Emoji" diff --git a/fun.go b/fun.go index 1a284ee..97c1929 100644 --- a/fun.go +++ b/fun.go @@ -538,18 +538,17 @@ func firstclass(honk *Honk) bool { } func oneofakind(a []string) []string { - var x []string - for n, s := range a { - if s != "" { - x = append(x, s) - for i := n + 1; i < len(a); i++ { - if a[i] == s { - a[i] = "" - } - } + seen := make(map[string]bool) + seen[""] = true + j := 0 + for _, s := range a { + if !seen[s] { + seen[s] = true + a[j] = s + j++ } } - return x + return a[:j] } var ziggies = make(map[string]*rsa.PrivateKey) diff --git a/web.go b/web.go index 42ff924..ef4786f 100644 --- a/web.go +++ b/web.go @@ -1534,13 +1534,11 @@ func fingerlicker(w http.ResponseWriter, r *http.Request) { j := junk.New() j["subject"] = fmt.Sprintf("acct:%s@%s", user.Name, serverName) j["aliases"] = []string{user.URL} - var links []junk.Junk l := junk.New() l["rel"] = "self" l["type"] = `application/activity+json` l["href"] = user.URL - links = append(links, l) - j["links"] = links + j["links"] = []junk.Junk{l} w.Header().Set("Cache-Control", "max-age=3600") w.Header().Set("Content-Type", "application/jrd+json") @@ -1565,6 +1563,7 @@ func servecss(w http.ResponseWriter, r *http.Request) { http.NotFound(w, r) return } + defer fd.Close() w.Header().Set("Cache-Control", "max-age=0") w.Header().Set("Content-Type", "text/css; charset=utf-8") err = css.Filter(fd, w)