feat: fast assets

This commit is contained in:
tresabhi committed 2025-05-18 09:54:12 -05:00
1 parent 518a83ee73
commit 2c7082fe04
1 file changed
+8 -3
+8 -3
View File
@@ -1,7 +1,12 @@
import { assertSecret } from './assertSecret';
const repo = assertSecret(import.meta.env.PUBLIC_ASSET_REPO);
const branch = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
const fastUser = assertSecret(import.meta.env.PUBLIC_ASSET_FAST_USER);
const fastRepo = assertSecret(import.meta.env.PUBLIC_ASSET_FAST_REPO);
export function asset(path: string) {
return `https://raw.githubusercontent.com/${assertSecret(
import.meta.env.PUBLIC_ASSET_REPO,
)}/${assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH)}/${path}`;
return branch === 'main'
? `https://${fastUser}.github.io/${fastRepo}/${path}`
: `https://raw.githubusercontent.com/${repo}/${branch}/${path}`;
}