all repos — honk @ 1b0688fba32f3c2f06a266133fcd67eef493853a

my fork of honk

experiment with allowing user avatar to be visible
Ted Unangst tedu@tedunangst.com
Mon, 06 Mar 2023 17:42:30 -0500
commit

1b0688fba32f3c2f06a266133fcd67eef493853a

parent

3d6a33079b292791e0df393ce1b0617eb6e5b01a

1 files changed, 18 insertions(+), 0 deletions(-)

jump to
M web.goweb.go

@@ -2112,11 +2112,29 @@ secs := 432000 + notrand.Int63n(432000)

return fmt.Sprintf("%d", secs) } +func lookatme(ava string) string { + if strings.Contains(ava, serverName + "/" + userSep) { + idx := strings.LastIndexByte(ava, '/') + if idx < len(ava) { + name := ava[idx+1:] + user, _ := butwhatabout(name) + if user != nil && user.URL == ava { + return user.Options.Avatar + } + } + } + return "" +} + func avatate(w http.ResponseWriter, r *http.Request) { if develMode { loadAvatarColors() } n := r.FormValue("a") + if redir := lookatme(n); redir != "" { + http.Redirect(w, r, redir, http.StatusSeeOther) + return + } a := genAvatar(n) if !develMode { w.Header().Set("Cache-Control", "max-age="+somedays())