From 9b554bb93be0271ed2ac8c2eea25c88ab7bb56f7 Mon Sep 17 00:00:00 2001 From: evgenykei Date: Thu, 29 Oct 2026 11:21:39 +0300 Subject: [PATCH] fix(joiner): persist GUI state and guard backend startup --- docs/JOINER_GUI_NOTES.md | 47 +++++++++ joiner-desktop-app/index.html | 2 +- joiner-desktop-app/src/constants.ts | 1 + joiner-desktop-app/src/main/index.ts | 115 +++++++++++++++------ joiner-desktop-app/src/main/port.ts | 11 ++ joiner-desktop-app/src/main/settings.ts | 49 +++++++++ joiner-desktop-app/src/preload/index.ts | 1 + joiner-desktop-app/src/renderer/index.ts | 37 ++++++- joiner-desktop-app/styles/app.css | 2 +- joiner-desktop-app/test/lifecycle.test.cjs | 75 ++++++++++++++ joiner-desktop-app/test/settings.test.cjs | 50 +++++++++ 11 files changed, 353 insertions(+), 37 deletions(-) create mode 100644 docs/JOINER_GUI_NOTES.md create mode 100644 joiner-desktop-app/src/main/port.ts create mode 100644 joiner-desktop-app/src/main/settings.ts create mode 100644 joiner-desktop-app/test/lifecycle.test.cjs create mode 100644 joiner-desktop-app/test/settings.test.cjs diff --git a/docs/JOINER_GUI_NOTES.md b/docs/JOINER_GUI_NOTES.md new file mode 100644 index 0000000..c960856 --- /dev/null +++ b/docs/JOINER_GUI_NOTES.md @@ -0,0 +1,47 @@ +# Desktop Joiner state and settings + +The desktop GUI stores its last successfully launched settings in `settings.json` +inside Electron's application user-data directory. The conference link is stored +locally; the SOCKS password is intentionally not persisted. Treat that settings +file as private and do not include it in bug reports. + +The GUI refuses to start if its local SOCKS port is occupied. It does not stop +the process using that port. Close the other client or select a different port. +This is a preflight check; the backend still owns the final socket bind. + +Reopening the window restores the current status and recent log. Fields are +disabled while the backend is running. Both `TUNNEL CONNECTED` and +`TUNNEL_CONNECTED` status formats are recognized. Closing the application +cancels a pending reconnect. + +VP8 batch values up to 3000 can be entered; allowing a value is not a +recommendation to use it. The default remains 30. Existing default SOCKS port, +DNS, TUN and reliable-mode settings are preserved. + +## Validation + +From `joiner-desktop-app`, install dependencies and run: + +```sh +npm run build +node --test test/settings.test.cjs test/lifecycle.test.cjs +``` + +The tests cover argument validation, Telemost/WB Stream/Bitrix KCP flags, +occupied-port handling, cancellation during startup, status recognition, +password omission and reconnect cancellation. Electron lifecycle tests use +mock processes and do not start a tunnel or modify routes. + +## Separate tuning experiments + +The local deployment that motivated these GUI fixes also tested KCP window +1024 and a server pending-send limit of 1536 instead of 2048. A short ABA series +of 5 MB single-stream downloads produced medians of 14.82 s (2048), 8.89 s +(1536), and 13.79 s (2048). This was not a controlled throughput benchmark: +network conditions varied and only one 1536 series completed successfully. +The 2048 configuration was restored after testing. + +Those transport experiments and their custom binaries are not part of this +GUI patch. These results do not establish an optimal window, pending limit, +or performance improvement for other networks. Private deployment addresses, +conference links, credentials and support logs are not included. diff --git a/joiner-desktop-app/index.html b/joiner-desktop-app/index.html index 103ead6..b42a5a1 100644 --- a/joiner-desktop-app/index.html +++ b/joiner-desktop-app/index.html @@ -66,7 +66,7 @@