mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-21 09:15:55 +03:00
fix: decouple images from app config service (#965)
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="%lang%">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/api/application-configuration/favicon" />
|
||||
<link rel="icon" href="/api/application-images/favicon" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<link rel="manifest" href="/app.webmanifest" />
|
||||
|
||||
@@ -32,14 +32,14 @@ export default class AppConfigService extends APIService {
|
||||
const formData = new FormData();
|
||||
formData.append('file', favicon!);
|
||||
|
||||
await this.api.put(`/application-configuration/favicon`, formData);
|
||||
await this.api.put(`/application-images/favicon`, formData);
|
||||
}
|
||||
|
||||
async updateLogo(logo: File, light = true) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', logo!);
|
||||
|
||||
await this.api.put(`/application-configuration/logo`, formData, {
|
||||
await this.api.put(`/application-images/logo`, formData, {
|
||||
params: { light }
|
||||
});
|
||||
cachedApplicationLogo.bustCache(light);
|
||||
@@ -49,7 +49,7 @@ export default class AppConfigService extends APIService {
|
||||
const formData = new FormData();
|
||||
formData.append('file', backgroundImage!);
|
||||
|
||||
await this.api.put(`/application-configuration/background-image`, formData);
|
||||
await this.api.put(`/application-images/background`, formData);
|
||||
cachedBackgroundImage.bustCache();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ type CachableImage = {
|
||||
|
||||
export const cachedApplicationLogo: CachableImage = {
|
||||
getUrl: (light = true) => {
|
||||
let url = '/api/application-configuration/logo';
|
||||
let url = '/api/application-images/logo';
|
||||
if (!light) {
|
||||
url += '?light=false';
|
||||
}
|
||||
return getCachedImageUrl(url);
|
||||
},
|
||||
bustCache: (light = true) => {
|
||||
let url = '/api/application-configuration/logo';
|
||||
let url = '/api/application-images/logo';
|
||||
if (!light) {
|
||||
url += '?light=false';
|
||||
}
|
||||
@@ -25,8 +25,8 @@ export const cachedApplicationLogo: CachableImage = {
|
||||
};
|
||||
|
||||
export const cachedBackgroundImage: CachableImage = {
|
||||
getUrl: () => getCachedImageUrl('/api/application-configuration/background-image'),
|
||||
bustCache: () => bustImageCache('/api/application-configuration/background-image')
|
||||
getUrl: () => getCachedImageUrl('/api/application-images/background'),
|
||||
bustCache: () => bustImageCache('/api/application-images/background')
|
||||
};
|
||||
|
||||
export const cachedProfilePicture: CachableImage = {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
imageClass="size-14 p-2"
|
||||
label={m.favicon()}
|
||||
bind:image={favicon}
|
||||
imageURL="/api/application-configuration/favicon"
|
||||
imageURL="/api/application-images/favicon"
|
||||
accept="image/x-icon"
|
||||
/>
|
||||
<ApplicationImage
|
||||
|
||||
Reference in New Issue
Block a user