feat: 添加获取 cnb-board live mdContent 内容的路由,修正时间戳处理
This commit is contained in:
@@ -1,9 +1,30 @@
|
|||||||
import { app } from '../../app.ts';
|
import { app } from '../../app.ts';
|
||||||
import { useKey } from '@kevisual/context'
|
import { useKey } from '@kevisual/context'
|
||||||
|
import { getLiveMdContent } from './live/live-content.ts';
|
||||||
|
import z from 'zod';
|
||||||
|
|
||||||
app.route({
|
app.route({
|
||||||
path: 'cnb-board',
|
path: 'cnb_board',
|
||||||
key: 'live-repo-info',
|
key: 'live',
|
||||||
|
description: '获取cnb-board live的mdContent内容',
|
||||||
|
middleware: ['auth-admin'],
|
||||||
|
metadata: {
|
||||||
|
args: {
|
||||||
|
more: z.boolean().optional().describe('是否获取更多系统信息,默认false'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).define(async (ctx) => {
|
||||||
|
const more = ctx.query?.more ?? false
|
||||||
|
const list = getLiveMdContent({ more: more });
|
||||||
|
ctx.body = {
|
||||||
|
title: '开发环境模式配置',
|
||||||
|
list,
|
||||||
|
};
|
||||||
|
}).addTo(app);
|
||||||
|
|
||||||
|
app.route({
|
||||||
|
path: 'cnb_board',
|
||||||
|
key: 'live_repo_info',
|
||||||
description: '获取cnb-board live的repo信息',
|
description: '获取cnb-board live的repo信息',
|
||||||
middleware: ['auth-admin']
|
middleware: ['auth-admin']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
@@ -54,8 +75,8 @@ app.route({
|
|||||||
|
|
||||||
// 构建类变量
|
// 构建类变量
|
||||||
app.route({
|
app.route({
|
||||||
path: 'cnb-board',
|
path: 'cnb_board',
|
||||||
key: 'live-build-info',
|
key: 'live_build_info',
|
||||||
description: '获取cnb-board live的构建信息',
|
description: '获取cnb-board live的构建信息',
|
||||||
middleware: ['auth-admin']
|
middleware: ['auth-admin']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
@@ -199,8 +220,8 @@ app.route({
|
|||||||
|
|
||||||
// PR/合并类变量
|
// PR/合并类变量
|
||||||
app.route({
|
app.route({
|
||||||
path: 'cnb-board',
|
path: 'cnb_board',
|
||||||
key: 'live-pull-info',
|
key: 'live_pull_info',
|
||||||
description: '获取cnb-board live的PR信息',
|
description: '获取cnb-board live的PR信息',
|
||||||
middleware: ['auth-admin']
|
middleware: ['auth-admin']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
@@ -299,8 +320,8 @@ app.route({
|
|||||||
|
|
||||||
// NPC 类变量
|
// NPC 类变量
|
||||||
app.route({
|
app.route({
|
||||||
path: 'cnb-board',
|
path: 'cnb_board',
|
||||||
key: 'live-npc-info',
|
key: 'live_npc_info',
|
||||||
description: '获取cnb-board live的NPC信息',
|
description: '获取cnb-board live的NPC信息',
|
||||||
middleware: ['auth-admin']
|
middleware: ['auth-admin']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
@@ -344,8 +365,8 @@ app.route({
|
|||||||
|
|
||||||
// 评论类变量
|
// 评论类变量
|
||||||
app.route({
|
app.route({
|
||||||
path: 'cnb-board',
|
path: 'cnb_board',
|
||||||
key: 'live-comment-info',
|
key: 'live_comment_info',
|
||||||
description: '获取cnb-board live的评论信息',
|
description: '获取cnb-board live的评论信息',
|
||||||
middleware: ['auth-admin']
|
middleware: ['auth-admin']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { app } from '../../app.ts';
|
import { app } from '../../app.ts';
|
||||||
import { getLiveMdContent } from './live/live-content.ts';
|
|
||||||
import './cnb-dev-env.ts';
|
import './cnb-dev-env.ts';
|
||||||
import z from 'zod';
|
|
||||||
import { execCommand } from '@/module/npm-install.ts';
|
import { execCommand } from '@/module/npm-install.ts';
|
||||||
import { useKey } from '@kevisual/context';
|
import { useKey } from '@kevisual/context';
|
||||||
|
|
||||||
@@ -17,24 +15,7 @@ app.route({
|
|||||||
};
|
};
|
||||||
}).addTo(app);
|
}).addTo(app);
|
||||||
|
|
||||||
app.route({
|
|
||||||
path: 'cnb-board',
|
|
||||||
key: 'live',
|
|
||||||
description: '获取cnb-board live的mdContent内容',
|
|
||||||
middleware: ['auth-admin'],
|
|
||||||
metadata: {
|
|
||||||
args: {
|
|
||||||
more: z.boolean().optional().describe('是否获取更多系统信息,默认false'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).define(async (ctx) => {
|
|
||||||
const more = ctx.query?.more ?? false
|
|
||||||
const list = getLiveMdContent({ more: more });
|
|
||||||
ctx.body = {
|
|
||||||
title: '开发环境模式配置',
|
|
||||||
list,
|
|
||||||
};
|
|
||||||
}).addTo(app);
|
|
||||||
|
|
||||||
|
|
||||||
app.route({
|
app.route({
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ const createOSInfo = (more = false) => {
|
|||||||
|
|
||||||
// 如果有 CNB_BUILD_START_TIME,添加构建启动时间
|
// 如果有 CNB_BUILD_START_TIME,添加构建启动时间
|
||||||
if (startTimer) {
|
if (startTimer) {
|
||||||
const buildStartTime = dayjs(parseInt(startTimer as string)).format('YYYY-MM-DD HH:mm:ss')
|
const buildStartTime = dayjs(parseInt(startTimer as string) * 1000).format('YYYY-MM-DD HH:mm:ss')
|
||||||
const buildUptime = Date.now() - parseInt(startTimer as string)
|
const buildUptime = Date.now() - parseInt(startTimer as string) * 1000
|
||||||
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000))
|
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000))
|
||||||
labels.push(
|
labels.push(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user