mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复初始化设置通知,shell 映射,邮箱通知错误提示
This commit is contained in:
parent
20f615eadf
commit
085cb789b5
|
@ -8,8 +8,8 @@ async function linkToNodeModule(src: string, dst?: string) {
|
||||||
const target = path.join(config.rootPath, 'node_modules', dst || src);
|
const target = path.join(config.rootPath, 'node_modules', dst || src);
|
||||||
const source = path.join(config.rootPath, src);
|
const source = path.join(config.rootPath, src);
|
||||||
|
|
||||||
const _exist = await fileExist(target);
|
const stats = await fs.lstat(target);
|
||||||
if (!_exist) {
|
if (!stats) {
|
||||||
await fs.symlink(source, target, 'dir');
|
await fs.symlink(source, target, 'dir');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,6 @@ export default ({ app }: { app: Application }) => {
|
||||||
}
|
}
|
||||||
const userService = Container.get(UserService);
|
const userService = Container.get(UserService);
|
||||||
const authInfo = await userService.getUserInfo();
|
const authInfo = await userService.getUserInfo();
|
||||||
const envCount = await EnvModel.count();
|
|
||||||
|
|
||||||
let isInitialized = true;
|
let isInitialized = true;
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -234,8 +234,7 @@ export default class NotificationService {
|
||||||
telegramBotUserId,
|
telegramBotUserId,
|
||||||
} = this.params;
|
} = this.params;
|
||||||
const authStr = telegramBotProxyAuth ? `${telegramBotProxyAuth}@` : '';
|
const authStr = telegramBotProxyAuth ? `${telegramBotProxyAuth}@` : '';
|
||||||
const url = `https://${
|
const url = `https://${telegramBotApiHost ? telegramBotApiHost : 'api.telegram.org'
|
||||||
telegramBotApiHost ? telegramBotApiHost : 'api.telegram.org'
|
|
||||||
}/bot${telegramBotToken}/sendMessage`;
|
}/bot${telegramBotToken}/sendMessage`;
|
||||||
let agent;
|
let agent;
|
||||||
if (telegramBotProxyHost && telegramBotProxyPort) {
|
if (telegramBotProxyHost && telegramBotProxyPort) {
|
||||||
|
@ -562,7 +561,7 @@ export default class NotificationService {
|
||||||
throw new Error(JSON.stringify(info));
|
throw new Error(JSON.stringify(info));
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,53 @@ const Initialization = () => {
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: intl.get('通知设置'),
|
||||||
|
content: (
|
||||||
|
<Form onFinish={submitNotification} layout="vertical">
|
||||||
|
<Form.Item
|
||||||
|
label={intl.get('通知方式')}
|
||||||
|
name="type"
|
||||||
|
rules={[{ required: true, message: intl.get('请选择通知方式') }]}
|
||||||
|
style={{ maxWidth: 350 }}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
onChange={notificationModeChange}
|
||||||
|
placeholder={intl.get('请选择通知方式')}
|
||||||
|
>
|
||||||
|
{config.notificationModes
|
||||||
|
.filter((x) => x.value !== 'closed')
|
||||||
|
.map((x) => (
|
||||||
|
<Option key={x.value} value={x.value}>
|
||||||
|
{x.label}
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
{fields.map((x) => (
|
||||||
|
<Form.Item
|
||||||
|
key={x.label}
|
||||||
|
label={x.label}
|
||||||
|
name={x.label}
|
||||||
|
extra={x.tip}
|
||||||
|
rules={[{ required: x.required }]}
|
||||||
|
style={{ maxWidth: 400 }}
|
||||||
|
>
|
||||||
|
<Input.TextArea
|
||||||
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
|
placeholder={`请输入${x.label}`}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Button type="primary" htmlType="submit" loading={loading}>
|
||||||
|
{intl.get('保存')}
|
||||||
|
</Button>
|
||||||
|
<Button type="link" htmlType="button" onClick={() => next()}>
|
||||||
|
{intl.get('跳过')}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: intl.get('账户设置'),
|
title: intl.get('账户设置'),
|
||||||
content: (
|
content: (
|
||||||
|
@ -152,53 +199,6 @@ const Initialization = () => {
|
||||||
</Form>
|
</Form>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: intl.get('通知设置'),
|
|
||||||
content: (
|
|
||||||
<Form onFinish={submitNotification} layout="vertical">
|
|
||||||
<Form.Item
|
|
||||||
label={intl.get('通知方式')}
|
|
||||||
name="type"
|
|
||||||
rules={[{ required: true, message: intl.get('请选择通知方式') }]}
|
|
||||||
style={{ maxWidth: 350 }}
|
|
||||||
>
|
|
||||||
<Select
|
|
||||||
onChange={notificationModeChange}
|
|
||||||
placeholder={intl.get('请选择通知方式')}
|
|
||||||
>
|
|
||||||
{config.notificationModes
|
|
||||||
.filter((x) => x.value !== 'closed')
|
|
||||||
.map((x) => (
|
|
||||||
<Option key={x.value} value={x.value}>
|
|
||||||
{x.label}
|
|
||||||
</Option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
{fields.map((x) => (
|
|
||||||
<Form.Item
|
|
||||||
key={x.label}
|
|
||||||
label={x.label}
|
|
||||||
name={x.label}
|
|
||||||
extra={x.tip}
|
|
||||||
rules={[{ required: x.required }]}
|
|
||||||
style={{ maxWidth: 400 }}
|
|
||||||
>
|
|
||||||
<Input.TextArea
|
|
||||||
autoSize={{ minRows: 1, maxRows: 5 }}
|
|
||||||
placeholder={`请输入${x.label}`}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
))}
|
|
||||||
<Button type="primary" htmlType="submit" loading={loading}>
|
|
||||||
{intl.get('保存')}
|
|
||||||
</Button>
|
|
||||||
<Button type="link" htmlType="button" onClick={() => next()}>
|
|
||||||
{intl.get('跳过')}
|
|
||||||
</Button>
|
|
||||||
</Form>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: intl.get('完成安装'),
|
title: intl.get('完成安装'),
|
||||||
content: (
|
content: (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user