From 71ae1b1aa585e4f7ec1290ca38625a8b4219a34e Mon Sep 17 00:00:00 2001
From: Sam
Date: Mon, 22 May 2023 14:48:48 +0200
Subject: [PATCH] feat: allow separate domain for media
---
frontend/src/lib/api/entities.ts | 10 +++++-----
frontend/src/routes/settings/export/+page.svelte | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/frontend/src/lib/api/entities.ts b/frontend/src/lib/api/entities.ts
index 4cba7b4..acb2767 100644
--- a/frontend/src/lib/api/entities.ts
+++ b/frontend/src/lib/api/entities.ts
@@ -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`,
];
};
diff --git a/frontend/src/routes/settings/export/+page.svelte b/frontend/src/routes/settings/export/+page.svelte
index d33e177..983dcce 100644
--- a/frontend/src/routes/settings/export/+page.svelte
+++ b/frontend/src/routes/settings/export/+page.svelte
@@ -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:
-