订阅增加代理参数

This commit is contained in:
whyour 2022-11-13 23:58:42 +08:00
parent 5ee00e52a8
commit 0a6166c557
5 changed files with 25 additions and 3 deletions

View File

@ -49,6 +49,7 @@ export default (app: Router) => {
sub_after: Joi.string().optional().allow('').allow(null),
schedule_type: Joi.string().required(),
alias: Joi.string().required(),
proxy: Joi.string().optional().allow('').allow(null),
}),
}),
async (req: Request, res: Response, next: NextFunction) => {
@ -177,6 +178,7 @@ export default (app: Router) => {
sub_before: Joi.string().optional().allow('').allow(null),
sub_after: Joi.string().optional().allow('').allow(null),
alias: Joi.string().required(),
proxy: Joi.string().optional().allow('').allow(null),
id: Joi.number().required(),
}),
}),

View File

@ -43,7 +43,13 @@ export default class SshKeyService {
host: string,
proxy?: string,
): string {
return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no\n`;
if (host === 'github.com' && proxy) {
host = 'ssh.github.com';
}
const proxyStr = proxy
? ` Port 443\n HostkeyAlgorithms +ssh-rsa\n PubkeyAcceptedAlgorithms +ssh-rsa\n ProxyCommand nc -v -x ${proxy} %h %p\n`
: '';
return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no\n${proxyStr}`;
}
private generateSshConfig(configs: string[]) {

View File

@ -16,7 +16,7 @@ DefaultCronRule=""
## ql repo命令拉取脚本时需要拉取的文件后缀直接写文件后缀名即可
RepoFileExtensions="js py"
## 代理地址,支持http/https/socks,例如 http://127.0.0.1:7890
## 代理地址,支持HTTP/SOCK5,例如 http://127.0.0.1:7890
ProxyUrl=""
## 资源告警阙值默认CPU 80%、内存80%、磁盘90%

View File

@ -253,10 +253,11 @@ textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
border: none;
box-shadow: none;
transition: background-color 5000s ease-in-out 0s;
-webkit-text-fill-color: @text-color;
caret-color: @text-color;
color: @text-color;
}
::placeholder {

View File

@ -439,6 +439,19 @@ const SubscriptionModal = ({
</Form.Item>
</>
)}
<Form.Item
name="proxy"
label="代理"
tooltip="公开仓库支持HTTP/SOCK5代理私有仓库支持SOCK5代理"
>
<Input
placeholder={
type === 'private-repo'
? 'SOCK5代理例如 IP:PORT'
: 'HTTP/SOCK5代理例如 http://127.0.0.1:1080'
}
/>
</Form.Item>
</Form>
</Modal>
);