mirror of
https://github.com/revanced/revanced-website.git
synced 2025-06-12 21:27:42 +02:00
feat: switch api url and bypass cache while prerendering
This commit is contained in:
16
src/lib/utils.ts
Normal file
16
src/lib/utils.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { prerendering } from "$app/environment";
|
||||
|
||||
export function api_url(endpoint: string): string {
|
||||
let url = `https://releases.revanced.app/${endpoint}`;
|
||||
|
||||
if (prerendering) {
|
||||
url += '?cacheBypass=';
|
||||
// Just add some random stuff to the string. Doesn't really matter what we add.
|
||||
// This is here to make sure we bypass the cache while prerendering.
|
||||
for (let i = 0; i < 6; i++) {
|
||||
url += Math.floor(Math.random() * 10).toString();
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
Reference in New Issue
Block a user