Browse Source

up readme

ljw 1 year ago
parent
commit
76cf35cdf0
2 changed files with 194 additions and 10 deletions
  1. 93 5
      README.md
  2. 101 5
      README_EN.md

+ 93 - 5
README.md

@@ -2,7 +2,7 @@
2 2
 
3 3
 [English Doc](README_EN.md)
4 4
 
5
-本项目使用 Go 实现了 RustDesk 的 API,并包含了 Web UI 和 Web 客户端。RustDesk 是一个远程桌面软件,提供了自托管的解决方案。
5
+本项目使用 Go 实现了 RustDesk 的 API,并包含了 Web Admin 和 Web 客户端。RustDesk 是一个远程桌面软件,提供了自托管的解决方案。
6 6
 
7 7
  <div align=center>
8 8
 <img src="https://img.shields.io/badge/golang-1.22-blue"/>
@@ -10,8 +10,30 @@
10 10
 <img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
11 11
 <img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
12 12
 <img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/release.yml/badge.svg"/>
13
+<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/docker.yml/badge.svg"/>
13 14
 </div>
14 15
 
16
+# 特性
17
+
18
+- PC端API
19
+    - 个人版API
20
+    - 登录
21
+    - 地址簿
22
+    - 群组
23
+    - 授权登录,支持`github`和`google`登录,支持`web后台`授权登录
24
+- Web Admin
25
+    - 用户管理
26
+    - 设备管理
27
+    - 地址簿管理
28
+    - 标签管理
29
+    - 群组管理
30
+    - Oauth 管理
31
+    - 快速使用web client
32
+- Web Client
33
+    - 自动获取API server
34
+    - 自动获取ID服务器和KEY
35
+    - 自动获取地址簿
36
+
15 37
 ## 使用前准备
16 38
 
17 39
 ### [Rustdesk](https://github.com/rustdesk/rustdesk)
@@ -33,7 +55,7 @@
33 55
 
34 56
 ## 功能
35 57
 
36
-### API 服务: 基本实现了PC端基础的接口。
58
+### API 服务: 基本实现了PC端基础的接口。支持Personal版本接口,可以通过配置文件`rustdesk.personal`或环境变量`RUSTDESK_PERSONAL`来控制是否启用
37 59
 
38 60
 #### 登录
39 61
 
@@ -50,7 +72,7 @@
50 72
 
51 73
 ![pc_gr](docs/pc_gr.png)
52 74
 
53
-### **Web UI**: 使用前后端分离,提供用户友好的管理界面,主要用来管理和展示。
75
+### **Web Admin**: 使用前后端分离,提供用户友好的管理界面,主要用来管理和展示。
54 76
 
