penguinway
a86a5e6839
fix(auto-update): revert checkNow to use performCheck (GitHub API) instead of electron-updater IPC
...
checkNow was calling bridge.checkForUpdate() which invokes updater.checkForUpdates()
via IPC. startAutoCheck() in the main process already calls checkForUpdates() on a
5s timer, and if that network request is still pending, the concurrent IPC call from
checkNow hangs indefinitely, causing the UI to be stuck in "checking" state forever.
Per the original design spec, checkNow should use performCheck() (GitHub API) directly.
This is completely independent of electron-updater's internal state machine, so it
never conflicts with the background startAutoCheck(). performCheck handles isCheckingRef,
isChecking, hasUpdate, and latestRelease; checkNow only manages manualCheckStatus.
2026-03-11 15:46:05 +08:00
penguinway
7ed4940e18
docs: update CHANGELOG for auto-update unification
2026-03-11 15:32:39 +08:00
penguinway
410d1ef097
feat(settings): pass unified updateState and update actions to SettingsSystemTab
2026-03-11 15:28:41 +08:00
penguinway
c386ee2e2e
refactor(settings): remove local update state from SettingsSystemTab, use unified updateState props
2026-03-11 15:26:16 +08:00
penguinway
4c08888b60
fix(auto-update): fix isCheckingRef conflict in checkNow fallback path and stale version closure
...
- Critical: In Linux fallback path, temporarily reset isCheckingRef before calling
performCheck so its own guard can run (was silently returning null due to double-set)
- Critical: Replace updateState.currentVersion closure in checkNow with currentVersionRef
to avoid reading stale '' version on early user click; remove from useCallback deps
- Important: Add explicit !result guard when bridge is unavailable, returning 'error'
status instead of silently falling through to 'up-to-date'
2026-03-11 15:20:27 +08:00
penguinway
2ea4c88680
feat(auto-update): add manualCheckStatus to UpdateState, rewrite checkNow to use electron-updater IPC
2026-03-11 15:13:54 +08:00
penguinway
0ba75f9af0
fix(auto-update): broadcast IPC events to all windows instead of single window
2026-03-11 15:09:29 +08:00
penguinway
4610348b0d
Merge branch 'feat/auto-update'
2026-03-11 14:39:22 +08:00
penguinway
8d11b71bc1
Merge branch 'main' of github.com:penguinway/Netcatty
2026-03-11 14:39:08 +08:00
penguinway
6683001032
chore: exclude tests/ and CLAUDE.md from eslint and gitignore
2026-03-11 14:28:46 +08:00
penguinway
3b313ff933
chore: gitignore local test suite (tests/, vitest.config.ts)
2026-03-11 14:08:06 +08:00
penguinway
eaa27461fa
docs: add CHANGELOG for auto-update feature
2026-03-11 13:16:39 +08:00
penguinway
20b65366be
chore: ignore dev-app-update.yml, revert forceDevUpdateConfig test flag
2026-03-11 13:12:39 +08:00
penguinway
b8c08ba3ca
chore: ignore AI-generated docs (docs/superpowers/)
2026-03-11 12:54:11 +08:00
陈大猫
981c5de90d
Merge pull request #310 from binaricat/fix/windows-auto-update-signing
...
fix: prevent macOS signing credentials from leaking to Windows builds
2026-03-11 11:40:58 +08:00
bincxz
0097d65a6e
fix: prevent macOS signing credentials from leaking to Windows builds
...
Only pass CSC_LINK, CSC_KEY_PASSWORD, and Apple notarization secrets
to the macOS matrix job. Previously these were passed to all matrix
jobs, causing electron-builder to sign Windows .exe with the Apple
Developer ID certificate. Windows doesn't trust Apple's certificate
chain, so electron-updater's signature verification failed during
auto-update.
Closes #309
2026-03-11 11:15:04 +08:00
penguinway
e4aa03c474
fix(auto-update): use duration:0 for persistent toast, remove stale comment
2026-03-11 02:44:44 +08:00
penguinway
b94386236c
feat(auto-update): add ready-to-install and download-failed toast notifications
2026-03-11 02:40:10 +08:00
penguinway
0883585704
feat(auto-update): add autoDownloadStatus state and IPC subscriptions to useUpdateCheck
2026-03-11 02:35:45 +08:00
penguinway
5b38f4663d
feat(auto-update): add i18n keys for ready-to-install and download-failed toasts
2026-03-11 02:35:18 +08:00
penguinway
a6a6dd1aac
feat(auto-update): expose onUpdateAvailable in preload bridge
2026-03-11 02:32:20 +08:00
penguinway
506c60ea44
feat(auto-update): trigger startAutoCheck after main window ready
2026-03-11 02:32:09 +08:00
penguinway
9d9b24fe7b
feat(auto-update): add onUpdateAvailable type to NetcattyBridge
2026-03-11 02:32:06 +08:00
penguinway
584b9859ef
fix(auto-update): guard setupGlobalListeners against duplicate registration
2026-03-11 02:30:52 +08:00
penguinway
b005065949
feat(auto-update): enable autoDownload and global IPC event listeners
2026-03-11 02:27:59 +08:00
penguinway
a4fdb6758d
docs: add auto-update implementation plan
...
Detailed step-by-step plan for feat/auto-update branch. Addresses
reviewer feedback: specific line anchors, SettingsSystemTab props
pattern, removeAllListeners risk, i18n key conflict notes, and
hasUpdate toast suppression when auto-download is active.
2026-03-11 02:23:20 +08:00
penguinway
a2b5c9d067
docs: add auto-update design spec
...
Spec for changing update flow from manual to auto-download + prompt
install: autoDownload=true in main process, renderer subscribes to
electron-updater IPC events, toast notification on download complete.
2026-03-11 02:11:39 +08:00
陈大猫
a451fd8811
Merge pull request #308 from binaricat/fix/issue-307-display-upload-path
...
fix(sftp): display upload destination path on completed task items (#307 )
v1.0.45
2026-03-10 21:26:06 +08:00
bincxz
49cef792a8
fix(sftp): display upload destination path on completed task items ( #307 )
...
Show the remote target path inline on completed upload task items
(e.g. "Completed - 1.2 MB → /home/user/dir") so users know exactly
where their files were uploaded after drag-and-drop to terminal.
- Add `targetPath` field to modal's TransferTask type
- Populate targetPath from currentPath in onTaskCreated callback
- Display targetPath on completed upload items in SftpModalUploadTasks
- Add i18n key `sftp.upload.completedToPath` (en/zh-CN)
2026-03-10 21:14:25 +08:00
陈大猫
62511ceb21
Merge pull request #305 from binaricat/fix/sftp-mfa-auth-304
...
fix(sftp): handle non-fatal agent auth errors for MFA/keyboard-interactive (#304 )
2026-03-10 10:54:37 +08:00
bincxz
00cbb05d71
fix(sftp): handle end/close events during SSH connect phase
...
Address code review feedback: the direct ssh2.Client connect path
was missing end/close event handlers. If the server closes the
connection before 'ready' (e.g. rejected handshake, hop drops),
the promise now properly rejects instead of hanging forever.
Uses a settle/cleanup pattern to ensure listeners are removed and
the promise is resolved/rejected exactly once.
2026-03-10 10:40:47 +08:00
bincxz
3497614165
fix(sftp): fallback to standard SFTP when sudo sftp-server not found
...
When sudo SFTP fails with exit code 127 (sftp-server binary not found,
e.g. on ESXi), automatically fall back to the standard SFTP subsystem
channel instead of failing the entire connection. This avoids requiring
users to manually disable sudo mode for hosts that lack sftp-server.
2026-03-10 10:37:47 +08:00
bincxz
b652b836a7
fix(sftp): handle non-fatal agent auth errors for MFA/keyboard-interactive ( #304 )
...
Two compounding issues caused SFTP connections to fail when
keyboard-interactive (MFA) authentication was required:
1. ssh2-sftp-client's connect() installs error listeners that reject
the entire connection on ANY error, including non-fatal agent auth
failures. This prevents ssh2 from falling through to
keyboard-interactive. Fix: bypass ssh2-sftp-client's connect() and
use direct ssh2.Client with err.level === 'agent' filtering.
2. getSshAgentSocket() on Windows unconditionally returned the agent
pipe path without checking if the SSH Agent service is running.
Fix: added async getAvailableAgentSocket() that runs
'sc query ssh-agent' before returning the pipe path.
2026-03-10 10:12:37 +08:00
陈大猫
cd604107ee
Merge pull request #303 from binaricat/fix/unify-sync-payload
...
fix: unify sync payload logic & harden port forwarding lifecycle
v1.0.44
2026-03-10 03:10:30 +08:00
bincxz
adc4c25dc9
fix: set cancelled flag in stopPortForward(tunnelId) IPC handler\n\nThe legacy stopPortForward(tunnelId) path also needs to mark\ntunnel.cancelled = true before conn.end() and skip the immediate\ndelete. Otherwise, when a user clicks Stop on a connecting rule,\nconn.on('close') sees no cancelled flag and rejects the Promise,\ncausing a false error toast.
2026-03-10 03:04:29 +08:00
bincxz
eaaf0265f8
fix: preserve cancelled markers in stopAllPortForwards\n\nMark all tunnel entries as cancelled before calling conn.end()\nand remove the .clear() call. Let each conn.on('close') handler\ndelete its own entry so it can read the cancelled flag first.\n\nPreviously, .clear() removed all entries before the async close\nevents fired, so the close handler saw no entry and treated the\nshutdown as an unexpected failure — surfacing error toasts or\ntriggering auto-reconnect for rules the user just cleared.
2026-03-10 02:57:56 +08:00
bincxz
f4d833497d
fix: ref-count singleton effects and use only stopPortForwardByRuleId for cleanup\n\n1. Replace boolean guard flags (reconnectCancelListenerActive,\n heartbeatActive) with ref-counting. Resources are created when\n count goes 0→1 and destroyed when count goes 1→0. The previous\n boolean approach broke when React ran child effects before parent\n ones: opening the Port Forwarding page let the child register\n the listener/heartbeat, but navigating away tore them down even\n though the App instance was still mounted.\n\n2. stopAndCleanupRule now uses only stopPortForwardByRuleId (which\n sets tunnel.cancelled = true before conn.end()). The old code\n called stopPortForward(tunnelId) first, which deletes the\n main-process tunnel entry immediately — making the cancelled\n flag invisible to conn.on('close') and causing intentional\n deletions to surface as error toasts.
2026-03-10 02:50:58 +08:00
bincxz
75871717a9
fix: capture cancelled flag before close handler cleanup deletes the entry\n\nstopPortForwardByRuleId previously deleted the tunnel entry from\nportForwardingTunnels before conn.end() fired the async close\nevent. By the time conn.on('close') ran, the entry was gone and\nthe cancelled flag was invisible. The fallback check\n!portForwardingTunnels.has(tunnelId) was ambiguous — it was also\ntrue when conn.on('error') deleted the entry for a real failure.\n\nFix:\n1. Capture tunnel.cancelled BEFORE cleanup deletes the entry.\n2. Don't delete in stopPortForwardByRuleId — let conn.on('close')\n handle deletion so it can read the flag first.\n3. Remove the ambiguous !has() fallback check entirely.
2026-03-10 02:42:08 +08:00
bincxz
f6619c28ed
fix: strip lastUsedAt from SettingsSyncTab localStorage fallback\n\nConsistent with the useAutoSync fallback, also clear lastUsedAt\nfrom rules read from localStorage before building the sync payload.\nPreviously, device-local usage timestamps leaked into the cloud\nsnapshot and were replicated to other devices on import.
2026-03-10 02:33:43 +08:00
bincxz
ca77315257
fix: handle cancelled handshakes gracefully and evict stale connecting entries\n\n1. startPortForward now checks result.cancelled for intentional\n cancellations (rule deleted/replaced during SSH handshake).\n Instead of triggering error state or reconnect, it transitions\n to 'inactive' and returns cleanly. Previously, success:false\n from a cancelled handshake would schedule another reconnect,\n resurrecting the tunnel a few seconds later.\n\n2. reconcileWithBackend now evicts 'connecting' entries seeded by\n a previous reconcile (observed from another window's handshake)\n when the backend no longer reports them. Only locally-initiated\n connecting entries (which have an unsubscribe callback from\n their startPortForward call) are preserved. Previously, stale\n connecting entries from failed/cancelled handshakes stayed\n forever, with the rule stuck showing 'connecting' in the UI.
2026-03-10 02:25:53 +08:00
bincxz
3ab681e63b
fix: update heartbeat entries on status change and graceful intentional cancellation\n\n1. reconcileWithBackend Case 3: when a tunnel already exists in\n activeConnections but the backend reports a different status\n (e.g. connecting→active after handshake completed in another\n window), update the entry and include it in the 'appeared' set.\n Previously, existing entries were never updated, leaving\n secondary windows stuck on 'connecting' permanently.\n\n2. stopPortForwardByRuleId now marks tunnel.cancelled = true\n before calling conn.end(). The close handler checks this flag:\n intentional cancellations resolve with { cancelled: true }\n instead of rejecting with an Error. This prevents the renderer\n from showing a bogus error toast when a rule is deleted or\n replaced while its SSH handshake is still in progress.
2026-03-10 02:16:44 +08:00
bincxz
2ee7781b82
fix: reconnect stuck state, side-effect guards, and syncWithBackend status\n\n1. scheduleReconnectIfNeeded now returns false when the\n activeConnections entry is missing (deleted by stopAndCleanupRule\n while handshake was in-flight). Previously it returned true\n but never set the timeout, leaving reconnect-enabled rules\n stuck in 'connecting' permanently.\n\n2. Module-level guards (reconnectCancelListenerActive,\n heartbeatActive) prevent duplicate initReconnectCancelListener\n and reconcile heartbeat instances. The hook mounts from both\n App.tsx and PortForwardingNew.tsx, so without guards each\n window gets double listeners and double backend polling.\n\n3. syncWithBackend now uses tunnel.status from the backend\n (connecting or active) instead of hardcoding 'active',\n matching the reconcileWithBackend fix from the previous commit.
2026-03-10 02:09:03 +08:00
bincxz
95780a29dc
fix: strip lastUsedAt from sync fallback and use real tunnel status in reconciliation\n\n1. useAutoSync localStorage fallback now also strips lastUsedAt\n (alongside status/error). Without this, the hash computed\n before async init (with lastUsedAt) differs from the hash\n after init (App.tsx strips it), causing a needless sync upload\n on every launch.\n\n2. reconcileWithBackend now uses tunnel.status from the backend\n (connecting or active) instead of hardcoding 'active' when\n seeding activeConnections. This prevents falsely marking a\n handshaking tunnel as active in the renderer.
2026-03-10 02:01:05 +08:00
bincxz
060c35f66a
fix: auto-sync localStorage fallback for PF rules and settled Promise in bridge\n\n1. useAutoSync buildPayload/getDataHash now fall back to localStorage\n when portForwardingRules is empty (async init not complete).\n Previously, clicking sync immediately after launch would upload\n portForwardingRules: [] and overwrite the cloud snapshot.\n\n2. SettingsSyncTab localStorage fallback strips transient per-device\n fields (status, error) before building the sync payload.\n\n3. startPortForward Promise now tracks a settled flag across all\n resolve/reject paths. conn.on('close') rejects the Promise when\n it hasn't been settled yet (tunnel killed during SSH handshake\n by stopPortForwardByRuleId), preventing callers from hanging\n indefinitely in pendingOperations.
2026-03-10 01:52:48 +08:00
bincxz
ee5d3827d5
fix: reconnect cancel on clear-all, strip transient sync fields, tunnel connecting status\n\n1. importRules([]) now iterates stored rules calling\n stopAndCleanupRule() for each one, broadcasting per-rule reconnect\n cancellation to other windows. Previously only called\n stopAllPortForwards() which doesn't signal reconnect cancel.\n\n2. SettingsSyncTab localStorage fallback strips transient per-device\n fields (status, error) before feeding rules to buildSyncPayload.\n This prevents uploading stale connection state to the cloud.\n\n3. portForwardingBridge tunnel entries now track status explicitly:\n 'connecting' on early registration, 'active' after server.listen\n or forwardIn succeeds. listPortForwards and getPortForwardStatus\n report the actual status instead of hardcoding 'active'.
2026-03-10 01:42:01 +08:00
bincxz
f06333b95e
fix: register tunnel in portForwardingTunnels before SSH handshake\n\nThe previous stopPortForwardByRuleId couldn't catch tunnels during\nSSH handshake because they were only added to portForwardingTunnels\nafter conn.on('ready') + server.listen/forwardIn succeeded.\n\nNow the connection is registered immediately before conn.connect()\nwith server: null. The conn.on('ready') handler updates the entry\nwith the real server object. Error/close handlers already delete\nthe entry, so cleanup is unchanged.\n\nThis closes the last timing window where a deleted rule's tunnel\ncould become orphaned.
2026-03-10 01:33:59 +08:00
bincxz
a07c644ec8
fix: add stopPortForwardByRuleId IPC and fix uninitialized diff baseline\n\nTwo issues:\n\n1. Cross-window cleanup couldn't stop tunnels still in SSH handshake\n because listPortForwards doesn't list them. New approach:\n stopPortForwardByRuleId IPC directly iterates the main process\n portForwardingTunnels map matching by rule ID in the tunnel ID\n string, catching tunnels in ANY state.\n\n - portForwardingBridge.cjs: new stopPortForwardByRuleId function\n - preload.cjs + global.d.ts: expose the new IPC\n - portForwardingService.ts: stopAndCleanupRule and\n initReconnectCancelListener now use stopPortForwardByRuleId\n instead of fragile listPortForwards + match\n\n2. importRules diff loop missed removed/changed rules in a freshly\n opened settings window where globalRules was still empty (async\n initializeStore hadn't finished). Now falls back to reading from\n localStorage as the diff baseline.
2026-03-10 01:28:06 +08:00
bincxz
1d5c40c665
fix: expose stopAllPortForwards via IPC for cross-window tunnel cleanup\n\nThe renderer's stopAllPortForwards only iterated activeConnections\nwhich is empty in a freshly opened settings window. The backend's\nstopAllPortForwards (which iterates portForwardingTunnels in the\nmain process) was only called from will-quit, never via IPC.\n\nChanges:\n- portForwardingBridge.cjs: register netcatty:portforward:stopAll\n- preload.cjs: expose stopAllPortForwards in the bridge API\n- global.d.ts: add type for stopAllPortForwards\n- portForwardingService.ts: after clearing local activeConnections,\n also call bridge.stopAllPortForwards() to stop any backend\n tunnels this renderer doesn't know about
2026-03-10 01:17:55 +08:00
bincxz
ab0c4ede7e
fix: handle settings window initialization timing for sync and cleanup\n\nTwo race conditions in the settings window when hooks haven't finished\nasync initialization:\n\n1. clearAllLocalData calls importRules([]) but globalRules is still\n empty, so no stopAndCleanupRule calls are made. Fix: when\n importRules receives an empty array, call stopAllPortForwards()\n on the backend as a safety net.\n\n2. onBuildPayload reads portForwardingRules from hook state which\n starts as [] until initializeStore finishes. Fix: fall back to\n reading directly from localStorage when hook state is empty,\n preventing empty-array upload that would overwrite remote data.
2026-03-10 01:10:07 +08:00
bincxz
cf86c166cf
fix: Prevent xterm.js right-click behavior from interfering with tmux/vim popups when mouse tracking is active.
2026-03-10 00:59:44 +08:00