m
Ted Unangst tedu@tedunangst.com
Sat, 19 Oct 2019 21:15:20 -0400
3 files changed,
13 insertions(+),
17 deletions(-)
M
activity.go
→
activity.go
@@ -1061,8 +1061,7 @@ jo["replies"] = jr
} 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 @@ t["href"] = fmt.Sprintf("https://%s/o/%s", serverName, o[1:])
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"
M
fun.go
→
fun.go
@@ -538,18 +538,17 @@ return honk.Audience[0] == thewholeworld
} 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)
M
web.go
→
web.go
@@ -1534,13 +1534,11 @@
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 @@ if err != nil {
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)