fix(ui): fix Avatar being broken when setup using internal ip

allow avatar url to use externalHostname when setup using local ip

fix #110
This commit is contained in:
Fallenbagel
2022-05-26 02:24:31 +05:00
parent 4f972be858
commit 01e81a73a3
3 changed files with 20 additions and 5 deletions

View File

@@ -494,6 +494,11 @@ router.post(
const jellyfinUsersResponse = await jellyfinClient.getUsers();
const createdUsers: User[] = [];
const { hostname, externalHostname } = getSettings().jellyfin;
const jellyfinHost =
externalHostname && externalHostname.length > 0
? externalHostname
: hostname;
for (const account of jellyfinUsersResponse.users) {
if (account.Name) {
const user = await userRepository
@@ -505,7 +510,7 @@ router.post(
.getOne();
const avatar = account.PrimaryImageTag
? `${settings.jellyfin.hostname}/Users/${account.Id}/Images/Primary/?tag=${account.PrimaryImageTag}&quality=90`
? `${jellyfinHost}/Users/${account.Id}/Images/Primary/?tag=${account.PrimaryImageTag}&quality=90`
: '/os_logo_square.png';
if (user) {