temp
This commit is contained in:
parent
c16c1b3ce4
commit
be6d7091c3
4
.npmrc
4
.npmrc
@ -1,3 +1,3 @@
|
|||||||
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
|
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
|
||||||
@abearxiong:registry=https://npm.pkg.github.com
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
ignore-workspace-root-check=true
|
@ -57,6 +57,7 @@
|
|||||||
"rollup-plugin-esbuild": "^6.2.1",
|
"rollup-plugin-esbuild": "^6.2.1",
|
||||||
"tar": "^7.4.3",
|
"tar": "^7.4.3",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
|
"tsup": "^8.4.0",
|
||||||
"typescript": "^5.8.2"
|
"typescript": "^5.8.2"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -108,6 +108,9 @@ importers:
|
|||||||
tslib:
|
tslib:
|
||||||
specifier: ^2.8.1
|
specifier: ^2.8.1
|
||||||
version: 2.8.1
|
version: 2.8.1
|
||||||
|
tsup:
|
||||||
|
specifier: ^8.4.0
|
||||||
|
version: 8.4.0(postcss@8.5.3)(typescript@5.8.2)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.8.2
|
specifier: ^5.8.2
|
||||||
version: 5.8.2
|
version: 5.8.2
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { App } from '@kevisual/router';
|
import { App } from '@kevisual/router';
|
||||||
import { app } from './app.ts';
|
import { app } from './app.ts';
|
||||||
|
|
||||||
import './route/system-config/index.ts';
|
|
||||||
|
|
||||||
type Message = {
|
type Message = {
|
||||||
path: string;
|
path: string;
|
||||||
key?: string;
|
key?: string;
|
||||||
|
@ -21,6 +21,9 @@ export const pollLoginStatus = async (token: string, opts: PollLoginOptions) =>
|
|||||||
load.load(
|
load.load(
|
||||||
async () => {
|
async () => {
|
||||||
const res = await queryLogin.checkLoginStatus(token);
|
const res = await queryLogin.checkLoginStatus(token);
|
||||||
|
if (res.code === 500) {
|
||||||
|
load.cancel('check-login-status');
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1 +0,0 @@
|
|||||||
import './list.ts'
|
|
@ -1,57 +0,0 @@
|
|||||||
import { app } from '@/app.ts';
|
|
||||||
import { Config } from './model/config.ts';
|
|
||||||
app
|
|
||||||
.route({
|
|
||||||
path: 'config',
|
|
||||||
key: 'list',
|
|
||||||
})
|
|
||||||
.define(async (ctx) => {
|
|
||||||
ctx.body = await Config.findAll();
|
|
||||||
})
|
|
||||||
.addTo(app);
|
|
||||||
|
|
||||||
app
|
|
||||||
.route({
|
|
||||||
path: 'config',
|
|
||||||
key: 'meGet',
|
|
||||||
})
|
|
||||||
.define(async (ctx) => {
|
|
||||||
const config = await Config.findOne({
|
|
||||||
where: {
|
|
||||||
key: 'me',
|
|
||||||
},
|
|
||||||
logging: false,
|
|
||||||
});
|
|
||||||
ctx.body = config;
|
|
||||||
})
|
|
||||||
.addTo(app);
|
|
||||||
|
|
||||||
app
|
|
||||||
.route({
|
|
||||||
path: 'config',
|
|
||||||
key: 'meSet',
|
|
||||||
})
|
|
||||||
.define(async (ctx) => {
|
|
||||||
const { data } = ctx.query;
|
|
||||||
if (!data) {
|
|
||||||
ctx.throw(400, 'data is required');
|
|
||||||
}
|
|
||||||
let config = await Config.findOne({
|
|
||||||
where: { key: 'me' }, // 自定义条件
|
|
||||||
logging: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!config) {
|
|
||||||
config = await Config.create({
|
|
||||||
key: 'me',
|
|
||||||
value: data,
|
|
||||||
});
|
|
||||||
ctx.body = config;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
config.value = data;
|
|
||||||
await config.save();
|
|
||||||
ctx.body = config;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.addTo(app);
|
|
@ -1,39 +0,0 @@
|
|||||||
import { sequelize } from '@/app.ts';
|
|
||||||
import { DataTypes, Model } from 'sequelize';
|
|
||||||
|
|
||||||
// Define the system config model
|
|
||||||
|
|
||||||
export class Config extends Model {
|
|
||||||
declare id: number;
|
|
||||||
declare key: string;
|
|
||||||
declare value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.init(
|
|
||||||
{
|
|
||||||
id: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
autoIncrement: true,
|
|
||||||
primaryKey: true,
|
|
||||||
},
|
|
||||||
key: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: false,
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: DataTypes.JSON,
|
|
||||||
defaultValue: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
sequelize,
|
|
||||||
tableName: 'system_config',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
await Config.sync({
|
|
||||||
alter: true,
|
|
||||||
logging: false,
|
|
||||||
}).catch((e) => {
|
|
||||||
console.error('Config table sync error', e);
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user