feat: allow separate domain for media

This commit is contained in:
Sam 2023-05-22 14:48:48 +02:00
parent 4123f957f0
commit 71ae1b1aa5
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
2 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import { PUBLIC_BASE_URL } from "$env/static/public";
import { PUBLIC_BASE_URL, PUBLIC_MEDIA_URL } from "$env/static/public";
export const MAX_MEMBERS = 500;
export const MAX_FIELDS = 25;
@ -178,8 +178,8 @@ export const userAvatars = (user: User | MeUser | MemberPartialUser) => {
if (!user.avatar) return defaultAvatars;
return [
`${PUBLIC_BASE_URL}/media/users/${user.id}/${user.avatar}.webp`,
`${PUBLIC_BASE_URL}/media/users/${user.id}/${user.avatar}.jpg`,
`${PUBLIC_MEDIA_URL}/users/${user.id}/${user.avatar}.webp`,
`${PUBLIC_MEDIA_URL}/users/${user.id}/${user.avatar}.jpg`,
];
};
@ -187,8 +187,8 @@ export const memberAvatars = (member: Member | PartialMember) => {
if (!member.avatar) return defaultAvatars;
return [
`${PUBLIC_BASE_URL}/media/members/${member.id}/${member.avatar}.webp`,
`${PUBLIC_BASE_URL}/media/members/${member.id}/${member.avatar}.jpg`,
`${PUBLIC_MEDIA_URL}/members/${member.id}/${member.avatar}.webp`,
`${PUBLIC_MEDIA_URL}/members/${member.id}/${member.avatar}.jpg`,
];
};

View file

@ -2,7 +2,7 @@
import type { PageData } from "./$types";
import { DateTime, Duration } from "luxon";
import { Alert, Button } from "sveltestrap";
import { PUBLIC_BASE_URL } from "$env/static/public";
import { PUBLIC_MEDIA_URL } from "$env/static/public";
import { fastFetchClient } from "$lib/api/fetch";
import type { APIError } from "$lib/api/entities";
import { addToast } from "$lib/toast";
@ -69,7 +69,7 @@
Download your export file below:
</p>
<p>
<Button color="primary" href="{PUBLIC_BASE_URL}/media{data.exportData.path}" target="_blank"
<Button color="primary" href="{PUBLIC_MEDIA_URL}{data.exportData.path}" target="_blank"
>Download data export</Button
>
</p>