update ssh.ts
This commit is contained in:
@@ -202,12 +202,12 @@
|
||||
},
|
||||
"ssh.ts": {
|
||||
"script_name": "ssh.ts",
|
||||
"script_length": 6806,
|
||||
"script_sha256": "1d0e457f1247ba1524a6e11d99bbc79e26d94783bbaf51de0aa9e38f0b3d3985",
|
||||
"script_length": 6813,
|
||||
"script_sha256": "d65f2335b82fc5f5376f1df34057d9feae12fe5f74dbfb572ce18f9a089b3a3a",
|
||||
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/ssh.ts",
|
||||
"single_script_file": true,
|
||||
"publish_time": 1768111677531,
|
||||
"update_time": 1769318306584
|
||||
"update_time": 1769359601445
|
||||
},
|
||||
"wget.ts": {
|
||||
"script_name": "wget.ts",
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
// reference: https://git.hatter.ink/rust-scripts/scriptbase/src/branch/main/ssh-rs/src/main.rs
|
||||
|
||||
import {spawn} from "node:child_process";
|
||||
import {parseArgs} from "node:util";
|
||||
import { spawn } from "node:child_process";
|
||||
import { parseArgs } from "node:util";
|
||||
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
@@ -26,7 +26,7 @@ interface SshConfig {
|
||||
default_forward_agent?: boolean;
|
||||
default_proxy?: boolean;
|
||||
default_username?: string;
|
||||
profiles: Map<string, SshProfile>;
|
||||
profiles: Record<string, SshProfile>;
|
||||
}
|
||||
|
||||
interface SshProfile {
|
||||
@@ -100,11 +100,11 @@ function loadSshConfig(): SshConfig {
|
||||
const sshConfigText = fs.readFileSync(configFile, "utf8");
|
||||
return JSON5.parse(sshConfigText);
|
||||
} catch (e) {
|
||||
console.error(`Load config file: ${configFile} failed.`, e);
|
||||
throw `Load config file: ${configFile} failed: ${e}`;
|
||||
}
|
||||
}
|
||||
|
||||
function matchProfile(sshConfig: SshConfig, host: string): SshProfile {
|
||||
function matchProfile(sshConfig: SshConfig, host: string): SshProfile | null {
|
||||
let profiles = [];
|
||||
for (const k in sshConfig.profiles) {
|
||||
const sshProfile = sshConfig.profiles[k];
|
||||
@@ -212,5 +212,5 @@ async function main() {
|
||||
}
|
||||
await main();
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T102036+08:00.MEUCIQCn1lxyOA9IK2wnLoXD
|
||||
// 6OjOe3m+V1ZZIwc461wTqQKmsgIgDdRvAsi2Dxvrk1bKXelGeboeO1J3aRdEB/FMPqsXS8Q=
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260126T004612+08:00.MEQCIFxHjeu7+pkPpSWVoCTb
|
||||
// BbzbHhc+dsAG6vqx+i0H8MqLAiAYcK0dcCVECG1je0Q/ZCIYohHCNrvDIOr3kiNj7XWoXg==
|
||||
|
||||
Reference in New Issue
Block a user