delete hex avatars
This commit is contained in:
parent
580970253e
commit
b68d449c02
|
@ -1536,9 +1536,6 @@ func junkuser(user *WhatAbout) junk.Junk {
|
||||||
a["url"] = ava
|
a["url"] = ava
|
||||||
} else {
|
} else {
|
||||||
u := fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL))
|
u := fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL))
|
||||||
if user.Options.Avahex {
|
|
||||||
u += "&hex=1"
|
|
||||||
}
|
|
||||||
a["url"] = u
|
a["url"] = u
|
||||||
}
|
}
|
||||||
j["icon"] = a
|
j["icon"] = a
|
||||||
|
|
23
avatar.go
23
avatar.go
|
@ -65,7 +65,7 @@ func loadAvatarColors() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func genAvatar(name string, hex bool) []byte {
|
func genAvatar(name string) []byte {
|
||||||
h := sha512.New()
|
h := sha512.New()
|
||||||
h.Write([]byte(name))
|
h.Write([]byte(name))
|
||||||
s := h.Sum(nil)
|
s := h.Sum(nil)
|
||||||
|
@ -73,27 +73,6 @@ func genAvatar(name string, hex bool) []byte {
|
||||||
for i := 0; i < 64; i++ {
|
for i := 0; i < 64; i++ {
|
||||||
for j := 0; j < 64; j++ {
|
for j := 0; j < 64; j++ {
|
||||||
p := i*img.Stride + j*4
|
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
|
xx := i/16*16 + j/16
|
||||||
x := s[xx]
|
x := s[xx]
|
||||||
if x < 64 {
|
if x < 64 {
|
||||||
|
|
1
honk.go
1
honk.go
|
@ -53,7 +53,6 @@ type WhatAbout struct {
|
||||||
type UserOptions struct {
|
type UserOptions struct {
|
||||||
SkinnyCSS bool `json:",omitempty"`
|
SkinnyCSS bool `json:",omitempty"`
|
||||||
OmitImages bool `json:",omitempty"`
|
OmitImages bool `json:",omitempty"`
|
||||||
Avahex bool `json:",omitempty"`
|
|
||||||
MentionAll bool `json:",omitempty"`
|
MentionAll bool `json:",omitempty"`
|
||||||
Avatar string `json:",omitempty"`
|
Avatar string `json:",omitempty"`
|
||||||
Banner string `json:",omitempty"`
|
Banner string `json:",omitempty"`
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
<p><textarea name="whatabout">{{ .WhatAbout }}</textarea>
|
<p><textarea name="whatabout">{{ .WhatAbout }}</textarea>
|
||||||
<p><label class="button" for="skinny">skinny layout:</label>
|
<p><label class="button" for="skinny">skinny layout:</label>
|
||||||
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span>
|
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span>
|
||||||
<p><label class="button" for="avahex">hex avatar:</label>
|
|
||||||
<input tabindex=1 type="checkbox" id="avahex" name="avahex" value="avahex" {{ if .User.Options.Avahex }}checked{{ end }}><span></span>
|
|
||||||
<p><label class="button" for="omitimages">omit images:</label>
|
<p><label class="button" for="omitimages">omit images:</label>
|
||||||
<input tabindex=1 type="checkbox" id="omitimages" name="omitimages" value="omitimages" {{ if .User.Options.OmitImages }}checked{{ end }}><span></span>
|
<input tabindex=1 type="checkbox" id="omitimages" name="omitimages" value="omitimages" {{ if .User.Options.OmitImages }}checked{{ end }}><span></span>
|
||||||
<p><label class="button" for="mentionall">mention all:</label>
|
<p><label class="button" for="mentionall">mention all:</label>
|
||||||
|
|
8
web.go
8
web.go
|
@ -1111,11 +1111,6 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
options.SkinnyCSS = false
|
options.SkinnyCSS = false
|
||||||
}
|
}
|
||||||
if r.FormValue("avahex") == "avahex" {
|
|
||||||
options.Avahex = true
|
|
||||||
} else {
|
|
||||||
options.Avahex = false
|
|
||||||
}
|
|
||||||
if r.FormValue("omitimages") == "omitimages" {
|
if r.FormValue("omitimages") == "omitimages" {
|
||||||
options.OmitImages = true
|
options.OmitImages = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -2108,8 +2103,7 @@ func avatate(w http.ResponseWriter, r *http.Request) {
|
||||||
loadAvatarColors()
|
loadAvatarColors()
|
||||||
}
|
}
|
||||||
n := r.FormValue("a")
|
n := r.FormValue("a")
|
||||||
hex := r.FormValue("hex") == "1"
|
a := genAvatar(n)
|
||||||
a := genAvatar(n, hex)
|
|
||||||
if !develMode {
|
if !develMode {
|
||||||
w.Header().Set("Cache-Control", "max-age="+somedays())
|
w.Header().Set("Cache-Control", "max-age="+somedays())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue