Commit Graph

770 Commits

Author SHA1 Message Date
Jianhui Zhao
126cf88bf3 ui: keep term window when the term disconnects.
This allows users to see the state where the terminal
is disconnected.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-09-04 09:51:19 +08:00
Jianhui Zhao
bebc7d1f4b ui: Limit the number of window splits to 6
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-09-04 09:39:48 +08:00
Jianhui Zhao
94d2a5edc3 bump version 5.5.2
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
v5.5.2
2025-08-17 21:34:40 +08:00
Jianhui Zhao
1812995d4d ui: add banner info
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-16 11:25:01 +08:00
Jianhui Zhao
baac0abe56 HTTP connection termination notification for http proxy
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-14 18:06:36 +08:00
Jianhui Zhao
1d24c36d43 prevent accidental removal of existing device on duplicate ID conflict
When a new device connection is established, it creates a Device struct and
checks for ID conflicts. If a conflict exists, the new device connection
closes and triggers DelDevice via its defer statement. The original
implementation used LoadAndDelete which removed any device with the given ID,
causing the existing device to be incorrectly removed.

This changes the deletion logic to use CompareAndDelete, which verifies
both the device ID and the specific device instance. Now when a duplicate
connection closes, only the new (unregistered) device is attempted for removal,
preserving the existing device in the registry.

This ensures legitimate devices remain connected when duplicate connection
attempts occur.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-14 12:17:11 +08:00
Jianhui Zhao
9ca83abda9 bump version 5.5.1
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
v5.5.1
2025-08-13 23:04:24 +08:00
Jianhui Zhao
d2e73ae6f7 refactor http proxy request handling and improve performance
This commit significantly optimizes the HTTP proxy implementation by:

1. Replacing standard http.ReadRequest with manual HTTP header parsing
   - Avoids unnecessary allocations from full request parsing
   - Adds 3-second timeout for initial header reading

2. Removing HttpProxyWriter abstraction
   - Directly construct and send rewritten Host header
   - Simplify data forwarding logic

3. Unifying WebSocket and regular HTTP handling
   - Use single read loop for both cases
   - Always use buffer pool for reads

4. Adding proper timeouts
   - Set deadlines for header reading
   - Reset timeout after headers are processed

These changes reduce memory allocations, improve performance, and simplify the proxy logic.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:52:00 +08:00
Jianhui Zhao
68828c889e use sync.Pool for WebSocket read buffers in http proxy
Introduce a buffer pool to reduce memory allocations during WebSocket handling.
Previously, each WebSocket connection created a new 4KB buffer for every read operation.

This reduces GC pressure and improves memory efficiency for WebSocket traffic.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:50:40 +08:00
Jianhui Zhao
2f04a373c1 strip default ports from Host header in http proxy
Previously the Host header used the destination address verbatim, including
the port even for default ports (80 for HTTPS, 443 for HTTPS). This violates
HTTP specifications which require omitting default ports in Host headers.

This ensures compliant Host headers like "example.com" instead of "example.com:80"

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:50:40 +08:00
Jianhui Zhao
1470e04c4d set default port based on proto in http proxy
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:50:40 +08:00
Jianhui Zhao
1322c5deb6 Replaced string-based keys with byte arrays for HTTP proxy in sync.Map
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:50:40 +08:00
Jianhui Zhao
1ef76bd855 Write the HTTP proxy error page to a file
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-12 22:50:33 +08:00
Jianhui Zhao
19604debb4 use github.com/zhaojh329/rtty-go/proto
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-09 13:54:32 +08:00
Jianhui Zhao
21db9f8528 use SPDX-License-Identifier
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-08 19:56:51 +08:00
Jianhui Zhao
ca91a7983c bump version 5.5.0
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
v5.5.0
2025-08-07 21:40:46 +08:00
Jianhui Zhao
0a00064e05 Fix an incorrect log function call.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-07 12:03:02 +08:00
Jianhui Zhao
819a72000f device registration parsing with robust error handling
These changes provide clearer failure diagnostics and prevent invalid
device registrations from compromising system stability.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-07 11:56:24 +08:00
Jianhui Zhao
c90e14a1ac Reintroduce TLS support for device listener
preserve client IP visibility

Previously, TLS termination was moved to nginx for better separation of concerns.
However, this introduced an issue with the new device IP display feature:

