This commit is contained in:
Ted Unangst 2019-10-19 21:15:20 -04:00
commit 9a67ed5b62
3 changed files with 13 additions and 17 deletions

View File

@ -1061,8 +1061,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
} }
var tags []junk.Junk var tags []junk.Junk
g := bunchofgrapes(h.Noise) for _, m := range bunchofgrapes(h.Noise) {
for _, m := range g {
t := junk.New() t := junk.New()
t["type"] = "Mention" t["type"] = "Mention"
t["name"] = m.who t["name"] = m.who
@ -1077,8 +1076,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
t["name"] = o t["name"] = o
tags = append(tags, t) tags = append(tags, t)
} }
herd := herdofemus(h.Noise) for _, e := range herdofemus(h.Noise) {
for _, e := range herd {
t := junk.New() t := junk.New()
t["id"] = e.ID t["id"] = e.ID
t["type"] = "Emoji" t["type"] = "Emoji"

19
fun.go
View File

@ -538,18 +538,17 @@ func firstclass(honk *Honk) bool {
} }
func oneofakind(a []string) []string { func oneofakind(a []string) []string {
var x []string seen := make(map[string]bool)
for n, s := range a { seen[""] = true
if s != "" { j := 0
x = append(x, s) for _, s := range a {
for i := n + 1; i < len(a); i++ { if !seen[s] {
if a[i] == s { seen[s] = true
a[i] = "" a[j] = s
} j++
}
} }
} }
return x return a[:j]
} }
var ziggies = make(map[string]*rsa.PrivateKey) var ziggies = make(map[string]*rsa.PrivateKey)

5
web.go
View File

@ -1534,13 +1534,11 @@ func fingerlicker(w http.ResponseWriter, r *http.Request) {
j := junk.New() j := junk.New()
j["subject"] = fmt.Sprintf("acct:%s@%s", user.Name, serverName) j["subject"] = fmt.Sprintf("acct:%s@%s", user.Name, serverName)
j["aliases"] = []string{user.URL} j["aliases"] = []string{user.URL}
var links []junk.Junk
l := junk.New() l := junk.New()
l["rel"] = "self" l["rel"] = "self"
l["type"] = `application/activity+json` l["type"] = `application/activity+json`
l["href"] = user.URL l["href"] = user.URL
links = append(links, l) j["links"] = []junk.Junk{l}
j["links"] = links
w.Header().Set("Cache-Control", "max-age=3600") w.Header().Set("Cache-Control", "max-age=3600")
w.Header().Set("Content-Type", "application/jrd+json") w.Header().Set("Content-Type", "application/jrd+json")
@ -1565,6 +1563,7 @@ func servecss(w http.ResponseWriter, r *http.Request) {
http.NotFound(w, r) http.NotFound(w, r)
return return
} }
defer fd.Close()
w.Header().Set("Cache-Control", "max-age=0") w.Header().Set("Cache-Control", "max-age=0")
w.Header().Set("Content-Type", "text/css; charset=utf-8") w.Header().Set("Content-Type", "text/css; charset=utf-8")
err = css.Filter(fd, w) err = css.Filter(fd, w)