feat: 添加云端构建功能,支持参数配置和环境变量
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user