fix avatars
This commit is contained in:
+12
-5
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jacoblockett/sanitizefilename"
|
||||
"github.com/jasonlovesdoggo/gopen"
|
||||
"gosrc.io/xmpp/stanza"
|
||||
"mellium.im/xmpp/jid"
|
||||
@@ -305,11 +304,15 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
return createIdenticon(j)
|
||||
}
|
||||
|
||||
hash = filepath.Join(p, sanitizefilename.Sanitize(hash))
|
||||
hash = filepath.Join(p, hash)
|
||||
|
||||
_, err = os.ReadFile(hash)
|
||||
if err == nil {
|
||||
i := newImageFromPath(hash)
|
||||
i, err := newImageFromPath(hash)
|
||||
if err != nil {
|
||||
invalidImages[oghash] = true
|
||||
return createIdenticon(j)
|
||||
}
|
||||
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
|
||||
return i
|
||||
}
|
||||
@@ -318,7 +321,7 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
Type: "get",
|
||||
From: clientroot.Session.BindJid,
|
||||
To: j,
|
||||
Id: "vc2",
|
||||
Id: uuid.New().String(),
|
||||
Lang: "en",
|
||||
})
|
||||
|
||||
@@ -356,7 +359,11 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
panic(err)
|
||||
}
|
||||
|
||||
i := newImageFromPath(hash)
|
||||
i, err := newImageFromPath(hash)
|
||||
if err != nil {
|
||||
invalidImages[oghash] = true
|
||||
return createIdenticon(j)
|
||||
}
|
||||
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
|
||||
return i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user