mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 13:09:51 +01:00
feat: asset base
This commit is contained in:
1 parent
5e9555aa57
commit
cd2bad3b27
1 file changed
+1
-8
@@ -1,12 +1,5 @@
|
|||||||
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 branch === 'main'
|
return `${assertSecret(import.meta.env.PUBLIC_ASSET_BASE)}/${path}`;
|
||||||
? `https://${fastUser}.github.io/${fastRepo}/${path}`
|
|
||||||
: `https://raw.githubusercontent.com/${repo}/${branch}/${path}`;
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user