From 085cb789b50d72e36bec60e3b2497e7b1b463328 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 2 Nov 2023 00:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=80=9A=E7=9F=A5=EF=BC=8Cshell=20=E6=98=A0?= =?UTF-8?q?=E5=B0=84=EF=BC=8C=E9=82=AE=E7=AE=B1=E9=80=9A=E7=9F=A5=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/deps.ts | 4 +- back/loaders/express.ts | 1 - back/services/notify.ts | 9 ++- src/pages/initialization/index.tsx | 94 +++++++++++++++--------------- 4 files changed, 53 insertions(+), 55 deletions(-) diff --git a/back/loaders/deps.ts b/back/loaders/deps.ts index b62194c7..f8b43860 100644 --- a/back/loaders/deps.ts +++ b/back/loaders/deps.ts @@ -8,8 +8,8 @@ async function linkToNodeModule(src: string, dst?: string) { const target = path.join(config.rootPath, 'node_modules', dst || src); const source = path.join(config.rootPath, src); - const _exist = await fileExist(target); - if (!_exist) { + const stats = await fs.lstat(target); + if (!stats) { await fs.symlink(source, target, 'dir'); } } diff --git a/back/loaders/express.ts b/back/loaders/express.ts index 45fd64dc..9b2f5c47 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -105,7 +105,6 @@ export default ({ app }: { app: Application }) => { } const userService = Container.get(UserService); const authInfo = await userService.getUserInfo(); - const envCount = await EnvModel.count(); let isInitialized = true; if ( diff --git a/back/services/notify.ts b/back/services/notify.ts index 55827b41..9646a254 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -42,7 +42,7 @@ export default class NotificationService { retry: 1, }; - constructor(@Inject('logger') private logger: winston.Logger) {} + constructor(@Inject('logger') private logger: winston.Logger) { } public async notify( title: string, @@ -234,9 +234,8 @@ export default class NotificationService { telegramBotUserId, } = this.params; const authStr = telegramBotProxyAuth ? `${telegramBotProxyAuth}@` : ''; - const url = `https://${ - telegramBotApiHost ? telegramBotApiHost : 'api.telegram.org' - }/bot${telegramBotToken}/sendMessage`; + const url = `https://${telegramBotApiHost ? telegramBotApiHost : 'api.telegram.org' + }/bot${telegramBotToken}/sendMessage`; let agent; if (telegramBotProxyHost && telegramBotProxyPort) { const options: any = { @@ -562,7 +561,7 @@ export default class NotificationService { throw new Error(JSON.stringify(info)); } } catch (error: any) { - throw new Error(error.response ? error.response.body : error); + throw error; } } diff --git a/src/pages/initialization/index.tsx b/src/pages/initialization/index.tsx index 61cc90d2..e563249c 100644 --- a/src/pages/initialization/index.tsx +++ b/src/pages/initialization/index.tsx @@ -95,6 +95,53 @@ const Initialization = () => { ), }, + { + title: intl.get('通知设置'), + content: ( +
+ + + + {fields.map((x) => ( + + + + ))} + + +
+ ), + }, { title: intl.get('账户设置'), content: ( @@ -152,53 +199,6 @@ const Initialization = () => { ), }, - { - title: intl.get('通知设置'), - content: ( -
- - - - {fields.map((x) => ( - - - - ))} - - -
- ), - }, { title: intl.get('完成安装'), content: (