55 77
 ***前端代码在[rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
56 78
 
@@ -119,7 +141,7 @@ rustdesk:
119 141
 * 环境变量,变量名前缀是RUSTDESK_API,环境变量如果存在将覆盖配置文件中的配置
120 142
 
121 143
 | 变量名                                 | 说明                                   | 示例                          |
122
-|:------------------------------------|:-------------------------------------|-----------------------------|
144
+|-------------------------------------|--------------------------------------|-----------------------------|
123 145
 | TZ                                  | 时区                                   | Asia/Shanghai               |
124 146
 | -----GIN配置-----                     | ----------                           | ----------                  |
125 147
 | RUSTDESK_API_GIN_TRUST_PROXY        | 信任的代理IP列表,以`,`分割,默认信任所有              | 192.168.1.2,192.168.1.3     |
@@ -128,7 +150,7 @@ rustdesk:
128 150
 | RUSTDESK_API_GORM_MAX_IDLE_CONNS    | 数据库最大空闲连接数                           | 10                          |
129 151
 | RUSTDESK_API_GORM_MAX_OPEN_CONNS    | 数据库最大打开连接数                           | 100                         |
130 152
 | RUSTDESK_PERSONAL                   | 是否启用个人版API, 1:启用,0:不启用; 默认启用         | 1                           |
131
-| -----MYSQL配置-----                   | -----数据库类型为sqlite时不用填-----           | ----------                  |
153
+| -----MYSQL配置-----                   | ----------                           | ----------                  |
132 154
 | RUSTDESK_API_MYSQL_USERNAME         | mysql用户名                             | root                        |
133 155
 | RUSTDESK_API_MYSQL_PASSWORD         | mysql密码                              | 111111                      |
134 156
 | RUSTDESK_API_MYSQL_ADDR             | mysql地址                              | 192.168.1.66:3306           |
@@ -242,6 +264,72 @@ lejianwen/rustdesk-api
242 264
    
243 265
    ```
244 266
 
267
+    - 如果使用的是S6的镜像,会需要修改启动脚本,覆盖镜像中的`/etc/s6-overlay/s6-rc.d/hbbr/run`
268
+      和`/etc/s6-overlay/s6-rc.d/hbbr/run`
269
+
270
+        1. 创建`hbbr/run`
271
+
272
+            ```bash
273
+            #!/command/with-contenv sh
274
+            cd /data
275
+            PARAMS=
276
+            [ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
277
+            /usr/bin/hbbr $PARAMS
278
+            ```
279
+
280
+        2. 创建`hbbs/run`
281
+            ```bash
282
+            #!/command/with-contenv sh
283
+            sleep 2
284
+            cd /data
285
+            PARAMS=
286
+            [ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
287
+            /usr/bin/hbbs -r $RELAY $PARAMS
288
+            ```
289
+        3. 修改`docker-compose.yml`中的`s6`部分
290
+
291
+            ```
292
+            networks:
293
+              rustdesk-net:
294
+                external: false
295
+            services:
296
+              rustdesk-server:
297
+                container_name: rustdesk-server
298
+                ports:
299
+                  - 21115:21115
300
+                  - 21116:21116
301
+                  - 21116:21116/udp
302
+                  - 21117:21117
303
+                  - 21118:21118
304
+                  - 21119:21119
305
+                image: rustdesk/rustdesk-server-s6:latest
306
+                environment:
307
+                  - RELAY=192.168.1.66:21117
308
+                  - ENCRYPTED_ONLY=1
309
+                  - KEY=abc123456789
310
+                volumes:
311
+                  - ./data:/data
312
+                  - ./hbbr/run:/etc/s6-overlay/s6-rc.d/hbbr/run
313
+                  - ./hbbs/run:/etc/s6-overlay/s6-rc.d/hbbs/run
314
+                restart: unless-stopped
315
+              rustdesk-api:
316
+                container_name: rustdesk-api
317
+                ports:
318
+                  - 21114:21114
319
+                image: lejianwen/rustdesk-api
320
+                environment:
321
+                  - TZ=Asia/Shanghai
322
+                  - RUSTDESK_API_RUSTDESK_ID_SERVER=192.168.1.66:21116
323
+                  - RUSTDESK_API_RUSTDESK_RELAY_SERVER=192.168.1.66:21117
324
+                  - RUSTDESK_API_RUSTDESK_API_SERVER=http://192.168.1.66:21114
325
+                  - RUSTDESK_API_RUSTDESK_KEY=abc123456789
326
+                volumes:
327
+                  - /data/rustdesk/api:/app/data #将数据库挂载
328
+                networks:
329
+                  - rustdesk-net
330
+                restart: unless-stopped
331
+            ```
332
+
245 333
 #### 下载release直接运行
246 334
 
247 335
 下载地址[release](https://github.com/lejianwen/rustdesk-api/releases)

+ 101 - 5
README_EN.md

@@ -8,8 +8,31 @@ desktop software that provides self-hosted solutions.
8 8
 <img src="https://img.shields.io/badge/gin-v1.9.0-lightBlue"/>
9 9
 <img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
10 10
 <img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
11
+<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/release.yml/badge.svg"/>
12
+<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/docker.yml/badge.svg"/>
11 13
 </div>
12 14
 
15
+# Features
16
+
17
+- PC API
18
+    - Personal API
19
+    - Login
20
+    - Address Book
21
+    - Groups
22
+    - Authorized login, supports `GitHub` and `Google` login, supports `web admin` authorized login
23
+- Web Admin
24
+    - User Management
25
+    - Device Management
26
+    - Address Book Management
27
+    - Tag Management
28
+    - Group Management
29
+    - OAuth Management
30
+    - Quick access to web client
31
+- Web Client
32
+    - Automatically obtain API server
33
+    - Automatically obtain ID server and KEY
34
+    - Automatically obtain address book
35
+
13 36
 ## Prerequisites
14 37
 
15 38
 ### [Rustdesk](https://github.com/rustdesk/rustdesk)
@@ -32,11 +55,12 @@ desktop software that provides self-hosted solutions.
32 55
 
33 56
 ## Features
34 57
 
35
-### API Service: Basic implementation of the PC client's primary interfaces.
58
+### API Service: Basic implementation of the PC client's primary interfaces.Supports the Personal version api, which can be enabled by configuring the `rustdesk.personal` file or the `RUSTDESK_PERSONAL` environment variable.
36 59
 
37 60
 #### Login
38 61
 
39
-- Added `GitHub` and `Google` login, which can be used after configuration in the admin panel. See the OAuth configuration section
62
+- Added `GitHub` and `Google` login, which can be used after configuration in the admin panel. See the OAuth
63
+  configuration section
40 64
   for details.
41 65
 - Added authorization login for the web admin panel.
42 66
 
@@ -50,7 +74,10 @@ desktop software that provides self-hosted solutions.
50 74
 
51 75
 ![pc_gr](docs/pc_gr.png)
52 76
 
53
-### **Web UI**: The frontend and backend are separated to provide a user-friendly management interface, primarily for managing and displaying data.
77
+### **Web UI
78
+
79
+**: The frontend and backend are separated to provide a user-friendly management interface, primarily for managing and
80
+displaying data.
54 81
 
55 82
 ***Frontend code is available at [rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
56 83
 
@@ -67,7 +94,8 @@ installation are `admin` `admin`, please change the password immediately.***
67 94
    ![web_admin_gr](docs/web_admin_gr.png)
68 95
 5. You can open the web client directly for convenience:
69 96
    ![web_webclient](docs/admin_webclient.png)
70
-6. OAuth support: Currently, `GitHub` and `Google`  is supported. You need to create an `OAuth App` and configure it in the admin
97
+6. OAuth support: Currently, `GitHub` and `Google`  is supported. You need to create an `OAuth App` and configure it in
98
+   the admin
71 99
    panel.
72 100
    ![web_admin_oauth](docs/web_admin_oauth.png)
73 101
     - Create a `GitHub OAuth App`
@@ -84,7 +112,9 @@ installation are `admin` `admin`, please change the password immediately.***
84 112
 3. After logging in, the ID server and key will be automatically synced.
85 113
 4. The address book will also be automatically saved to the web client for convenient use.
86 114
 
87
-### **Automated Documentation** : API documentation is generated using Swag, making it easier for developers to understand and use the API.
115
+### **Automated Documentation
116
+
117
+** : API documentation is generated using Swag, making it easier for developers to understand and use the API.
88 118
 
89 119
 1. Admin panel docs: `<your server>/admin/swagger/index.html`
90 120
 2. PC client docs: `<your server>/swagger/index.html`
@@ -125,11 +155,13 @@ rustdesk:
125 155
 | Variable Name                      | Description                                               | Example                        |
126 156
 |------------------------------------|-----------------------------------------------------------|--------------------------------|
127 157
 | ----- GIN Configuration -----      | ---------------------------------------                   | ------------------------------ |
158
+| TZ                                 | 时区                                                        | Asia/Shanghai                  |
128 159
 | RUSTDESK_API_GIN_TRUST_PROXY       | Trusted proxy IPs, separated by commas.                   | 192.168.1.2,192.168.1.3        |
129 160
 | ----- GORM Configuration -----     | ---------------------------------------                   | ------------------------------ |
130 161
 | RUSTDESK_API_GORM_TYPE             | Database type (`sqlite` or `mysql`). Default is `sqlite`. | sqlite                         |
131 162
 | RUSTDESK_API_GORM_MAX_IDLE_CONNS   | Maximum idle connections                                  | 10                             |
132 163
 | RUSTDESK_API_GORM_MAX_OPEN_CONNS   | Maximum open connections                                  | 100                            |
164
+| RUSTDESK_PERSONAL                  | Open Personal Api 1:Enable,0:Disable                      | 1                              |
133 165
 | ----- MYSQL Configuration -----    | ---------------------------------------                   | ------------------------------ |
134 166
 | RUSTDESK_API_MYSQL_USERNAME        | MySQL username                                            | root                           |
135 167
 | RUSTDESK_API_MYSQL_PASSWORD        | MySQL password                                            | 111111                         |
@@ -241,6 +273,70 @@ lejianwen/rustdesk-api
241 273
        restart: unless-stopped
242 274
    
243 275
    ```
276
+    - If you are using an S6 image, you need to modify the startup script `/etc/s6-overlay/s6-rc.d/hbbr/run`
277
+      and `/etc/s6-overlay/s6-rc.d/hbbr/run`
278
+
279
+        1. create `hbbr/run`
280
+
281
+            ```bash
282
+            #!/command/with-contenv sh
283
+            cd /data
284
+            PARAMS=
285
+            [ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
286
+            /usr/bin/hbbr $PARAMS
287
+            ```
288
+
289
+        2. create `hbbs/run`
290
+            ```bash
291
+            #!/command/with-contenv sh
292
+            sleep 2
293
+            cd /data
294
+            PARAMS=
295
+            [ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
296
+            /usr/bin/hbbs -r $RELAY $PARAMS
297
+            ```
298
+        3. edit `docker-compose.yml`
299
+            ```
300
+            networks:
301
+              rustdesk-net:
302
+                external: false
303
+            services:
304
+              rustdesk-server:
305
+                container_name: rustdesk-server
306
+                ports:
307
+                  - 21115:21115
308
+                  - 21116:21116
309
+                  - 21116:21116/udp
310
+                  - 21117:21117
311
+                  - 21118:21118
312
+                  - 21119:21119
313
+                image: rustdesk/rustdesk-server-s6:latest
314
+                environment:
315
+                  - RELAY=192.168.1.66:21117
316
+                  - ENCRYPTED_ONLY=1
317
+                  - KEY=abc123456789
318
+                volumes:
319
+                  - ./data:/data
320
+                  - ./hbbr/run:/etc/s6-overlay/s6-rc.d/hbbr/run
321
+                  - ./hbbs/run:/etc/s6-overlay/s6-rc.d/hbbs/run
322
+                restart: unless-stopped
323
+              rustdesk-api:
324
+                container_name: rustdesk-api
325
+                ports:
326
+                  - 21114:21114
327
+                image: lejianwen/rustdesk-api
328
+                environment:
329
+                  - TZ=Asia/Shanghai
330
+                  - RUSTDESK_API_RUSTDESK_ID_SERVER=192.168.1.66:21116
331
+                  - RUSTDESK_API_RUSTDESK_RELAY_SERVER=192.168.1.66:21117
332
+                  - RUSTDESK_API_RUSTDESK_API_SERVER=http://192.168.1.66:21114
333
+                  - RUSTDESK_API_RUSTDESK_KEY=abc123456789
334
+                volumes:
335
+                  - /data/rustdesk/api:/app/data #将数据库挂载
336
+                networks:
337
+                  - rustdesk-net
338
+                restart: unless-stopped
339
+            ```
244 340
 
245 341
 #### Running from Release
246 342