- With nginx reverse proxying, all device connections appear to originate from 127.0.0.1
- The actual device IP addresses were masked by the proxy layer
- This prevented accurate IP-based device identification and reporting

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-01 13:13:17 +08:00
Jianhui Zhao
25dbcc966b clearer description of command-line arguments for -V
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-01 13:13:15 +08:00
Jianhui Zhao
0b9d236a15 Optimize configuration parsing
Reduce redundant code and add fault tolerance handling

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-01 13:13:09 +08:00
Jianhui Zhao
880ac06a93 Improves code organization and readability
- Encapsulate API routes into APIServer methods (api.go)
- Split large handleUserConnection into smaller methods (user.go)

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-31 00:21:17 +08:00
Jianhui Zhao
3ce2b30dc4 ci: do not use battila7/get-version-action@v2
Deprecating set-output command.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-30 21:22:47 +08:00
Jianhui Zhao
85e60e9d46 ci: use ubuntu-latest and stable go version
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-30 20:58:59 +08:00
Jianhui Zhao
0525361a79 bump version 5.4.1
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
v5.4.1
2025-07-29 22:29:11 +08:00
Jianhui Zhao
0bf696269f ci: push github container registry
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 22:28:36 +08:00
Jianhui Zhao
c892998cfe add goreportcard in README
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 15:00:53 +08:00
Jianhui Zhao
2489b605a7 Remove log file fallback for non-TTY output
The feature that wrote logs to a file when stdout wasn't a terminal is
removed. Systemd services already handle log persistence through journald
and its logging facilities. This duplication is unnecessary and conflicts
with standard systemd logging practices.

View log in systemd:

```
journalctl -u rttys
```

or

```
journalctl -u rttys -f
```

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:29 +08:00
Jianhui Zhao
5dbb4bf951 Update module name to 'github.com/zhaojh329/rttys/v5'
This is in line with the Go language module specifications.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:29 +08:00
Jianhui Zhao
c10c0f3e58 ui: Optimize context menu display effect
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:29 +08:00
Jianhui Zhao
549794c3d5 ui: add support change font size via shortcut key
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:29 +08:00
Jianhui Zhao
f54f5323bd ui: add support find in terminal
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:29 +08:00
Jianhui Zhao
0bf9eff0ab ui: Optimize terminal display effect
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-29 14:55:20 +08:00
Jianhui Zhao
f1aca8fa64 ui: simplify FitAddon initialization in RttyTerm.vue
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-25 22:49:07 +08:00
Jianhui Zhao
14c35e8263 test: optimize rttys_stress_test.go
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-23 19:12:15 +08:00
Jianhui Zhao
19eb331421 bump version 5.3.0
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
v5.3.0
2025-07-21 22:03:28 +08:00
Jianhui Zhao
315ba884a6 ui: set cursorStyle to 'bar'
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-21 21:41:55 +08:00
Jianhui Zhao
92b71481f8 ui: add addon @xterm/addon-web-links
Adds web link detection and interaction in terminal.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-21 21:18:32 +08:00
Jianhui Zhao
7c3eb9cc99 http proxy: simplify session management and remove redundant cookies
- Add devid, group, destaddr, and https fields to HttpProxySession for better session tracking and logging.
- Refactor doHttpProxy to use only the rtty-http-sid cookie for session lookup, removing dependencies on group, devid, proto, and destaddr cookies.
- In httpProxyRedirect, store all necessary session info in HttpProxySession and set only the rtty-http-sid cookie.
- Unify logging to use the session string for easier debugging.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-21 21:18:32 +08:00
Jianhui Zhao
6787a39007 ui: add support virtual keyboard
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-21 21:18:26 +08:00
Jianhui Zhao
1c5c761470 ui: migrate all Vue components from Options API to Composition API
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-20 17:06:33 +08:00
Jianhui Zhao
9ff0f441eb update README
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-20 13:49:59 +08:00
Jianhui Zhao
49106e5602 ui: Optimize font size settings
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-20 13:31:51 +08:00
Jianhui Zhao
f992856d53 ui: add terminal window splitting functionality
- Add horizontal and vertical split options to context menu
- Support recursive splitting for complex terminal layouts

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-20 13:31:28 +08:00
Jianhui Zhao
1251278902 ui: fix locale for Upload file to device in en.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 19:21:03 +08:00
Jianhui Zhao
55e2803404 ui: Optimize the display effect of the right-click menus
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 18:21:11 +08:00
Jianhui Zhao
3efb274902 improve authentication logic for empty password
- Move empty password check from httpLogin to httpAuth
- httpLogin now only validates actual password comparison
- httpAuth handles empty password as authentication bypass
- This ensures consistent authentication behavior across all endpoints

Previously, empty password would always return true in httpLogin,
now it's properly handled at the authentication middleware level.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 15:32:23 +08:00
Jianhui Zhao
dd10162d34 ui: add smart positioning for context menu
- Add viewport boundary detection to prevent menu overflow
- Auto-adjust menu position when near screen edges
- Ensure menu stays within visible area with 15px margin
- Use $nextTick to calculate position after DOM update

This prevents context menu from being cut off when right-clicking
near screen boundaries, especially in bottom-right corner.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 15:28:12 +08:00
Jianhui Zhao
39e2d8bbb6 ui: This WebSocket should be closed on unmounted
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 15:19:17 +08:00
Jianhui Zhao
cec373b4dd ui: fix ContextMenu.vue
may be el is null in close.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 11:42:45 +08:00