fix(pwa): 🐛 remove randomness from cache version getter

This commit is contained in:
Julien Oculi 2024-07-17 13:21:58 +02:00
parent ae1b87c253
commit 5716284c73

View file

@ -7,8 +7,7 @@ import { encodeBase64 } from '@std/encoding'
export type PrecacheResponse = { version: string; preCachedUrls: string[] }
async function getVersion() {
const versionRaw = crypto.randomUUID() + BUILD_ID
const versionBytes = new TextEncoder().encode(versionRaw)
const versionBytes = new TextEncoder().encode(BUILD_ID)
const versionHash = await crypto.subtle.digest('SHA-256', versionBytes)
return encodeBase64(versionHash)
}