mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: fast assets
This commit is contained in:
1 parent
518a83ee73
commit
2c7082fe04
1 file changed
+8
-3
@@ -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}`;
|
||||
}
|
||||
Reference in new issue
Block a user