feat: 添加云端构建功能,支持参数配置和环境变量

This commit is contained in:
2026-03-10 01:18:27 +08:00
parent 7d227d3913
commit d08345d81c
6 changed files with 281 additions and 22 deletions

View File

@@ -1,7 +1,10 @@
import { Result } from '@kevisual/query';
import { CNB } from '../../src/index.ts';
import { useKey } from '@kevisual/context';
export const getConfig = async (opts: { token?: string }) => {
const res = await fetch('https://kevisual.cn/api/router', {
const kevisualEnv = useKey('KEVISUAL_ENV')
const baseUrl = kevisualEnv === 'production' ? 'https://kevisual.cn/api/router' : 'https://kevisual.xiongxiao.me/api/router';
const res = await fetch(baseUrl, {
method: 'POST',
body: JSON.stringify({
path: 'config',
@@ -51,6 +54,7 @@ export class CNBManager {
cnbItem.runAt = Date.now()
return cnbItem
}
const res = await getConfig({ token: opts?.kevisualToken })
if (res.code === 200) {
const cookie = res.data?.data?.CNB_COOKIE