mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
4db44e2ede1996cd52f48c422fd78a34322f0d13
19
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
00c4095e59 |
feat: global default proxy with explicit direct override (#3774)
* feat: add a global default proxy with an explicit direct override Resolve the proxy as the host setting, then the nearest group default, then one optional saved profile from synced settings, then a direct connection. A host can choose direct and skip both inherited defaults. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep global default proxy persistence across settings instances Unregister only the setter owned by the unmounting useSettingsState instance so closing Settings still writes the cleared default through the remaining AppLockGate setter. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: round-trip explicit direct mode in vault CSV Write the Proxy cell as direct when a host sets directProxy, and import that literal back as an explicit direct connection. An empty Proxy cell still inherits. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep CSV proxy export from embedding the global default Grouped hosts ran through applyGroupDefaults and picked up the ambient global proxy, while ungrouped hosts exported an empty inheriting cell. Both paths now opt out of that default so inheritance stays inheritance. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: follow global default proxy changes in peer session windows Session windows disable settings IPC sync, which also skipped the storage listener and left the resolver singleton at its mount-time id. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * refactor: clear a deleted global default proxy at the call site Drop the pass-through field on removeProxyProfileReferences. The profile manager already knows the active id and clears it directly. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * test: share the global default proxy settings harness The peer-window case and the multi-instance cleanup case were mounting the same JSDOM fixture twice. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> |
||
|
|
aebe9944ed |
feat: inherit X11 forwarding from group defaults (#3777)
* feat: inherit X11 forwarding from group defaults Hosts that leave the toggle unset pick up the nearest group's X11 forwarding setting through applyGroupDefaults. An explicit host value still wins, and the default stays off. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: show inherited X11 from the effective host transport The host editor treated a raw group X11 default as on even when applyGroupDefaults suppresses that inheritance for Mosh, ET, or a non-SSH protocol. Drive the switch and its visibility from that result. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> |
||
|
|
6c2bf43ee5 |
fix(vault): let local shell (CMD) sessions be saved into groups (#3616)
Related to #3615 (stays open: hiding/restoring running sessions is separate work). Merged by judgment after ~49 Codex findings; remaining P2 (Copy Tab name/icon snapshot when host shell is edited after launch) is a cosmetic edge case for a follow-up. |
||
|
|
9423a1d1cd |
fix(ssh): drop the manual single-channel SSH toggle (#3561)
* fix(ssh): 去掉单通道 SSH 的手动开关 单通道只在握手后匹配 BHostSSH、TERM-SSHD、CLOUDBILITY 时生效。 主机和分组不再保存这个选项,读到旧字段时直接丢掉。 * test(sftp): 对齐单通道登录后的重连扫描 专用 SFTP 登录改为 reuseTerminalTransport 之后,旧的 sourceSessionId 三元表达式扫描不再匹配,lint-and-test 因此失败。扫描改为锁定当前门槛:已连接,或已经钉住严格来源,才复用终端传输。 |
||
|
|
9082aa08a4 |
fix(serial): auto-login on serial consoles with saved host credentials (#3418)
* fix(#3417): automated AI fix * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: address Codex review on PR #3418 * fix: guard serial quick login and reconnect startup commands * fix: preserve serial startup while tabs sleep --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> |
||
|
|
3e17cdd62e | feat: add Markdown notes to host groups | ||
|
|
6782f70f84 | Align MCP host updates with vault rules | ||
|
|
bd098a45fb | fix(ssh): preserve explicit fallback behavior | ||
|
|
8ef487eece | fix(ssh): preserve inferred legacy authentication | ||
|
|
d05b65d570 | fix(ssh): preserve inherited legacy passwords | ||
|
|
8abbd36baf |
Improve group SSH and Telnet defaults (#2124)
* Improve group connection defaults * Honor credential inheritance overrides * Preserve default identity inheritance * Handle missing group identities * Clear inherited credential bundles * Reset cleared group identities * Align group credential display * Allow group identity with host username * Preserve group credential overrides * Preserve custom host credentials |
||
|
|
6400ce1e75 |
fix(terminal): detach stale keychain identity when saving retry credentials (#1970)
* fix(terminal): detach stale keychain identity when saving retry credentials When a host references a Keychain identity (host.identityId) with wrong credentials, re-entering credentials via the auth-retry dialog's "Continue & Save" saved them onto the host but kept the identity reference. On reconnect, resolveHostAuth prefers identity credentials over host fields, so the stale keychain credentials kept failing. Clear identityId when the user explicitly saves new credentials so the saved username/password (or key) actually takes effect. Fixes #1956 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(terminal): keep saved retry credentials over group-inherited identity Writing identityId: undefined is treated as "unset" by applyGroupDefaults, so a group-level identity would be re-inherited on reconnect and shadow the credentials saved from the auth-retry dialog. Store an empty string instead and register identityId in EMPTY_STRING_OVERRIDES_GROUP_DEFAULT so the explicit "no identity" override sticks. All consumers check identityId truthiness, so "" behaves as "no identity". Addresses Codex review on #1970. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
0b94a82579 | Fix multiline snippet execution modes | ||
|
|
e64df373a7 |
Add group device type inheritance (#1708)
* Add group device type inheritance * Sync package lock for CI * Persist group device type setting * Fix group device type inheritance controls * Fix device type inheritance with shell transports * Use resolved hosts for AI executor context * Reduce device type inheritance diff scope --------- Co-authored-by: mam15mon <mam15mon@gmail.com> |
||
|
|
7272f2564d |
fix(ssh): per-host skipEcdsaHostKey toggle + advanced algorithm overrides (#1027) (#1116)
* fix(ssh): per-host skipEcdsaHostKey toggle + advanced algorithm overrides (#1027) #1027 reported an old Huawei S7706 (SSH banner `SSH-2.0--`, empty software-version field) where the legacy-algorithms toggle still couldn't get a connection through. The debug log shows the handshake makes it through every negotiation step, picks `ecdsa-sha2-nistp521` for the host key, then dies at: Handshake failed: signature verification failed i.e. ssh2's strict RFC verifier rejects the ECDSA signature the switch produces. OpenSSH on the same machine connects because its known_hosts is already pinned to an RSA fingerprint, so it never advertises ECDSA in the first place. This adds two layers of escape hatch: A. `host.skipEcdsaHostKey` (one-click) — drops every `ecdsa-sha2-*` from the offered host-key list. Forces the fallback to ssh-rsa / ssh-dss / ssh-ed25519 that those old stacks implement correctly. Wired through ssh / sftp / port-forwarding bridges, inheritable from the group default. B. `host.algorithms` (advanced) — per-category override lists (`kex`, `cipher`, `hmac`, `serverHostKey`, `compress`). When a category's array is non-empty, it fully replaces the negotiated list for that category. Exposed in a collapsible "Advanced algorithm overrides" panel on both host and group settings, inspired by Tabby's per-profile algorithm UI. Empty arrays normalize to "use default" so picking zero algorithms in a category doesn't bench the connection with "no matching algorithm". Overrides apply BEFORE `skipEcdsaHostKey` so the latter stays an unconditional kill switch even if the user explicitly puts `ecdsa-*` back into the host-key list. Behavior with default values (neither toggle set, no override list) is identical to before — zero change for hosts that aren't opted in. Tests cover the new options on both `buildAlgorithms` and `buildSftpAlgorithms`, plus group→host inheritance for both fields. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ssh): address Codex review on #1116 — proper seed + jump-host carry + missing call sites Four review findings from the Codex pass on #1116, all real: 1. AlgorithmOverridesPanel was seeding the first customization in a category from `SUPPORTED_ALGORITHMS_BY_CATEGORY`, which contains legacy algorithms (CBC, arcfour, MD5, ssh-dss, group1-sha1...). Unchecking a single modern algorithm in a host that had legacy mode *off* would silently start offering those legacy algorithms. Now seeds from `effectiveDefaultAlgorithms(legacyEnabled)`, mirroring what `buildAlgorithms` actually emits at connect time. - New `effectiveDefaultAlgorithms` pure helper in `domain/sshAlgorithmList.ts` with its own test suite (also asserts the modern subset contains no SHA-1 KEX / CBC / arcfour / MD5) - `AlgorithmOverridesPanel` takes a `legacyEnabled` prop - `isChecked` now reflects the effective-default state for an untouched category, so unchecked rows visually represent algorithms the connection wouldn't currently advertise 2. The chain-mode jump-host loop in `sshBridge.cjs` was applying the target host's `skipEcdsaHostKey` / `algorithmOverrides` to every bastion hop, which is wrong when the bastion has its own settings. This was actually a pre-existing issue with `legacyAlgorithms` too — `NetcattyJumpHost` simply didn't carry any of these fields. - `NetcattyJumpHost` gains `legacyAlgorithms`, `skipEcdsaHostKey`, `algorithmOverrides` - `createTerminalSessionStarters` populates them from each jump host's own configuration - The jump-host bridge call now reads `jump.* ?? options.*` so a hop with its own setting wins, but unset hops still fall back to the target's settings (preserves historic chain-wide behavior when nothing is overridden) 3. `infrastructure/services/portForwardingService.ts` only forwarded `legacyAlgorithms` to the port-forwarding bridge, so a host that needed the ECDSA skip or advanced overrides could connect through the terminal but its auto-start tunnels would still hit the original handshake failure. - Forward `skipEcdsaHostKey` and `algorithmOverrides` at the target call site and at the jump-host map. 4. `application/state/sftp/useSftpHostCredentials.ts` built `NetcattySSHOptions` for `openSftp` without any of the algorithm fields — and on inspection it didn't even forward `legacyAlgorithms` to begin with, so SFTP panes for legacy-mode hosts were silently negotiating with the modern default list. Same gap at the jump-host map. - Forward all three fields at both the target and the jump-host map. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * polish(hosts): make the advanced-algorithm collapsible trigger a real button The first cut used a plain underlined caption for the "Advanced algorithm overrides" collapsible trigger. That blends into the surrounding helper text and doesn't read as an interactive control — users couldn't tell that the per-category checkbox editor was reachable at all. Match the project's existing collapsible-trigger pattern (see `SerialConnectModal`): full-width ghost Button, label on the left, ChevronDown / ChevronUp on the right that flips with open state, controlled via `useState`. Applied in both `HostDetailsPanel` and `GroupDetailsPanel`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * polish(hosts): rename Legacy Algorithms card to SSH Algorithms; split Backspace into its own section The card now carries three algorithm controls (Allow Legacy / Skip ECDSA / Advanced overrides) plus a Backspace Behavior dropdown that doesn't belong with the rest. Two cleanups: 1. Rename the card from "Legacy Algorithms" to "SSH Algorithms". The original title only described the first toggle; the section now covers the whole algorithm-negotiation surface, including the ECDSA host-key skip and the per-category override editor. - i18n key renamed `hostDetails.section.legacyAlgorithms` -> `hostDetails.section.sshAlgorithms` in zh-CN / en / ru - `HostDetailsPanel` references the new key 2. Move the Backspace Behavior control out of the algorithm card. - `HostDetailsPanel`: new dedicated "Terminal Behavior" card (TerminalSquare icon) placed between SSH Algorithms and Keepalive. New i18n key `hostDetails.section.terminalBehavior`. - `GroupDetailsPanel`: no separate Card scaffolding for group defaults — moved Backspace to the bottom of the SSH section (after Mosh) so it visually separates from the algorithm block above without introducing a new card heading. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(sftp): per-hop algorithm settings in SFTP chain (Codex review on #1116) `sshBridge.cjs`'s jump loop already reads `jump.* ?? options.*` for the three algorithm fields, but `sftpBridge.cjs#connectThroughChainForSftp` was missed in that change and still applied the target host's `options.legacyAlgorithms` / `skipEcdsaHostKey` / `algorithmOverrides` to every bastion. A bastion that needed the ECDSA skip or a custom algorithm list while the target didn't would still fail the SFTP handshake before reaching the target. Mirror the sshBridge fix: read each setting from the jump host first, falling back to the target options when the hop didn't override. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ssh): keychain SSH exec + advanced editor seed honor inherited algorithm settings Two findings from a local Codex review pass on the branch: 1. The keychain "export public key to host" flow opens its own one-off SSH connection through `sshBridge#execCommand`, but the connectOpts built there didn't include any `algorithms`. ssh2 then negotiated with its built-in modern defaults regardless of what the host had set, so a host that needs the ECDSA skip (or legacy mode) would connect in the terminal but the keychain export would fail with the original signature-verification error. - `sshBridge.cjs#execCommand` now sets `algorithms` from `payload.legacyAlgorithms` / `skipEcdsaHostKey` / `algorithmOverrides`, mirroring `startSSHSession`. - `useKeychainBackend`'s `execCommand` typing gets the three new optional fields. - `KeychainManager` forwards the host's `legacyAlgorithms`, `skipEcdsaHostKey`, and `algorithms` when invoking the export. 2. The Advanced Algorithm Overrides editor seeded its first customization from `form.legacyAlgorithms`, which is the host's own field — it doesn't reflect a value the host *inherits* from its group's default. A user in a group with `legacyAlgorithms=true` editing a host that hadn't explicitly set the flag would see the editor seed in modern-only mode, and saving could silently drop the legacy algorithms the host actually needed. - `HostDetailsPanel` passes `form.legacyAlgorithms ?? groupDefaults?.legacyAlgorithms`. - `GroupDetailsPanel` adds an `inheritedLegacyAlgorithms` memo resolved from the parent group chain via `resolveGroupDefaults`, and the editor uses `form.legacyAlgorithms ?? inheritedLegacyAlgorithms`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(keychain): export-public-key honors group-inherited algorithm settings Second-pass Codex review on PR #1116 flagged that the keychain "export public key to host" flow now carries the three algorithm fields end-to-end, but only reads them from `exportHost.*` directly — which doesn't reflect values the host inherits from its group's defaults. A host that left `legacyAlgorithms` / `skipEcdsaHostKey` / `algorithms` unset but sat inside a group that turned them on would work fine in the terminal (the terminal starter applies group defaults before sending the IPC payload) but its keychain export would silently fall back to ssh2's modern defaults and hit the original signature-verification failure. Resolve the effective host with `applyGroupDefaults` + `resolveGroupDefaults` before the `execCommand` call, then read the algorithm fields off the effective host. Requires plumbing `groupConfigs` into `KeychainManager` (added as an optional prop, forwarded by `VaultView`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(host-details): algorithm-overrides editor reads currently selected group's defaults Third-pass Codex review caught that the editor seed was reading from the `groupDefaults` prop, which is whatever group the host belonged to when the panel opened. If a user switched the host into a different group inside the panel and then opened the Advanced Algorithm Overrides collapsible before saving, the editor would seed from the old group's `legacyAlgorithms` flag and could save the wrong list. The panel already memoizes `effectiveGroupDefaults` from `form.group`/`defaultGroup`/`groupConfigs` for exactly this kind of re-resolution (used by theme/font effective lookups). Read the inherited flag from there instead of the stale prop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(algorithms): trim UI cipher list to algorithms ssh2 actually supports Fourth-pass Codex review flagged that `SUPPORTED_CIPHER_ALGORITHMS` included `blowfish-cbc`, `cast128-cbc`, and the `arcfour*` family, but OpenSSL 3 disabled those primitives, so ssh2's `canUseCipher` filter drops them from `SUPPORTED_CIPHER` at startup. Selecting any of them in the Advanced Algorithm Overrides editor would make `ssh2.Client.connect()` throw `Unsupported algorithm` synchronously, turning the override into a "host now unreachable" footgun instead of a narrowing knob. Realigned each `SUPPORTED_*_ALGORITHMS` list to ssh2's actual `SUPPORTED_*` constants: - `SUPPORTED_CIPHER_ALGORITHMS`: dropped blowfish / cast128 / arcfour; added the no-suffix `aes128-gcm` / `aes256-gcm` variants ssh2 also accepts. - `SUPPORTED_KEX_ALGORITHMS`: added `diffie-hellman-group15-sha512` and `diffie-hellman-group17-sha512` (present in ssh2 but missing from the UI list); reordered to ssh2's canonical order. - `SUPPORTED_HMAC_ALGORITHMS`: reordered so the ETM/SHA-2 grouping matches ssh2's `DEFAULT_MAC` and lookups are predictable. Locked the invariant in `sshAlgorithmList.test.ts` with a new test that asserts every UI-offered algorithm is a member of ssh2's `SUPPORTED_*` for its category. A future ssh2 bump that drops an algorithm we still expose will fail this test instead of silently becoming a connect-time error for users. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(algorithms): run KEX override through the runtime fixed-DH filter Codex round-N flagged a gap in `applyAlgorithmOverrides`: when the user supplies a custom KEX list via the advanced editor, the previous implementation copied it verbatim into the negotiated `algorithms.kex` field. The default builder already passes its KEX list through `filterSupportedFixedDhKex` to drop fixed-DH groups the runtime doesn't support (notably `diffie-hellman-group1-sha1` on Electron/BoringSSL, which lacks modp2), but the override path bypassed that filter — so an Electron user enabling legacy mode and saving any KEX checkbox state would re-advertise group1-sha1 and the handshake would crash with "Unknown DH group" instead of failing fast. Apply the same `filterSupportedFixedDhKex` to the override list. New test in `sshAlgorithms.test.cjs` exercises a simulated BoringSSL runtime that lacks modp2 and asserts the override-filtered KEX no longer includes group1-sha1, while group14-sha1 / group-exchange-sha1 remain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(algorithms): run HMAC override through the FIPS MD5 filter Codex flagged the same runtime-bypass pattern Round-N-1 fixed for KEX, now in HMAC: `applyLegacyHmacAlgorithms` gates `hmac-md5` behind `md5Supported()` so FIPS Node builds don't get it, but the UI's `effectiveDefaultAlgorithms(true)` seed adds `hmac-md5` / `hmac-md5-96` unconditionally. A user with legacy mode on who saves any HMAC checkbox change would push those MD5 entries through `applyAlgorithmOverrides`, which previously copied the override verbatim — bypassing the FIPS gate and making ssh2 throw "Unsupported algorithm" before negotiation. New `filterRuntimeUnsupportedHmac` helper applies the same `md5Supported()` gate to a user override. `applyAlgorithmOverrides` routes the HMAC override through it (mirrors how the same function already routes KEX overrides through `filterSupportedFixedDhKex`). New test simulates a FIPS-disabled MD5 runtime and asserts MD5 variants drop from the final HMAC list while SHA-1 / SHA-2 entries remain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ssh): jump-host overrides no longer inherit the leaf's algorithm overrides Codex flagged that the jump-loop fallback I added for chain convenience applied the target's per-host \`algorithmOverrides\` to every bastion whose own override wasn't set, which is wrong: a target restricted to e.g. \`serverHostKey: [\"ssh-rsa\"]\` would lock the hop to ssh-rsa too and break negotiation against an Ed25519-only bastion. The fallback IS still correct for \`legacyAlgorithms\` and \`skipEcdsaHostKey\` — those are append/safety toggles that widen the offered list, so propagating them to a bastion is safe and matches the historic chain-wide behavior of \`options.legacyAlgorithms\` (single-toggle convenience for a chain with one old leaf). Treat \`algorithmOverrides\` strictly per-host instead. Same change in both \`sshBridge.cjs\` and \`sftpBridge.cjs\` jump loops, with a comment block explaining the asymmetry so a future refactor doesn't "clean up" the distinction. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ui(host-details): surface inherited algorithm overrides in the advanced editor Codex flagged a real gap in the inheritance model: when a parent group has set algorithm overrides (e.g. \`algorithms.kex: [...]\`), a host or child group under it can't simply Reset a category back to NetCatty's defaults — \`applyGroupDefaults\` treats an unset host field as "inherit", so the local Reset falls back to the group's list rather than to ssh2's defaults. Cleanly distinguishing "reset to NetCatty defaults" from "inherit from group" needs a new schema field or sentinel, which is a non-trivial design change well beyond the scope of this PR. For now, surface the situation in the UI so the user understands why Reset doesn't behave the way they might expect and where to go to actually clear the restriction: - \`AlgorithmOverridesPanel\` accepts an optional \`inheritedFromGroup\` prop and, when populated, renders a blue inline notice listing the inherited categories and directing the user to the group's algorithm settings if they need to opt out. - \`HostDetailsPanel\` passes \`effectiveGroupDefaults?.algorithms\`. - \`GroupDetailsPanel\` adds a new \`inheritedAlgorithmOverrides\` memo that resolves the same way the existing \`inheritedLegacyAlgorithms\` does, and forwards it. - i18n strings added in zh-CN / en / ru. Follow-up (out of scope for this PR): if real users do hit this, introduce a \`host.algorithms = null\` (or explicit \`algorithmsOverride: boolean\`) sentinel and a Reset-to-defaults button that uses it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ssh): jump-host skipEcdsaHostKey is per-host; panel seeds from inherited overrides Three findings from the latest Codex pass: 1 & 2. `skipEcdsaHostKey` on the leaf was still falling back onto jump hosts in both `sshBridge.cjs` and `sftpBridge.cjs`. I had classified it with `legacyAlgorithms` as a "safety widening" knob, but Codex is right that it actually *narrows* the offered host-key list by dropping every `ecdsa-sha2-*`. An ECDSA-only bastion (or one where the operator pinned ECDSA via known_hosts) would still negotiate when ECDSA is offered, but fails when the leaf's skip is propagated to it. Same fix as `algorithmOverrides` last round: strictly per-host. Only `legacyAlgorithms` keeps the chain-wide fallback (append-only — it widens the offer, can never break a hop that wasn't already failing). 3. `AlgorithmOverridesPanel` was seeding the first customization of a category from the NetCatty/legacy effective default, ignoring any list the host inherits from its group for OTHER categories. Because `applyGroupDefaults` treats `host.algorithms` as an all-or-nothing inherit boundary, the moment the user saved any host-local override `{ cipher: [...] }`, the group's `{ serverHostKey: ["ssh-rsa"] }` restriction silently dropped from the effective host. Now: - `toggleAlgorithm`'s first-click seed reads `inheritedFromGroup?.[category] ?? effectiveDefault[category]`, so customizing one category preserves the group's narrowing on the others. - `updateCategory` initializes `next` from `{ ...inheritedFromGroup, ...value }` so saved overrides carry the inherited categories alongside the host's own edits. - `isChecked` reflects the inherited list when there's no local value, so the visible checkbox state matches what would actually be advertised. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(host-details): Reset preserves the inherited list instead of silently widening Codex caught a follow-on bug from the previous "carry inheritance" fix: pressing Reset on a category that's inherited from the group deleted that category from \`host.algorithms\` while other host-local or carried-inherited categories remained. Because \`applyGroupDefaults\` treats \`host.algorithms\` as all-or-nothing, the moment any host-local entry exists the group's \`algorithms\` object stops being inherited as a whole — so the freshly-deleted category fell back to NetCatty defaults rather than the group's narrower list. Effective result: Reset on an inherited category *widened* the offer instead of restoring it. Reset now persists the inherited list verbatim onto the host when the group has an override for that category, so "Reset" means "use what this host would otherwise inherit" in all cases. Also tightened \`isCustomized\` to suppress the "customized" badge (and the per-category Reset button) when the host's stored list is identical to the inherited list — those rows haven't really been customized by the user. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ui(host-details): gate the inherited-notice / checkbox baseline on no host override Codex caught the asymmetry between the read and write sides of the panel. The write side (`updateCategory`, `toggleAlgorithm`, Reset) intentionally carries `inheritedFromGroup` onto the host on the first edit so the runtime's all-or-nothing inherit boundary in `applyGroupDefaults` doesn't silently widen the offer. But the read side (the inherited-notice banner and the `isChecked` baseline for unfilled categories) was applying inherited values *unconditionally* — including when the host already had any local `algorithms` object, which makes `applyGroupDefaults` stop inheriting from the group as a whole. Net effect on a host that only locally overrode `cipher`: the UI claimed the group's `serverHostKey` restriction was still in effect, while the runtime would actually use NetCatty's modern defaults for that category. Introduce `inheritedForDisplay`, defined as `value === undefined ? inheritedFromGroup : undefined`, and route the notice + the `isChecked` baseline through it. The write side keeps consulting the unconditional `inheritedFromGroup` so the carry-over still happens on first edit — that part is what makes the runtime behavior match what the UI used to advertise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ui(host-details): legacy/skipEcdsa toggles reflect group-inherited value Codex caught that the Skip ECDSA toggle in both the host and group panels read `form.skipEcdsaHostKey` directly, so a host whose group turned the flag on (and `applyGroupDefaults` therefore applied it to the runtime SSH negotiation) still saw the toggle rendered as off. Worse, clicking it computed `!form.skipEcdsaHostKey` — which is `!undefined` = `true` — so the first click could not actually disable the inherited setting on a per-host basis; it would just store `true` explicitly, the same effective state. The Allow Legacy Algorithms toggle had the same pre-existing issue. Fix both at once: each toggle now derives its enabled state from `form.<field> ?? <inherited>` and the onToggle handler flips that same effective value, so the toggle accurately represents what the runtime would do and a single click off correctly stores `false` (which `applyGroupDefaults` then leaves alone, breaking inheritance for this host). - `HostDetailsPanel` reads from `effectiveGroupDefaults`. - `GroupDetailsPanel` adds an `inheritedSkipEcdsaHostKey` memo alongside the existing `inheritedLegacyAlgorithms` and uses both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
92dd898eb4 |
Fix #931: let users pick a CJK font + per-font smart pairing (#940)
* feat(fonts): add CJK font pairing composition module Introduces composeFontFamilyStack() which builds the xterm fontFamily CSS string at runtime from: - the user's primary Latin font - an explicit CJK font (TerminalSettings.fallbackFont) if set - otherwise a per-Latin-font recommended CJK pairing - a hardcoded system CJK fallback stack - a Nerd Font icon fallback stack - the universal monospace generic 14 unit tests cover composition order, deduplication, OS defaults, quoting, and recommendation override behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(fonts): expose raw Latin families and add CJK-coverage entries - TERMINAL_FONTS[].family no longer bakes in the CJK fallback stack; composition is deferred to runtime via composeFontFamilyStack(). - Drops withCjkFallback helper from this module and its caller in lib/localFonts.ts. - Adds 6 CJK-coverage primary fonts to the dropdown: Sarasa Mono SC/TC, Maple Mono CN, LXGW WenKai Mono, Microsoft YaHei UI, PingFang SC. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(terminal): compose font-family stack with user-configurable CJK fallback resolvedFontFamily now passes through composeFontFamilyStack(), which prepends the user's TerminalSettings.fallbackFont (if set) ahead of the per-Latin-font recommended CJK pairing and the system fallback stack. The platform argument is derived from navigator.platform inside the useMemo, so the same Latin font may pair with PingFang SC on macOS and Microsoft YaHei UI on Windows out of the box. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(settings): add CJK font picker to terminal settings Adds a new "CJK font" select row right under the main font selector in the Terminal settings tab. Bound to TerminalSettings.fallbackFont (an already-existing-but-unused field), so this needs no schema or sync payload change. Default value "Auto" leaves fallbackFont empty, which lets the new per-Latin-font pairing in cjkFonts.ts pick a CJK font automatically. Selecting any explicit option (Sarasa Mono SC, PingFang SC, Microsoft YaHei UI, etc.) takes precedence over the per-font pairing. Includes en + zh-CN i18n strings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(sync): cover fallbackFont round-trip + legacy payload tolerance Four new test cases verify cloud-sync compatibility for the new CJK font setting: - buildSyncPayload includes fallbackFont when set - buildSyncPayload omits fallbackFont when unset - applySyncPayload writes incoming fallbackFont to TERM_SETTINGS - applySyncPayload from a legacy client (no fallbackFont) does NOT wipe the local value — critical for old-to-new upgrades Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(fonts): add font availability detection (canvas + document.fonts API) Three-layer detection used by isFontInstalled(family): 1. Known @fontsource-bundled families (e.g. JetBrains Mono) always count as installed. 2. document.fonts.check() — picks up @font-face and system-loaded fonts. 3. Canvas width measurement against serif / sans-serif / monospace fallbacks; only counts if the target font produces a width that differs from ALL three generics for a probe string. detectInstalledWithContext is a pure function taking an injected measurement context, which keeps the canvas / DOM behind a seam and lets the logic be unit-tested without a browser. 11 tests cover quoted-family parsing, the three-generic-fallback rule, bundled short-circuit, and document.fonts.check fast-path. Results are cached per process; clearFontAvailabilityCache() invalidates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(fonts): filter dropdowns to fonts actually installed on this machine Layer 3 of #931 added Sarasa Mono SC / Maple Mono CN / Microsoft YaHei UI / PingFang SC etc. to the terminal font dropdown, but users who don't have these installed would still see them and pick them — resulting in "I changed the font and nothing happened" confusion. This commit filters both dropdowns through isFontInstalled(): - TerminalFontSelect: drops any built-in or system-discovered font that detection can't render. If filtering would leave fewer than 4 fonts (detection misfire safety net), shows the full list. - TerminalCjkFontSelect: keeps the "Auto" sentinel always, drops concrete CJK choices that aren't present on this machine. Both selects always keep the currently-selected value visible — even when the underlying font is missing — so users can read and clear their setting without surprise. Also expands `npm test` globs to pick up infrastructure/config/*.test.ts and lib/*.test.ts, which previously matched no patterns and meant the new cjkFonts and fontAvailability suites were silently excluded from CI runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): never recommend proportional CJK fonts for terminal use The previous PingFang SC / Microsoft YaHei UI / Hiragino Sans GB choices were proportional sans-serif fonts whose CJK glyphs aren't designed to fit a terminal's 2x cell grid — the rendered Chinese ended up visibly wider than its allocated cells, breaking grid alignment (reported on macOS with PingFang SC selected as the CJK font). Changes: - TerminalCjkFontSelect: drops PingFang SC / Microsoft YaHei UI / Hiragino Sans GB from the dropdown. Legacy explicit selections still surface as a synthetic "not recommended" option so users can see and re-pick. - CJK_SYSTEM_FALLBACK_FONTS: monospace-only list. Sarasa Mono SC/TC, Maple Mono CN, LXGW WenKai Mono, Noto Sans Mono CJK SC, Source Han Mono SC, NSimSun, SimSun. Proportional fonts removed. - PER_FONT_CJK_PAIRING: every entry now points at a true monospace CJK font. Cascadia / Consolas / Menlo etc. all recommend Sarasa Mono SC, which the next commit bundles via @font-face. - getDefaultCjkFallback: Windows = SimSun (always installed, monospace); macOS = Sarasa Mono SC (will be bundled); Linux = Noto Sans Mono CJK SC. A regression test enforces that no per-OS default is a known proportional font. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(fonts): bundle Sarasa Mono SC as the universal CJK monospace Previous commit removed proportional CJK fonts (PingFang SC, etc.) from the picker and switched per-OS defaults to true monospace, but macOS ships NO system-installed monospace CJK font — leaving macOS users with a broken default unless they manually install Sarasa or similar. This commit closes that gap by bundling Sarasa Mono SC as an @font-face webfont, so the recommended pairings and macOS default "just work" out of the box. Details: - public/fonts/SarasaMonoSC-Regular.woff2 (~4.8 MB): subsetted from be5invis/Sarasa-Gothic v1.0.37 SarasaMonoSC-Regular.ttf (24 MB). Covers ASCII, Latin-1, common punctuation/symbols, CJK Unified Ideographs main block, Hiragana/Katakana, halfwidth/fullwidth, box-drawing — the everyday-Chinese coverage that matters for a terminal. Rare CJK Ext-A/B/historical chars fall through to the system fallback stack. - public/fonts/SarasaMono-LICENSE.txt: OFL-1.1 verbatim, required by the license. - index.css: @font-face declaration with font-display: swap so the user doesn't see a flash of nothing while the woff2 loads. - KNOWN_BUNDLED_FAMILIES: "Sarasa Mono SC" added so the dropdown availability filter doesn't hide it. Installer impact: ~+4.8 MB (vs current ~100-200 MB Electron baseline). The font replaces what would otherwise have been "Chinese chars look broken in the terminal" for every macOS user without a manually installed CJK monospace font. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): use Local Font Access API as the authoritative install check document.fonts.check() turned out to be unreliable as an installed-font signal in Chromium — it returns true for any syntactically-valid family name regardless of whether the font is actually installed, as a deliberate fingerprinting-mitigation. The previous detector took it as a positive signal and ended up keeping uninstalled fonts in the dropdown (reported by a macOS user seeing dozens of fonts they don't have). This commit pivots the detection chain: - lib/localFonts.ts: getAllSystemFontFamilies() exposes the unfiltered set of installed family names from queryLocalFonts(), reusing the same underlying call as getMonospaceFonts() via a shared cache. - lib/fontAvailability.ts: drops the document.fonts.check fast-path. Adds setSystemFamilies() / hasAuthoritativeData(). When the set has been populated, isFontInstalled answers from membership lookup directly — no canvas guessing. Canvas remains as a fallback for environments where the Local Font Access API is unavailable or permission is denied. - application/state/fontStore.ts: during initialize(), runs the monospace-only query and the full-system-families query together, then pipes the result into fontAvailability. - TerminalFontSelect: with authoritative data, drops the "if filtered list is suspiciously small, show all" safety net. Empty would now really mean empty (highly unlikely since Sarasa Mono SC is bundled). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): drop PingFang SC / Microsoft YaHei UI from primary dropdown Step 1 of this PR removed proportional CJK fonts from the CJK fallback picker but left them in BASE_TERMINAL_FONTS, so PingFang SC and Microsoft YaHei UI were still selectable as the *primary* terminal font. Picking PingFang SC as primary produced visibly bloated Latin character spacing (xterm.js samples cell width from the primary font; the wide proportional 'M' inflates every cell), reported by a macOS user in the same thread that opened #931. Both entries are removed from BASE_TERMINAL_FONTS. A new infrastructure/config/fonts.test.ts asserts that no known proportional CJK font name (including PingFang TC/HK, Microsoft YaHei variants, Hiragino Sans GB, Heiti SC/TC) is ever shipped in TERMINAL_FONTS as a primary choice. Migration for users already saved to one of the removed ids: useSettingsState rewrites STORAGE_KEY_TERM_FONT_FAMILY to the default (Menlo) on read when it sees a deprecated id, so the bad value also stops getting carried into cloud-sync uploads. Per-host fontFamily overrides are NOT migrated automatically — they still gracefully fall through to the dropdown's first entry via the existing getFontById fallback; users can re-pick from the host settings UI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): drop Comic Sans MS — it's a proportional handwriting font Same symptom as the PingFang SC / Microsoft YaHei UI removal: Comic Sans MS was historically in the primary font dropdown labeled "Casual, non-traditional terminal font", but Comic Sans is a handwriting-style proportional sans-serif. Picking it as the terminal primary inflates cell width and spaces every Latin character far apart (reported in the same #931 thread). - BASE_TERMINAL_FONTS: comic-sans-ms entry removed. - DEPRECATED_PRIMARY_FONT_IDS: gains comic-sans-ms so existing selections silently migrate to Menlo on read. - fonts.test.ts: the proportional-font ban list now also covers Latin proportional fonts (Comic Sans MS, Arial, Helvetica, Times New Roman, Georgia, Verdana, Trebuchet MS, Tahoma) so the test catches any future mislabeled body-text font from being added to the terminal dropdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): keep monospace ahead of CJK fallbacks in composed stack Addresses codex P1 review comment on PR #940 (https://github.com/binaricat/Netcatty/pull/940#discussion_r3216017737). The previous behavior of withCjkFallback() had monospace immediately after the primary family, before any CJK fallback. composeFontFamilyStack had moved monospace to the very end, which means: when the primary font isn't installed on the user's machine (common for Layer 3 CJK choices that aren't bundled and not present on a given OS, or for any built-in id like cascadia-code on a Linux system without it), CSS per-glyph fallback resolves Latin glyphs from a CJK font's full-width Latin variants before ever reaching monospace generic. That breaks xterm.js's fixed cell-grid alignment. The composed stack now reads: <primary>, monospace, <userFallback>, <recommended-cjk>, <system-cjk-stack>, <nerd-font-stack> Per-glyph CSS fallback behavior: - Latin → primary if installed → monospace generic. Cell width stays consistent. - CJK → primary (no) → monospace (no Chinese glyphs) → walks into CJK fallbacks. - Nerd PUA → falls past all of the above into the Nerd Font stack. Updates the position-invariant tests and adds a regression test that explicitly asserts monospace appears before every CJK family in the output stack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): dedupe Local Font Access API calls under concurrent init Addresses codex P2 review on PR #940: https://github.com/binaricat/Netcatty/pull/940#discussion_r3216246xxx fontStore.initialize() runs getMonospaceFonts() and getAllSystemFontFamilies() in Promise.all; both internally called queryAllSystemFontsOnce(), whose cache check (`if (cache) return`) was only useful once the result had been written. Concurrent callers both passed the empty-cache check and fired their own queryLocalFonts() request — two real Local Font Access API invocations on cold start, with the risk of one succeeding while the other was denied (leaving the authoritative set unset). Fix: cache the *in-flight promise itself*, so subsequent callers await the same single invocation. The first await populates the family-set cache as a side effect, and the resolved promise keeps returning the same value to every subsequent caller. Adds lib/localFonts.test.ts with three regression tests: - concurrent getMonospaceFonts + getAllSystemFontFamilies = 1 API call - sequential repeats also reuse the resolved promise - missing API returns null authoritative set (canvas fallback signal) Exports __resetLocalFontsCacheForTesting() so each test gets a fresh module-level state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): retry LFA on transient failure + notify on availability changes Two follow-up fixes from codex P2 review on PR #940: 1) queryAllSystemFontsOnce() previously kept its in-flight promise even when queryLocalFonts threw. Subsequent callers reused the cached empty result for the rest of the session, so any transient failure at boot (permission state not ready, AbortError, etc.) permanently blinded the rest of the app to installed fonts. Catch now clears queryPromise so the next caller retries. Regression test added. 2) TerminalCjkFontSelect.visibleOptions and TerminalFontSelect .visibleFonts were memoized on [value] / [fonts, value] only, but the filter calls isFontInstalled() which reads module-level systemFamilies — a value that arrives asynchronously after the initial render. The memos never recomputed when authoritative availability data landed, so the dropdowns could continue showing stale "filtered" results until the user changed selection. fontAvailability now exposes subscribeFontAvailability() and getFontAvailabilityVersion() (monotonic counter bumped on setSystemFamilies / clearFontAvailabilityCache). Both selects subscribe via useSyncExternalStore and include the version in their memo deps; tests cover subscriber notification and version monotonicity. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): migrate host/group deprecated font ids + localize CJK labels Two follow-up fixes from codex review on PR #940: P2 — Host/group level font migration ==================================== The earlier deprecated-id migration only rewrote STORAGE_KEY_TERM_FONT_FAMILY, so hosts and group configs that had explicitly opted into a now-removed font id (e.g. pingfang-sc, microsoft-yahei, comic-sans-ms) kept `fontFamily` set with `fontFamilyOverride=true`. After the dropdown entries were dropped in 9f2bd282/c9b622d8, those records silently fell through to the first font in the registry (Menlo) while the override flag still read "true" — users saw a host claiming a custom font but rendering the global default with no way to tell what happened. Fix: - infrastructure/config/fonts.ts gains migrateDeprecatedFontOverride(), a structurally-shared helper that drops fontFamily and clears fontFamilyOverride when the id is deprecated. - sanitizeHost now runs it on every host load. - domain/groupConfig.ts grows sanitizeGroupConfig(); useVaultState applies it both on initial load and on cross-tab storage events. - Existing decrypt → sanitize → encrypt round-trip in useVaultState means the migrated values are persisted back to localStorage and propagate through cloud sync naturally. Tests: two each in domain/host.test.ts and domain/groupConfig.test.ts covering deprecated-id reset and untouched-valid-id preservation. P3 — Localize CJK font option labels ==================================== TerminalCjkFontSelect previously hardcoded Chinese option labels ("Auto · 按主字体智能搭配", "Sarasa Mono SC (更纱黑体 简)", etc.) and the synthetic "not recommended" warning. Non-Chinese locales saw a mixed-language UI despite the rest of the setting going through i18n. OPTIONS now references i18n keys; the component looks them up via useI18n(). Both en and zh-CN locales gain matching keys, including `...option.legacy` with `{font}` interpolation for the synthetic "not recommended" item that surfaces saved-but-removed values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(fonts): also sanitize group configs on the write/import path Addresses codex P2 review on PR #940: https://github.com/binaricat/Netcatty/pull/940#discussion_r3216314xxx The previous commit ( |
||
|
|
eb1fd9c127 | Harden Telnet auto-login | ||
|
|
72e305fb7a | Add reusable proxy profiles | ||
|
|
155463f77c | add reusable proxy profiles |