修改订阅github ssh生成逻辑

This commit is contained in:
whyour 2022-11-14 22:00:16 +08:00
parent 707709837d
commit 91dbb7770d

View File

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