ssh-net 26.10.61 → 26.10.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/libexec/lib/render.mjs +9 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
跨月从 1 开始;历史跳号不补、不另维护累计发包数。发布 = 改版本号 +
|
|
5
5
|
CHANGELOG + 发 GitHub Release,Actions 跑测试后 npm publish。
|
|
6
6
|
|
|
7
|
+
## [26.10.62] - 2026-10-25
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- Match exec 不再内嵌 OpenSSH 9.x 无法解析的转义双引号:路径改用 `~` 展开,
|
|
12
|
+
VS Code 判空改用 shell `case`,修复 26.10.61 在 node 安装后导致 ssh 报
|
|
13
|
+
Bad Match condition;HOME 含空白的行为保留,routes 语义测试覆盖 Darwin/Linux
|
|
14
|
+
|
|
7
15
|
## [26.10.61] - 2026-10-25
|
|
8
16
|
|
|
9
17
|
### 修复
|
package/libexec/lib/render.mjs
CHANGED
|
@@ -91,14 +91,9 @@ const ROUTES_HEADER = `# 本文件由 \`ssh-net install\` 从 ~/.ssh/ssh-net/top
|
|
|
91
91
|
# 入站,只有 relay 兜底。User 不写——由主 config 的 Host 块补。
|
|
92
92
|
`;
|
|
93
93
|
|
|
94
|
-
// Match exec
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
/** @param {string|number} value */
|
|
98
|
-
function shellWord(value) {
|
|
99
|
-
return `"${String(value).replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
|
100
|
-
}
|
|
101
|
-
|
|
94
|
+
// Match exec 只保留 ssh_config 的外层双引号:OpenSSH 9.x 不能解析内嵌
|
|
95
|
+
// 转义双引号。路径用 ~ 让 shell 展开(结果不受 HOME 空白分词影响),topology
|
|
96
|
+
// 已拒绝 argv 的空白与 shell 元字符;VS Code 判空用 case,不在此层做 shell 引号
|
|
102
97
|
/** @param {string} pattern @param {string} command */
|
|
103
98
|
function matchExec(pattern, command) {
|
|
104
99
|
const escaped = command.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
|
|
@@ -128,16 +123,16 @@ export function snRouteArgv(topo, selfAlias) {
|
|
|
128
123
|
* @returns {string}
|
|
129
124
|
*/
|
|
130
125
|
export function renderRoutes(topo, selfAlias) {
|
|
131
|
-
const state =
|
|
132
|
-
const snRoute =
|
|
126
|
+
const state = `~/${SSH_NET_DIR_REL}/state`;
|
|
127
|
+
const snRoute = `~/${SSH_NET_DIR_REL}/bin/sn-route`;
|
|
133
128
|
/** @type {string[]} */
|
|
134
129
|
const blocks = [];
|
|
135
130
|
|
|
136
131
|
// sn-route argv 直接渲染进 Match(无配置文件中转)。进度只进 stderr 且
|
|
137
132
|
// 仅终端显示(VS Code/Remote-SSH、scp、脚本下自动静默)
|
|
138
|
-
const routeCommand = [snRoute, ...snRouteArgv(topo, selfAlias)].
|
|
133
|
+
const routeCommand = [snRoute, ...snRouteArgv(topo, selfAlias)].join(' ');
|
|
139
134
|
const match = (alias, cond = '') =>
|
|
140
|
-
matchExec(alias, `test -e ${
|
|
135
|
+
matchExec(alias, `test -e ${state}/RELAY_ON${cond}`);
|
|
141
136
|
// core 判决块与兜底块共用一个发射器:first-wins 逐 keyword 取首值,
|
|
142
137
|
// 「块命中」不是整体替换——判决块必须占住兜底块设的每一个 keyword
|
|
143
138
|
// (ProxyJump none 不是装饰,漏了后块的 ProxyJump 就漏进直连路径,
|
|
@@ -187,7 +182,7 @@ export function renderRoutes(topo, selfAlias) {
|
|
|
187
182
|
const peers = peerList.join(',');
|
|
188
183
|
const nonPeers = `*,${peerList.map((a) => `!${a}`).join(',')}`;
|
|
189
184
|
const vscode = (pattern) =>
|
|
190
|
-
matchExec(pattern,
|
|
185
|
+
matchExec(pattern, 'case ${VSCODE_IPC_HOOK:-} in ?*) true;; *) false;; esac');
|
|
191
186
|
blocks.push([
|
|
192
187
|
'# 连接打标:对端 ~/.ssh/rc 读 LC_VSCODE_SSH 维护 dot.via、把本机别名交给 sn-register-lan 登记内网地址',
|
|
193
188
|
vscode(peers),
|
|
@@ -221,7 +216,7 @@ export function renderEdgeHost({ alias, aliases, user }) {
|
|
|
221
216
|
const addr = edgeAddrFileRel(alias);
|
|
222
217
|
const freshnessGate = matchExec(
|
|
223
218
|
aliases.join(','),
|
|
224
|
-
`find
|
|
219
|
+
`find ~/${addr} -mmin -${EDGE_ADDR_TTL_MIN} 2>/dev/null | read -r _`,
|
|
225
220
|
);
|
|
226
221
|
// 门控管道用内建 read 收尾而不是 grep -q:Match exec 每条连接都跑,少 fork
|
|
227
222
|
// 一个外部进程(find 有输出 read 退出 0、EOF 退出 1,三态与 grep -q 等价)
|