mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 09:34:31 +08:00
系统设置增加依赖代理和镜像源设置
This commit is contained in:
+10
-1
@@ -466,5 +466,14 @@
|
||||
"个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx": "Individuals: user_id=individual QQ Groups fill in group_id=QQ Groups more than one with English; separated by the same time to support individuals and groups such as: user_id=xxx;group_id=xxxx;group_id=xxxxx",
|
||||
"docker安装在持久化config目录下的chronocat.yml文件可找到": "The docker installation can be found in the persistence config directory in the chronocat.yml file",
|
||||
"请选择": "Please select",
|
||||
"请输入": "Please input"
|
||||
"请输入": "Please input",
|
||||
"依赖设置": "Dependence Settings",
|
||||
"Node 软件包镜像源": "Node Software Package Mirror Source",
|
||||
"Python 软件包镜像源": "Python Software Package Mirror Source",
|
||||
"Linux 软件包镜像源": "Linux Software Package Mirror Source",
|
||||
"代理与镜像源二选一即可": "Either Proxy or Mirror Source can be chosen",
|
||||
"代理地址, 支持HTTP(S)/SOCK5": "Proxy Address, supports HTTP(S)/SOCK5",
|
||||
"NPM 镜像源": "NPM Mirror Source",
|
||||
"PyPI 镜像源": "PyPI Mirror Source",
|
||||
"alpine linux 镜像源": "Alpine Linux Mirror Source"
|
||||
}
|
||||
|
||||
+10
-1
@@ -466,5 +466,14 @@
|
||||
"个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx": "个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx",
|
||||
"docker安装在持久化config目录下的chronocat.yml文件可找到": "docker安装在持久化config目录下的chronocat.yml文件可找到",
|
||||
"请选择": "请选择",
|
||||
"请输入": "请输入"
|
||||
"请输入": "请输入",
|
||||
"依赖设置": "依赖设置",
|
||||
"Node 软件包镜像源": "Node 软件包镜像源",
|
||||
"Python 软件包镜像源": "Python 软件包镜像源",
|
||||
"Linux 软件包镜像源": "Linux 软件包镜像源",
|
||||
"代理与镜像源二选一即可": "代理与镜像源二选一即可",
|
||||
"代理地址, 支持HTTP(S)/SOCK5": "代理地址, 支持HTTP(S)/SOCK5",
|
||||
"NPM 镜像源": "NPM 镜像源",
|
||||
"PyPI 镜像源": "PyPI 镜像源",
|
||||
"alpine linux 镜像源": "alpine linux 镜像源"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
import intl from 'react-intl-universal';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { Button, InputNumber, Form, message, Input, Alert } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { request } from '@/utils/http';
|
||||
import './index.less';
|
||||
|
||||
const Dependence = () => {
|
||||
const [systemConfig, setSystemConfig] = useState<{
|
||||
dependenceProxy?: string;
|
||||
nodeMirror?: string;
|
||||
pythonMirror?: string;
|
||||
linuxMirror?: string;
|
||||
}>();
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const getSystemConfig = () => {
|
||||
request
|
||||
.get(`${config.apiPrefix}system/config`)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200 && data.info) {
|
||||
setSystemConfig(data.info);
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
const updateSystemConfig = () => {
|
||||
request
|
||||
.put(`${config.apiPrefix}system/config`, systemConfig)
|
||||
.then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
message.success(intl.get('更新成功'));
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getSystemConfig();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Form layout="vertical" form={form}>
|
||||
<Form.Item
|
||||
label={intl.get('代理')}
|
||||
name="proxy"
|
||||
extra={intl.get('代理与镜像源二选一即可')}
|
||||
>
|
||||
<Input.Group compact>
|
||||
<Input
|
||||
placeholder={intl.get('代理地址, 支持HTTP(S)/SOCK5')}
|
||||
style={{ width: 330 }}
|
||||
value={systemConfig?.dependenceProxy}
|
||||
onChange={(e) => {
|
||||
setSystemConfig({
|
||||
...systemConfig,
|
||||
dependenceProxy: e.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={updateSystemConfig}
|
||||
style={{ width: 84 }}
|
||||
>
|
||||
{intl.get('确认')}
|
||||
</Button>
|
||||
</Input.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={intl.get('Node 软件包镜像源')} name="node">
|
||||
<Input.Group compact>
|
||||
<Input
|
||||
style={{ width: 330 }}
|
||||
placeholder={intl.get('NPM 镜像源')}
|
||||
value={systemConfig?.nodeMirror}
|
||||
onChange={(e) => {
|
||||
setSystemConfig({ ...systemConfig, nodeMirror: e.target.value });
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={updateSystemConfig}
|
||||
style={{ width: 84 }}
|
||||
>
|
||||
{intl.get('确认')}
|
||||
</Button>
|
||||
</Input.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={intl.get('Python 软件包镜像源')} name="python">
|
||||
<Input.Group compact>
|
||||
<Input
|
||||
style={{ width: 330 }}
|
||||
placeholder={intl.get('PyPI 镜像源')}
|
||||
value={systemConfig?.pythonMirror}
|
||||
onChange={(e) => {
|
||||
setSystemConfig({
|
||||
...systemConfig,
|
||||
pythonMirror: e.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={updateSystemConfig}
|
||||
style={{ width: 84 }}
|
||||
>
|
||||
{intl.get('确认')}
|
||||
</Button>
|
||||
</Input.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label={intl.get('Linux 软件包镜像源')} name="linux">
|
||||
<Input.Group compact>
|
||||
<Input
|
||||
style={{ width: 330 }}
|
||||
placeholder={intl.get('alpine linux 镜像源')}
|
||||
value={systemConfig?.linuxMirror}
|
||||
onChange={(e) => {
|
||||
setSystemConfig({ ...systemConfig, linuxMirror: e.target.value });
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={updateSystemConfig}
|
||||
style={{ width: 84 }}
|
||||
>
|
||||
{intl.get('确认')}
|
||||
</Button>
|
||||
</Input.Group>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dependence;
|
||||
@@ -34,6 +34,7 @@ import { SharedContext } from '@/layouts';
|
||||
import './index.less';
|
||||
import useResizeObserver from '@react-hook/resize-observer';
|
||||
import SystemLog from './systemLog';
|
||||
import Dependence from './dependence';
|
||||
|
||||
const { Text } = Typography;
|
||||
const isDemoEnv = window.__ENV__DeployEnv === 'demo';
|
||||
@@ -354,6 +355,11 @@ const Setting = () => {
|
||||
label: intl.get('登录日志'),
|
||||
children: <LoginLog data={loginLogData} />,
|
||||
},
|
||||
{
|
||||
key: 'dependence',
|
||||
label: intl.get('依赖设置'),
|
||||
children: <Dependence />
|
||||
},
|
||||
{
|
||||
key: 'other',
|
||||
label: intl.get('其他设置'),
|
||||
|
||||
Reference in New Issue
Block a user