mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 11:39:51 +01: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';
|
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) {
|
export function asset(path: string) {
|
||||||
return `https://raw.githubusercontent.com/${assertSecret(
|
return branch === 'main'
|
||||||
import.meta.env.PUBLIC_ASSET_REPO,
|
? `https://${fastUser}.github.io/${fastRepo}/${path}`
|
||||||
)}/${assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH)}/${path}`;
|
: `https://raw.githubusercontent.com/${repo}/${branch}/${path}`;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user