Commit Graph

724 Commits

Author SHA1 Message Date
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
Jianhui Zhao 9561f5efc7 ui: add component RttyTerm.vue
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 11:39:04 +08:00
Jianhui Zhao b63d9852a1 ui: fix scroll in terminal
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 11:29:02 +08:00
Jianhui Zhao 8e9081d551 ui: use class instead of inline style for terminal
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-19 11:25:29 +08:00
Jianhui Zhao e9d345287a ui: enhance clipboard paste with permission guidance
- Detect clipboard permission errors and show user-friendly instructions
- Add fallback to Shift+Insert shortcut for unsupported scenarios
- Implement unified clipboard permission guidance with i18n support
- Improve error handling for better user

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-17 11:12:29 +08:00
Jianhui Zhao d2320dce67 refine user hook URL control for specific API endpoints
Move user hook validation to individual endpoints (/connect, /cmd, /web).

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 20:35:04 +08:00
Jianhui Zhao 989d9be983 ui: add loading indicator for create terminal
This prevents users from seeing a blank terminal while waiting for the WebSocket
connection to establish and the login process to complete.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 19:27:11 +08:00
Jianhui Zhao f8e63ad01a ui: redesign error page for better user experience
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:06:41 +08:00
Jianhui Zhao 50bfe1a1e2 improve login timeout handling with proper race condition protection
- Extract login waiting logic into separate waitForLogin function for better code organization
- Fix race condition between timeout and device response by using LoadAndDelete atomically
- Continue waiting for device response if timeout occurs but device has already responded

This refactoring ensures robust handling of the login process even when timeout and
device response

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:05:56 +08:00
Jianhui Zhao d1703f44cd add pprof performance profiling support
Add --pprof command line option to enable performance profiling

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:05:39 +08:00
Jianhui Zhao 0ca0086bdd ui: handle WebSocket 403 unauthorized errors properly
When WebSocket connection fails due to 403 unauthorized status from server,
browser WebSocket API cannot distinguish HTTP status codes and only fires
a generic 'error' event. Redirect to /connect/:devid HTTP endpoint so that
browser can properly capture and handle the 403 status code response.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:05:17 +08:00
Jianhui Zhao 3842518da9 optimize the terminal login process via websocket close messages.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:04:49 +08:00
Jianhui Zhao 948e304984 ui: fix locales for Error.vue.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:04:31 +08:00
Jianhui Zhao 17599404f8 Add devid into the response of command execution #119
```
{"devid":"test","err":1,"msg":"operation not permitted"}
```

```
{"code":0,"devid":"test","stderr":"","stdout":"SGVsbG8sIFJ0dHkK"}
```

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:03:42 +08:00
Jianhui Zhao 98f3dbce02 add HTTP error responses to proxy connections
- Add sendHTTPErrorResponse function to send proper HTTP error pages
- Improve user experience by showing meaningful error pages instead of silent connection drops

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-16 17:02:15 +08:00
Jianhui Zhao 4f47087148 Remove unnecessary empty group parameter from redirect URLs
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-15 16:24:31 +08:00
Jianhui Zhao c98a09465f add downloads badge
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-15 09:29:17 +08:00
Jianhui Zhao d6c5d6a578 bump version 5.2.0
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 23:43:31 +08:00
Jianhui Zhao cf2f50eae8 ci: release assets
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 23:25:23 +08:00
Jianhui Zhao 6df295f324 ci: add build windows
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 23:16:12 +08:00
Jianhui Zhao 3a7df54e8b ci: do not run build.yml on push tag
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 23:14:58 +08:00
Jianhui Zhao 2179298bf7 fix build fail for windows.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 22:34:24 +08:00
Jianhui Zhao 7edc2ac18e add a script to create deb package.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 21:57:52 +08:00
Jianhui Zhao a50f99baf8 Improve configuration file documentation and clarity
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 18:07:04 +08:00
Jianhui Zhao 6c36d6d1c8 Add user hook URL support for API access validation
- Forward all original HTTP headers plus custom rttys headers:
  - X-Rttys-Hook: true
  - X-Original-Method: original request method
  - X-Original-URL: original request URL
- Hook must return HTTP 200 to allow API access.

