Add support for custom avatars (via file path) and for not touching the already-set avatar
This is based on the work done in https://github.com/etkecc/baibot/pull/60 by https://github.com/Fmstrat (Ben Curtis), with various changes on top to make the code more idiomatic and flexible. This commit squashes the following patches (newest first): - Improve handling of `user.avatar` configuration (null & empty string being the same now) and add support for a special `keep` value - Minor import reordering - Simplify avatar configuration (`user.avatar.source` -> `user.avatar`) - Combine `logo_bytes` and `mime_type` determination logic and do not fall back to default avatar if reading the custom avatar file fails - Switch from deprecated `mime_guess::guess_mime_type(avatar_path)` to `mime_guess::from_path(avatar_path).first_or_octet_stream()` - Relax `mime_guess` constraint and order alphabetically - Use `mime` from `mxlink` - Add mime-type support and switch to user.avatar.source - (Original work by Fmstrat) Add support for custom avatars Co-authored-by: Fmstrat <nospam@nowsci.com>
This commit is contained in:
@@ -6,6 +6,7 @@ pub const BAIBOT_HOMESERVER_URL: &str = "BAIBOT_HOMESERVER_URL";
|
||||
pub const BAIBOT_USER_MXID_LOCALPART: &str = "BAIBOT_USER_MXID_LOCALPART";
|
||||
pub const BAIBOT_USER_PASSWORD: &str = "BAIBOT_USER_PASSWORD";
|
||||
pub const BAIBOT_USER_NAME: &str = "BAIBOT_USER_NAME";
|
||||
pub const BAIBOT_USER_AVATAR: &str = "BAIBOT_USER_AVATAR";
|
||||
pub const BAIBOT_USER_ENCRYPTION_RECOVERY_PASSPHRASE: &str =
|
||||
"BAIBOT_USER_ENCRYPTION_RECOVERY_PASSPHRASE";
|
||||
pub const BAIBOT_USER_ENCRYPTION_RECOVERY_RESET_ALLOWED: &str =
|
||||
|
||||
Reference in New Issue
Block a user