From b68d449c021263e521525ceb48c758ff223d5291 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 26 Dec 2022 13:20:48 -0500 Subject: [PATCH] delete hex avatars --- activity.go | 3 --- avatar.go | 23 +---------------------- honk.go | 1 - views/account.html | 2 -- web.go | 8 +------- 5 files changed, 2 insertions(+), 35 deletions(-) diff --git a/activity.go b/activity.go index 2e3e536..8f37ca0 100644 --- a/activity.go +++ b/activity.go @@ -1536,9 +1536,6 @@ func junkuser(user *WhatAbout) junk.Junk { a["url"] = ava } else { u := fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL)) - if user.Options.Avahex { - u += "&hex=1" - } a["url"] = u } j["icon"] = a diff --git a/avatar.go b/avatar.go index 7c7d615..dac92d4 100644 --- a/avatar.go +++ b/avatar.go @@ -65,7 +65,7 @@ func loadAvatarColors() { } } -func genAvatar(name string, hex bool) []byte { +func genAvatar(name string) []byte { h := sha512.New() h.Write([]byte(name)) s := h.Sum(nil) @@ -73,27 +73,6 @@ func genAvatar(name string, hex bool) []byte { for i := 0; i < 64; i++ { for j := 0; j < 64; j++ { p := i*img.Stride + j*4 - if hex { - tan := 0.577 - if i < 32 { - if j < 17-int(float64(i)*tan) || j > 46+int(float64(i)*tan) { - img.Pix[p+0] = 0 - img.Pix[p+1] = 0 - img.Pix[p+2] = 0 - img.Pix[p+3] = 255 - continue - } - } else { - if j < 17-int(float64(64-i)*tan) || j > 46+int(float64(64-i)*tan) { - img.Pix[p+0] = 0 - img.Pix[p+1] = 0 - img.Pix[p+2] = 0 - img.Pix[p+3] = 255 - continue - - } - } - } xx := i/16*16 + j/16 x := s[xx] if x < 64 { diff --git a/honk.go b/honk.go index e000e21..062b767 100644 --- a/honk.go +++ b/honk.go @@ -53,7 +53,6 @@ type WhatAbout struct { type UserOptions struct { SkinnyCSS bool `json:",omitempty"` OmitImages bool `json:",omitempty"` - Avahex bool `json:",omitempty"` MentionAll bool `json:",omitempty"` Avatar string `json:",omitempty"` Banner string `json:",omitempty"` diff --git a/views/account.html b/views/account.html index 523edca..9aa53ce 100644 --- a/views/account.html +++ b/views/account.html @@ -10,8 +10,6 @@

-

-

diff --git a/web.go b/web.go index fee81bf..a3fdbbe 100644 --- a/web.go +++ b/web.go @@ -1111,11 +1111,6 @@ func saveuser(w http.ResponseWriter, r *http.Request) { } else { options.SkinnyCSS = false } - if r.FormValue("avahex") == "avahex" { - options.Avahex = true - } else { - options.Avahex = false - } if r.FormValue("omitimages") == "omitimages" { options.OmitImages = true } else { @@ -2108,8 +2103,7 @@ func avatate(w http.ResponseWriter, r *http.Request) { loadAvatarColors() } n := r.FormValue("a") - hex := r.FormValue("hex") == "1" - a := genAvatar(n, hex) + a := genAvatar(n) if !develMode { w.Header().Set("Cache-Control", "max-age="+somedays()) }