Commit Graph

31 Commits

Author SHA1 Message Date
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
21db9f8528 use SPDX-License-Identifier
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-08-08 19:56:51 +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
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
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
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
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
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
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
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
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
af9eaa7cb4 api: Optimizing Static Resource Handling
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-07-02 12:54:43 +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
8f2cf21dfb fix: Fix func GenUniqueID
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-17 22:39:17 +08:00
Jianhui Zhao
a23267dd53 feat: Add option allow-origins
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-15 15:37:16 +08:00
Jianhui Zhao
a6ae0322a6 feat: add an api /dev/:devid to get one device
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-15 15:37:16 +08:00
Jianhui Zhao
41723aca41 perf: Optimize HTTP session management
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-15 15:37:16 +08:00
Jianhui Zhao
ab87db1f7d refactor: Remove device white list support
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-11 10:37:11 +08:00
Jianhui Zhao
b1e592f1fa refactor: Remove database support
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-11 09:54:35 +08:00
Jianhui Zhao
6e896cac2b refactor: Remove multi user support
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-11 09:37:53 +08:00
Jianhui Zhao
6a4b0a650c refactor: Remove the fontsize API
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-06-10 20:05:14 +08:00
Jianhui Zhao
bb112787d0 fix: prevent concurrent map access with sync.Map
```
fatal error: concurrent map read and map write
```

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2025-05-28 14:08:37 +08:00
Jianhui Zhao
91f6e74116 feat(ui): add an error page to show error message.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2024-12-16 15:26:17 +08:00
Jianhui Zhao
0e1fdf10a6 fix: Fix local-auth for api /connect/:devid
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2024-12-13 15:16:53 +08:00
Jianhui Zhao
dee7677e1e fix: Fix access permission
Fix an issue that users can access unbound devices by
entering the url directly.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2024-11-23 21:42:54 +08:00
Fu Jianrong
64cb5a494b feat: Add functionality to disable new sign up in config file (#164) 2024-11-22 13:03:41 +08:00
Fu Jianrong
b7a8f0b831 Separate SSL Configurations for Device and User (#163)
* feat: Separate SSL configurations for device and web UI

* config: Add configuration template
 for web UI SSL

* fix: parse bool

* fix: fix compatibility with old configuration files

* config: update template
2024-11-22 09:14:20 +08:00
Jianhui Zhao
58c29ec208 feat: https proxy compatible old rtty
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2022-09-25 17:08:13 +08:00
Jianhui Zhao
06695ba338 feat: support https proxy
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2022-07-31 15:22:28 +08:00
Jianhui Zhao
9141dd3ab3 perf: Write file data to local while transferring
Before, the download was started after all file data were sent from the device to the browser.
Now, the download starts when the file data begins to transfer.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2021-09-19 03:27:32 +08:00
Jianhui Zhao
e26337f3ea chore: improve code
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2021-09-16 11:53:15 +00:00