diff --git a/activity.go b/activity.go
index ba00bd9..2421a61 100644
--- a/activity.go
+++ b/activity.go
@@ -25,7 +25,6 @@ import (
"io"
notrand "math/rand"
"net/http"
- "net/url"
"os"
"regexp"
"strings"
@@ -1602,12 +1601,7 @@ func junkuser(user *WhatAbout) junk.Junk {
a := junk.New()
a["type"] = "Image"
a["mediaType"] = "image/png"
- if ava := user.Options.Avatar; ava != "" {
- a["url"] = ava
- } else {
- u := fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL))
- a["url"] = u
- }
+ a["url"] = avatarURL(user)
j["icon"] = a
if ban := user.Options.Banner; ban != "" {
a := junk.New()
diff --git a/avatar.go b/avatar.go
index dac92d4..5eec3d3 100644
--- a/avatar.go
+++ b/avatar.go
@@ -23,6 +23,7 @@ import (
"image"
"image/png"
"net/http"
+ "net/url"
"regexp"
"strconv"
"strings"
@@ -103,6 +104,13 @@ func genAvatar(name string) []byte {
return buf.Bytes()
}
+func avatarURL(user *WhatAbout) string {
+ if ava := user.Options.Avatar; ava != "" {
+ return ava
+ }
+ return fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL))
+}
+
func showflag(writer http.ResponseWriter, req *http.Request) {
code := mux.Vars(req)["code"]
colors := strings.Split(code, ",")
diff --git a/views/header.html b/views/header.html
index 4c535d0..bd10995 100644
--- a/views/header.html
+++ b/views/header.html
@@ -7,6 +7,7 @@
{{ end }}
{{ .APAltLink }}
+{{ .Honkology }}
diff --git a/web.go b/web.go
index 9cb0e75..b26e391 100644
--- a/web.go
+++ b/web.go
@@ -1017,6 +1017,34 @@ func trackback(xid string, r *http.Request) {
}
}
+func honkology(honk *Honk) template.HTML {
+ var user *WhatAbout
+ ok := somenumberedusers.Get(honk.UserID, &user)
+ if !ok {
+ return ""
+ }
+ title := fmt.Sprintf("%s: %s", user.Display, honk.Precis)
+ imgurl := avatarURL(user)
+ for _, d := range honk.Donks {
+ if d.Local && strings.HasPrefix(d.Media, "image") {
+ imgurl = d.URL
+ break
+ }
+ }
+ short := honk.Noise
+ if len(short) > 160 {
+ short = short[0:160] + "..."
+ }
+ return templates.Sprintf(
+ `
+
+
+
+
+`,
+ title, user.URL, honk.XID, imgurl, short)
+}
+
func showonehonk(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
user, err := butwhatabout(name)
@@ -1064,19 +1092,23 @@ func showonehonk(w http.ResponseWriter, r *http.Request) {
honkpage(w, u, honks, templinfo)
return
}
+
+ templinfo := getInfo(r)
rawhonks := gethonksbyconvoy(honk.UserID, honk.Convoy, 0)
reversehonks(rawhonks)
var honks []*Honk
for _, h := range rawhonks {
- if h.XID == xid && len(honks) != 0 {
- h.Style += " glow"
+ if h.XID == xid {
+ templinfo["Honkology"] = honkology(h)
+ if len(honks) != 0 {
+ h.Style += " glow"
+ }
}
if h.Public && (h.Whofore == 2 || h.IsAcked()) {
honks = append(honks, h)
}
}
- templinfo := getInfo(r)
templinfo["ServerMessage"] = "one honk maybe more"
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
templinfo["APAltLink"] = templates.Sprintf("", xid)