This enables external services to validate and control user API access
by receiving the complete original request context through HTTP hooks.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-14 18:06:58 +08:00
Jianhui Zhao 346065a428 Use json.RawMessage for command response attrs
This fixes handling of error responses like `{"token":"token","attrs":{"err":1,"msg":"xx"}}`.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-13 19:57:56 +08:00
Jianhui Zhao 98023ee54d update README
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-11 15:32:04 +08:00
Jianhui Zhao c2caed9e9c bump version 5.1.0
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-10 10:25:43 +08:00
Jianhui Zhao e91b262a46 Add /counts API to get total device count
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-10 10:24:44 +08:00
Jianhui Zhao 35a1fe2913 ui: Implement direct paste functionality for terminal context menu
- Add pasteFromClipboard() method to enable direct clipboard paste
- Use Clipboard API with async/await for modern browser support
- Add fallback message for unsupported browsers or permission denied
- Add 'Pasted from clipboard' translations for English and Chinese
- Replace paste menu item action from showing instruction to actual paste

This allows users to paste content directly from the context menu instead
of requiring keyboard shortcuts, improving user experience.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-10 09:45:31 +08:00
Jianhui Zhao 313c13271a ui: Update clipboard copy message text
Simplify the copy success message from "Already copied to clipboard"

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-10 09:27:03 +08:00
Jianhui Zhao 7830a325f3 ui: Change message type from info to success in context menu actions
Replace $message.info() with $message.success() for copy, paste, and file
upload instructions in the terminal context menu to provide more positive
user feedback for these informational messages.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-10 09:18:57 +08:00
Jianhui Zhao 86abb34a47 bump version 5.0.0
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-07 12:21:49 +08:00
Jianhui Zhao a0bfc21d11 Refactor the message distribution process
To solve a major problem: when there are many devices connected,
the broker will blocked in processing messages.

By the way, I've rewritten and reorganized the entire code architecture,
improved performance.

Some new features has been added:
* support device grouping.
* support show device's IP address.

Change-Id: I250e18091be7fd42028c82767b6edef50b3f6d8f
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-07 12:21:36 +08:00
Jianhui Zhao ff6cbda736 remove unused conf dev-auth-url in rttys.conf
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-04 17:17:03 +08:00
Jianhui Zhao 86420d878f ui: remove tooltip for operation icon
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-04 11:44:59 +08:00
Jianhui Zhao 21c8e48baa Optimize the code for processing command requests
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-03 17:03:08 +08:00
Jianhui Zhao 8f2ae9d6c9 remove unused variable devCertPool in broker struct
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-02 17:28:45 +08:00
Jianhui Zhao af9eaa7cb4 api: Optimizing Static Resource Handling
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-02 12:54:43 +08:00
Jianhui Zhao c45c5bf5bd ui: Fix placeholder in RttyWeb.vue
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-02 09:12:12 +08:00
Jianhui Zhao cefd50c5f8 ui: fix locale
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-01 20:11:55 +08:00
Jianhui Zhao a68aa3c921 add support log panic while running in daemon mode.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-27 16:52:22 +08:00
Jianhui Zhao f43b71d1eb Adjust the code structure of main.go
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-26 20:41:10 +08:00
Jianhui Zhao 6749ca9e46 fix memleak in httpProxyCons
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-26 18:34:34 +08:00
Jianhui Zhao efb4c8a539 Remove built-in TLS support in favor of Nginx termination
This commit eliminates the native TLS implementation from rttys.
Going forward, TLS termination will be handled exclusively by
Nginx reverse proxy. Key changes include:

1. Removed all TLS-related configuration options
2. Deleted certificate handling and encryption logic
3. Simplified network stack to plain TCP only
4. Updated documentation to reflect new architecture

Rationale:
- Delegates TLS to specialized reverse proxy (Nginx)
- Improves security through separation of concerns
- Reduces attack surface of rttys core service
- Enables centralized certificate management
- Facilitates future scalability with proxy layer

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-26 15:07:01 +08:00
Jianhui Zhao 183aa31b2c ui: fix placeholder for web proxy
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-26 11:57:29 +08:00
Jianhui Zhao ef160cc70b ui: remove compositionOnly: false
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-25 22:17:29 +08:00