mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-30 11:16:35 +00:00
fix: explicitly cache images to prevent unexpected behavior
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { AllAppConfig, AppConfigRawResponse } from '$lib/types/application-configuration';
|
||||
import { cachedApplicationLogo, cachedBackgroundImage } from '$lib/utils/cached-image-util';
|
||||
import APIService from './api-service';
|
||||
|
||||
export default class AppConfigService extends APIService {
|
||||
@@ -36,6 +37,7 @@ export default class AppConfigService extends APIService {
|
||||
await this.api.put(`/application-configuration/logo`, formData, {
|
||||
params: { light }
|
||||
});
|
||||
cachedApplicationLogo.bustCache(light);
|
||||
}
|
||||
|
||||
async updateBackgroundImage(backgroundImage: File) {
|
||||
@@ -43,6 +45,7 @@ export default class AppConfigService extends APIService {
|
||||
formData.append('file', backgroundImage!);
|
||||
|
||||
await this.api.put(`/application-configuration/background-image`, formData);
|
||||
cachedBackgroundImage.bustCache();
|
||||
}
|
||||
|
||||
async sendTestEmail() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
OidcDeviceCodeInfo
|
||||
} from '$lib/types/oidc.type';
|
||||
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
|
||||
import { cachedOidcClientLogo } from '$lib/utils/cached-image-util';
|
||||
import APIService from './api-service';
|
||||
|
||||
class OidcService extends APIService {
|
||||
@@ -80,10 +81,12 @@ class OidcService extends APIService {
|
||||
formData.append('file', image!);
|
||||
|
||||
await this.api.post(`/oidc/clients/${client.id}/logo`, formData);
|
||||
cachedOidcClientLogo.bustCache(client.id);
|
||||
}
|
||||
|
||||
async removeClientLogo(id: string) {
|
||||
await this.api.delete(`/oidc/clients/${id}/logo`);
|
||||
cachedOidcClientLogo.bustCache(id);
|
||||
}
|
||||
|
||||
async createClientSecret(id: string) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import userStore from '$lib/stores/user-store';
|
||||
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
|
||||
import type { UserGroup } from '$lib/types/user-group.type';
|
||||
import type { User, UserCreate } from '$lib/types/user.type';
|
||||
import { bustProfilePictureCache } from '$lib/utils/profile-picture-util';
|
||||
import { cachedProfilePicture } from '$lib/utils/cached-image-util';
|
||||
import { get } from 'svelte/store';
|
||||
import APIService from './api-service';
|
||||
|
||||
@@ -52,26 +52,26 @@ export default class UserService extends APIService {
|
||||
const formData = new FormData();
|
||||
formData.append('file', image!);
|
||||
|
||||
bustProfilePictureCache(userId);
|
||||
await this.api.put(`/users/${userId}/profile-picture`, formData);
|
||||
cachedProfilePicture.bustCache(userId);
|
||||
}
|
||||
|
||||
async updateCurrentUsersProfilePicture(image: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', image!);
|
||||
|
||||
bustProfilePictureCache(get(userStore)!.id);
|
||||
await this.api.put('/users/me/profile-picture', formData);
|
||||
cachedProfilePicture.bustCache(get(userStore)!.id);
|
||||
}
|
||||
|
||||
async resetCurrentUserProfilePicture() {
|
||||
bustProfilePictureCache(get(userStore)!.id);
|
||||
await this.api.delete(`/users/me/profile-picture`);
|
||||
cachedProfilePicture.bustCache(get(userStore)!.id);
|
||||
}
|
||||
|
||||
async resetProfilePicture(userId: string) {
|
||||
bustProfilePictureCache(userId);
|
||||
await this.api.delete(`/users/${userId}/profile-picture`);
|
||||
cachedProfilePicture.bustCache(userId);
|
||||
}
|
||||
|
||||
async createOneTimeAccessToken(expiresAt: Date, userId: string) {
|
||||
|
||||
Reference in New Issue
Block a user