mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
fix(cloud PFP): Not pulling from cloud on page load
This commit is contained in:
@@ -28,6 +28,10 @@ export function pfpUrlWithHash(url: string, hash: string | null | undefined): st
|
||||
return `${base}?v=${hash}`;
|
||||
}
|
||||
|
||||
export function defaultAccountsPfpUrl(userId: string): string {
|
||||
return `${ACCOUNTS_BASE}/api/user/pfp/${userId}`;
|
||||
}
|
||||
|
||||
async function fetchServerHash(userId: string): Promise<string | null> {
|
||||
const res = await fetch(`${ACCOUNTS_BASE}/api/user/pfp/${userId}/meta`);
|
||||
if (!res.ok) return null;
|
||||
@@ -95,6 +99,10 @@ export async function resolveCloudPfp(
|
||||
if (localHash) {
|
||||
headers["If-None-Match"] = `"${localHash}"`;
|
||||
}
|
||||
const token = await cloudAuth.getStoredToken();
|
||||
if (token && isAccountsHostedPfpUrl(pfpUrl)) {
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
const res = await fetch(imageUrl, { headers });
|
||||
if (res.status === 304 && localBlob instanceof Blob) {
|
||||
|
||||
Reference in New Issue
Block a user