Add offline-mode avatar source as Crafatar no longer supports names

This commit is contained in:
ruan 2018-02-21 12:40:15 +02:00
parent da32ec89b2
commit a2abd7f782
No known key found for this signature in database
GPG Key ID: 0D2EC1C52E469C0B
2 changed files with 5 additions and 1 deletions

View File

@ -183,13 +183,16 @@ class Page {
if ($name_under) {
$name_under = $this->settings->avatar_names_below;
}
$avatar_source = $this->settings->avatar_source;
if (strlen($uuid) === 36 && $uuid[14] === '3') {
$avatar_source = $this->settings->avatar_source_offline_mode;
// Avatars cannot be associated with offline mode UUIDs (version 3)
if (!$this->settings->avatar_allow_offline_mode_uuids) {
$uuid = $name;
}
}
$src = str_replace('$NAME', $name, str_replace('$UUID', $uuid, $this->settings->avatar_source));
$src = str_replace('$NAME', $name, str_replace('$UUID', $uuid, $avatar_source));
if (in_array($name, $this->settings->console_aliases) || $name === $this->settings->console_name) {
$src = $this->settings->console_image;
$name = $this->settings->console_name;

View File

@ -55,6 +55,7 @@ final class Settings {
* 'https://minotar.net/avatar/$NAME/25'
*/
$this->avatar_source = 'https://crafatar.com/avatars/$UUID?size=25';
$this->avatar_source_offline_mode = 'https://minotar.net/avatar/$NAME/25';
// If enabled, names will be shown below avatars instead of being shown next to them.
$this->avatar_names_below = true;