From be6d7091c394f1780b1ab257d3b944aa1fa0b902 Mon Sep 17 00:00:00 2001 From: xion Date: Sun, 23 Mar 2025 18:14:36 +0800 Subject: [PATCH] temp --- .npmrc | 4 +- package.json | 1 + pnpm-lock.yaml | 3 ++ src/app-run.ts | 2 - src/module/login/login-by-web.ts | 3 ++ src/route/system-config/index.ts | 1 - src/route/system-config/list.ts | 57 ------------------------- src/route/system-config/model/config.ts | 39 ----------------- 8 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 src/route/system-config/index.ts delete mode 100644 src/route/system-config/list.ts delete mode 100644 src/route/system-config/model/config.ts diff --git a/.npmrc b/.npmrc index a4d9caf..0a2c6cd 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,3 @@ //npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN} -@abearxiong:registry=https://npm.pkg.github.com -//registry.npmjs.org/:_authToken=${NPM_TOKEN} \ No newline at end of file +//registry.npmjs.org/:_authToken=${NPM_TOKEN} +ignore-workspace-root-check=true \ No newline at end of file diff --git a/package.json b/package.json index 290860c..910ee5d 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "rollup-plugin-esbuild": "^6.2.1", "tar": "^7.4.3", "tslib": "^2.8.1", + "tsup": "^8.4.0", "typescript": "^5.8.2" }, "resolutions": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce2a907..f0d058c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -108,6 +108,9 @@ importers: tslib: specifier: ^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: specifier: ^5.8.2 version: 5.8.2 diff --git a/src/app-run.ts b/src/app-run.ts index 26a7eac..df02055 100644 --- a/src/app-run.ts +++ b/src/app-run.ts @@ -1,8 +1,6 @@ import { App } from '@kevisual/router'; import { app } from './app.ts'; -import './route/system-config/index.ts'; - type Message = { path: string; key?: string; diff --git a/src/module/login/login-by-web.ts b/src/module/login/login-by-web.ts index b9a41f3..3458b5a 100644 --- a/src/module/login/login-by-web.ts +++ b/src/module/login/login-by-web.ts @@ -21,6 +21,9 @@ export const pollLoginStatus = async (token: string, opts: PollLoginOptions) => load.load( async () => { const res = await queryLogin.checkLoginStatus(token); + if (res.code === 500) { + load.cancel('check-login-status'); + } return res; }, { diff --git a/src/route/system-config/index.ts b/src/route/system-config/index.ts deleted file mode 100644 index 9166f9d..0000000 --- a/src/route/system-config/index.ts +++ /dev/null @@ -1 +0,0 @@ -import './list.ts' \ No newline at end of file diff --git a/src/route/system-config/list.ts b/src/route/system-config/list.ts deleted file mode 100644 index 02b1554..0000000 --- a/src/route/system-config/list.ts +++ /dev/null @@ -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); diff --git a/src/route/system-config/model/config.ts b/src/route/system-config/model/config.ts deleted file mode 100644 index e123ee9..0000000 --- a/src/route/system-config/model/config.ts +++ /dev/null @@ -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); -});