更新 CLI 版本至 0.1.33,重构构建配置,添加新的路由和中间件,增强身份验证支持

This commit is contained in:
xiongxiao
2026-03-24 17:38:37 +08:00
committed by cnb
parent b05f059aea
commit 4e2ae49372
27 changed files with 125 additions and 97 deletions

View File

@@ -26,6 +26,7 @@ app.route({
key: 'ls',
description: '显示 token 列表',
metadata: {
middleware: ['auth'],
args: {}
}
}).define(async () => {
@@ -39,6 +40,7 @@ app.route({
key: 'info',
description: '显示 token 信息',
metadata: {
middleware: ['auth'],
args: {
env: z.boolean().optional().describe('显示环境变量中的 token'),
}
@@ -58,6 +60,7 @@ app.route({
key: 'create',
description: '创建 jwks token',
metadata: {
middleware: ['auth'],
args: {}
}
}).define(async () => {
@@ -77,6 +80,7 @@ app.route({
key: 'info',
description: '显示 baseURL',
metadata: {
middleware: ['auth'],
args: {
add: z.string().optional().describe('添加 baseURL'),
remove: z.number().optional().describe('按编号移除 baseURL'),
@@ -166,6 +170,7 @@ app.route({
key: 'set',
description: '设置 baseURL',
metadata: {
middleware: ['auth'],
args: {
baseURL: z.string().optional().describe('baseURL 地址'),
}
@@ -185,6 +190,7 @@ app.route({
key: 'manage',
description: 'registry 管理',
metadata: {
middleware: ['auth'],
args: {
list: z.boolean().optional().describe('列出 registry'),
set: z.string().optional().describe('设置 registry'),
@@ -219,7 +225,10 @@ app.route({
path: 'baseURL',
key: 'kevisual',
description: 'kevisual registry',
metadata: { args: {} }
metadata: {
middleware: ['auth'],
args: {}
}
}).define(async () => {
const config = getConfig();
const defaultRegistry = ['https://kevisual.cn'];
@@ -227,23 +236,14 @@ app.route({
showList(defaultRegistry);
}).addTo(app)
app.route({
path: 'baseURL',
key: 'silky',
description: 'silky registry',
metadata: { args: {} }
}).define(async () => {
const config = getConfig();
const defaultRegistry = ['https://kevisual.silkyai.cn'];
writeConfig({ ...config, baseURL: defaultRegistry[0] });
showList(defaultRegistry);
}).addTo(app)
app.route({
path: 'baseURL',
key: 'local',
description: 'local registry',
metadata: { args: {} }
metadata: {
middleware: ['auth'],
args: {}
}
}).define(async () => {
const config = getConfig();
const defaultRegistry = ['http://localhost:3005'];