fix(avatar): fix avatar cache busting by using avatarVersion (#1537)

* fix(avatar): fix avatar cache busting by using avatarVersion

Previously, avatar caching did not update the avatar when the remote image changed. This commit adds
logic to check if the avatar was modified remotely by comparing aremote last-modified timestamp with
a locally stored version (avatarVersion). If a change is detected, the cache is cleared, a new image
is fetched, and avatarVersionis updated. Otherwise, the cached image is retained.

* chore(db): add db migrations

* refactor: refactor imagehelpers util to where its used

* refactor: remove remnants from previous cache busting versions
This commit is contained in:
fallenbagel
2025-03-28 06:02:34 +08:00
committed by GitHub
parent 7438042757
commit 29034b350d
6 changed files with 232 additions and 13 deletions

View File

@@ -98,6 +98,12 @@ export class User {
@Column()
public avatar: string;
@Column({ type: 'varchar', nullable: true })
public avatarETag?: string | null;
@Column({ type: 'varchar', nullable: true })
public avatarVersion?: string | null;
@RelationCount((user: User) => user.requests)
public requestCount: number;