Store avatars as binary instead of base64
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-24 15:56:34 +03:00
parent 6d7d722c5d
commit 9e2210c45b
5 changed files with 35 additions and 24 deletions

View File

@@ -159,6 +159,15 @@ class User < ApplicationRecord
@display_name ||= ldap_entry[:display_name]
end
def avatar
@avatar ||= LdapManager::FetchAvatar.call(cn: cn)
end
def avatar_base64
return nil if avatar.nil?
@avatar_base64 ||= Base64.strict_encode64(avatar)
end
def nostr_pubkey
@nostr_pubkey ||= ldap_entry[:nostr_key]
end
@@ -186,10 +195,6 @@ class User < ApplicationRecord
ZBase32.encode(Digest::SHA1.digest(cn))
end
def avatar
@avatar_base64 ||= LdapManager::FetchAvatar.call(cn: cn)
end
def services_enabled
ldap_entry[:services_enabled] || []
end