up readme
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[English Doc](README_EN.md)
|
[English Doc](README_EN.md)
|
||||||
|
|
||||||
本项目使用 Go 实现了 RustDesk 的 API,并包含了 Web UI 和 Web 客户端。RustDesk 是一个远程桌面软件,提供了自托管的解决方案。
|
本项目使用 Go 实现了 RustDesk 的 API,并包含了 Web Admin 和 Web 客户端。RustDesk 是一个远程桌面软件,提供了自托管的解决方案。
|
||||||
|
|
||||||
<div align=center>
|
<div align=center>
|
||||||
<img src="https://img.shields.io/badge/golang-1.22-blue"/>
|
<img src="https://img.shields.io/badge/golang-1.22-blue"/>
|
||||||
@@ -10,8 +10,30 @@
|
|||||||
<img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
|
<img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
|
||||||
<img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
|
<img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
|
||||||
<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/release.yml/badge.svg"/>
|
<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/release.yml/badge.svg"/>
|
||||||
|
<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/docker.yml/badge.svg"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
# 特性
|
||||||
|
|
||||||
|
- PC端API
|
||||||
|
- 个人版API
|
||||||
|
- 登录
|
||||||
|
- 地址簿
|
||||||
|
- 群组
|
||||||
|
- 授权登录,支持`github`和`google`登录,支持`web后台`授权登录
|
||||||
|
- Web Admin
|
||||||
|
- 用户管理
|
||||||
|
- 设备管理
|
||||||
|
- 地址簿管理
|
||||||
|
- 标签管理
|
||||||
|
- 群组管理
|
||||||
|
- Oauth 管理
|
||||||
|
- 快速使用web client
|
||||||
|
- Web Client
|
||||||
|
- 自动获取API server
|
||||||
|
- 自动获取ID服务器和KEY
|
||||||
|
- 自动获取地址簿
|
||||||
|
|
||||||
## 使用前准备
|
## 使用前准备
|
||||||
|
|
||||||
### [Rustdesk](https://github.com/rustdesk/rustdesk)
|
### [Rustdesk](https://github.com/rustdesk/rustdesk)
|
||||||
@@ -33,7 +55,7 @@
|
|||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
### API 服务: 基本实现了PC端基础的接口。
|
### API 服务: 基本实现了PC端基础的接口。支持Personal版本接口,可以通过配置文件`rustdesk.personal`或环境变量`RUSTDESK_PERSONAL`来控制是否启用
|
||||||
|
|
||||||
#### 登录
|
#### 登录
|
||||||
|
|
||||||
@@ -50,7 +72,7 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### **Web UI**: 使用前后端分离,提供用户友好的管理界面,主要用来管理和展示。
|
### **Web Admin**: 使用前后端分离,提供用户友好的管理界面,主要用来管理和展示。
|
||||||
|
|
||||||
***前端代码在[rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
|
***前端代码在[rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
|
||||||
|
|
||||||
@@ -119,7 +141,7 @@ rustdesk:
|
|||||||
* 环境变量,变量名前缀是RUSTDESK_API,环境变量如果存在将覆盖配置文件中的配置
|
* 环境变量,变量名前缀是RUSTDESK_API,环境变量如果存在将覆盖配置文件中的配置
|
||||||
|
|
||||||
| 变量名 | 说明 | 示例 |
|
| 变量名 | 说明 | 示例 |
|
||||||
|:------------------------------------|:-------------------------------------|-----------------------------|
|
|-------------------------------------|--------------------------------------|-----------------------------|
|
||||||
| TZ | 时区 | Asia/Shanghai |
|
| TZ | 时区 | Asia/Shanghai |
|
||||||
| -----GIN配置----- | ---------- | ---------- |
|
| -----GIN配置----- | ---------- | ---------- |
|
||||||
| RUSTDESK_API_GIN_TRUST_PROXY | 信任的代理IP列表,以`,`分割,默认信任所有 | 192.168.1.2,192.168.1.3 |
|
| RUSTDESK_API_GIN_TRUST_PROXY | 信任的代理IP列表,以`,`分割,默认信任所有 | 192.168.1.2,192.168.1.3 |
|
||||||
@@ -128,7 +150,7 @@ rustdesk:
|
|||||||
| RUSTDESK_API_GORM_MAX_IDLE_CONNS | 数据库最大空闲连接数 | 10 |
|
| RUSTDESK_API_GORM_MAX_IDLE_CONNS | 数据库最大空闲连接数 | 10 |
|
||||||
| RUSTDESK_API_GORM_MAX_OPEN_CONNS | 数据库最大打开连接数 | 100 |
|
| RUSTDESK_API_GORM_MAX_OPEN_CONNS | 数据库最大打开连接数 | 100 |
|
||||||
| RUSTDESK_PERSONAL | 是否启用个人版API, 1:启用,0:不启用; 默认启用 | 1 |
|
| RUSTDESK_PERSONAL | 是否启用个人版API, 1:启用,0:不启用; 默认启用 | 1 |
|
||||||
| -----MYSQL配置----- | -----数据库类型为sqlite时不用填----- | ---------- |
|
| -----MYSQL配置----- | ---------- | ---------- |
|
||||||
| RUSTDESK_API_MYSQL_USERNAME | mysql用户名 | root |
|
| RUSTDESK_API_MYSQL_USERNAME | mysql用户名 | root |
|
||||||
| RUSTDESK_API_MYSQL_PASSWORD | mysql密码 | 111111 |
|
| RUSTDESK_API_MYSQL_PASSWORD | mysql密码 | 111111 |
|
||||||
| RUSTDESK_API_MYSQL_ADDR | mysql地址 | 192.168.1.66:3306 |
|
| RUSTDESK_API_MYSQL_ADDR | mysql地址 | 192.168.1.66:3306 |
|
||||||
@@ -242,6 +264,72 @@ lejianwen/rustdesk-api
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- 如果使用的是S6的镜像,会需要修改启动脚本,覆盖镜像中的`/etc/s6-overlay/s6-rc.d/hbbr/run`
|
||||||
|
和`/etc/s6-overlay/s6-rc.d/hbbr/run`
|
||||||
|
|
||||||
|
1. 创建`hbbr/run`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/command/with-contenv sh
|
||||||
|
cd /data
|
||||||
|
PARAMS=
|
||||||
|
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
|
||||||
|
/usr/bin/hbbr $PARAMS
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 创建`hbbs/run`
|
||||||
|
```bash
|
||||||
|
#!/command/with-contenv sh
|
||||||
|
sleep 2
|
||||||
|
cd /data
|
||||||
|
PARAMS=
|
||||||
|
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
|
||||||
|
/usr/bin/hbbs -r $RELAY $PARAMS
|
||||||
|
```
|
||||||
|
3. 修改`docker-compose.yml`中的`s6`部分
|
||||||
|
|
||||||
|
```
|
||||||
|
networks:
|
||||||
|
rustdesk-net:
|
||||||
|
external: false
|
||||||
|
services:
|
||||||
|
rustdesk-server:
|
||||||
|
container_name: rustdesk-server
|
||||||
|
ports:
|
||||||
|
- 21115:21115
|
||||||
|
- 21116:21116
|
||||||
|
- 21116:21116/udp
|
||||||
|
- 21117:21117
|
||||||
|
- 21118:21118
|
||||||
|
- 21119:21119
|
||||||
|
image: rustdesk/rustdesk-server-s6:latest
|
||||||
|
environment:
|
||||||
|
- RELAY=192.168.1.66:21117
|
||||||
|
- ENCRYPTED_ONLY=1
|
||||||
|
- KEY=abc123456789
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./hbbr/run:/etc/s6-overlay/s6-rc.d/hbbr/run
|
||||||
|
- ./hbbs/run:/etc/s6-overlay/s6-rc.d/hbbs/run
|
||||||
|
restart: unless-stopped
|
||||||
|
rustdesk-api:
|
||||||
|
container_name: rustdesk-api
|
||||||
|
ports:
|
||||||
|
- 21114:21114
|
||||||
|
image: lejianwen/rustdesk-api
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
- RUSTDESK_API_RUSTDESK_ID_SERVER=192.168.1.66:21116
|
||||||
|
- RUSTDESK_API_RUSTDESK_RELAY_SERVER=192.168.1.66:21117
|
||||||
|
- RUSTDESK_API_RUSTDESK_API_SERVER=http://192.168.1.66:21114
|
||||||
|
- RUSTDESK_API_RUSTDESK_KEY=abc123456789
|
||||||
|
volumes:
|
||||||
|
- /data/rustdesk/api:/app/data #将数据库挂载
|
||||||
|
networks:
|
||||||
|
- rustdesk-net
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
#### 下载release直接运行
|
#### 下载release直接运行
|
||||||
|
|
||||||
下载地址[release](https://github.com/lejianwen/rustdesk-api/releases)
|
下载地址[release](https://github.com/lejianwen/rustdesk-api/releases)
|
||||||
|
|||||||
+101
-5
@@ -8,8 +8,31 @@ desktop software that provides self-hosted solutions.
|
|||||||
<img src="https://img.shields.io/badge/gin-v1.9.0-lightBlue"/>
|
<img src="https://img.shields.io/badge/gin-v1.9.0-lightBlue"/>
|
||||||
<img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
|
<img src="https://img.shields.io/badge/gorm-v1.25.7-green"/>
|
||||||
<img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
|
<img src="https://img.shields.io/badge/swag-v1.16.3-yellow"/>
|
||||||
|
<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/release.yml/badge.svg"/>
|
||||||
|
<img src="https://github.com/lejianwen/rustdesk-api/actions/workflows/docker.yml/badge.svg"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
# Features
|
||||||
|
|
||||||
|
- PC API
|
||||||
|
- Personal API
|
||||||
|
- Login
|
||||||
|
- Address Book
|
||||||
|
- Groups
|
||||||
|
- Authorized login, supports `GitHub` and `Google` login, supports `web admin` authorized login
|
||||||
|
- Web Admin
|
||||||
|
- User Management
|
||||||
|
- Device Management
|
||||||
|
- Address Book Management
|
||||||
|
- Tag Management
|
||||||
|
- Group Management
|
||||||
|
- OAuth Management
|
||||||
|
- Quick access to web client
|
||||||
|
- Web Client
|
||||||
|
- Automatically obtain API server
|
||||||
|
- Automatically obtain ID server and KEY
|
||||||
|
- Automatically obtain address book
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
### [Rustdesk](https://github.com/rustdesk/rustdesk)
|
### [Rustdesk](https://github.com/rustdesk/rustdesk)
|
||||||
@@ -32,11 +55,12 @@ desktop software that provides self-hosted solutions.
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### API Service: Basic implementation of the PC client's primary interfaces.
|
### 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.
|
||||||
|
|
||||||
#### Login
|
#### Login
|
||||||
|
|
||||||
- Added `GitHub` and `Google` login, which can be used after configuration in the admin panel. See the OAuth configuration section
|
- Added `GitHub` and `Google` login, which can be used after configuration in the admin panel. See the OAuth
|
||||||
|
configuration section
|
||||||
for details.
|
for details.
|
||||||
- Added authorization login for the web admin panel.
|
- Added authorization login for the web admin panel.
|
||||||
|
|
||||||
@@ -50,7 +74,10 @@ desktop software that provides self-hosted solutions.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### **Web UI**: The frontend and backend are separated to provide a user-friendly management interface, primarily for managing and displaying data.
|
### **Web UI
|
||||||
|
|
||||||
|
**: The frontend and backend are separated to provide a user-friendly management interface, primarily for managing and
|
||||||
|
displaying data.
|
||||||
|
|
||||||
***Frontend code is available at [rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
|
***Frontend code is available at [rustdesk-api-web](https://github.com/lejianwen/rustdesk-api-web)***
|
||||||
|
|
||||||
@@ -67,7 +94,8 @@ installation are `admin` `admin`, please change the password immediately.***
|
|||||||

|

|
||||||
5. You can open the web client directly for convenience:
|
5. You can open the web client directly for convenience:
|
||||||

|

|
||||||
6. OAuth support: Currently, `GitHub` and `Google` is supported. You need to create an `OAuth App` and configure it in the admin
|
6. OAuth support: Currently, `GitHub` and `Google` is supported. You need to create an `OAuth App` and configure it in
|
||||||
|
the admin
|
||||||
panel.
|
panel.
|
||||||

|

|
||||||
- Create a `GitHub OAuth App`
|
- Create a `GitHub OAuth App`
|
||||||
@@ -84,7 +112,9 @@ installation are `admin` `admin`, please change the password immediately.***
|
|||||||
3. After logging in, the ID server and key will be automatically synced.
|
3. After logging in, the ID server and key will be automatically synced.
|
||||||
4. The address book will also be automatically saved to the web client for convenient use.
|
4. The address book will also be automatically saved to the web client for convenient use.
|
||||||
|
|
||||||
### **Automated Documentation** : API documentation is generated using Swag, making it easier for developers to understand and use the API.
|
### **Automated Documentation
|
||||||
|
|
||||||
|
** : API documentation is generated using Swag, making it easier for developers to understand and use the API.
|
||||||
|
|
||||||
1. Admin panel docs: `<your server>/admin/swagger/index.html`
|
1. Admin panel docs: `<your server>/admin/swagger/index.html`
|
||||||
2. PC client docs: `<your server>/swagger/index.html`
|
2. PC client docs: `<your server>/swagger/index.html`
|
||||||
@@ -125,11 +155,13 @@ rustdesk:
|
|||||||
| Variable Name | Description | Example |
|
| Variable Name | Description | Example |
|
||||||
|------------------------------------|-----------------------------------------------------------|--------------------------------|
|
|------------------------------------|-----------------------------------------------------------|--------------------------------|
|
||||||
| ----- GIN Configuration ----- | --------------------------------------- | ------------------------------ |
|
| ----- GIN Configuration ----- | --------------------------------------- | ------------------------------ |
|
||||||
|
| TZ | 时区 | Asia/Shanghai |
|
||||||
| RUSTDESK_API_GIN_TRUST_PROXY | Trusted proxy IPs, separated by commas. | 192.168.1.2,192.168.1.3 |
|
| RUSTDESK_API_GIN_TRUST_PROXY | Trusted proxy IPs, separated by commas. | 192.168.1.2,192.168.1.3 |
|
||||||
| ----- GORM Configuration ----- | --------------------------------------- | ------------------------------ |
|
| ----- GORM Configuration ----- | --------------------------------------- | ------------------------------ |
|
||||||
| RUSTDESK_API_GORM_TYPE | Database type (`sqlite` or `mysql`). Default is `sqlite`. | sqlite |
|
| RUSTDESK_API_GORM_TYPE | Database type (`sqlite` or `mysql`). Default is `sqlite`. | sqlite |
|
||||||
| RUSTDESK_API_GORM_MAX_IDLE_CONNS | Maximum idle connections | 10 |
|
| RUSTDESK_API_GORM_MAX_IDLE_CONNS | Maximum idle connections | 10 |
|
||||||
| RUSTDESK_API_GORM_MAX_OPEN_CONNS | Maximum open connections | 100 |
|
| RUSTDESK_API_GORM_MAX_OPEN_CONNS | Maximum open connections | 100 |
|
||||||
|
| RUSTDESK_PERSONAL | Open Personal Api 1:Enable,0:Disable | 1 |
|
||||||
| ----- MYSQL Configuration ----- | --------------------------------------- | ------------------------------ |
|
| ----- MYSQL Configuration ----- | --------------------------------------- | ------------------------------ |
|
||||||
| RUSTDESK_API_MYSQL_USERNAME | MySQL username | root |
|
| RUSTDESK_API_MYSQL_USERNAME | MySQL username | root |
|
||||||
| RUSTDESK_API_MYSQL_PASSWORD | MySQL password | 111111 |
|
| RUSTDESK_API_MYSQL_PASSWORD | MySQL password | 111111 |
|
||||||
@@ -241,6 +273,70 @@ lejianwen/rustdesk-api
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
```
|
```
|
||||||
|
- If you are using an S6 image, you need to modify the startup script `/etc/s6-overlay/s6-rc.d/hbbr/run`
|
||||||
|
and `/etc/s6-overlay/s6-rc.d/hbbr/run`
|
||||||
|
|
||||||
|
1. create `hbbr/run`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/command/with-contenv sh
|
||||||
|
cd /data
|
||||||
|
PARAMS=
|
||||||
|
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
|
||||||
|
/usr/bin/hbbr $PARAMS
|
||||||
|
```
|
||||||
|
|
||||||
|
2. create `hbbs/run`
|
||||||
|
```bash
|
||||||
|
#!/command/with-contenv sh
|
||||||
|
sleep 2
|
||||||
|
cd /data
|
||||||
|
PARAMS=
|
||||||
|
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
|
||||||
|
/usr/bin/hbbs -r $RELAY $PARAMS
|
||||||
|
```
|
||||||
|
3. edit `docker-compose.yml`
|
||||||
|
```
|
||||||
|
networks:
|
||||||
|
rustdesk-net:
|
||||||
|
external: false
|
||||||
|
services:
|
||||||
|
rustdesk-server:
|
||||||
|
container_name: rustdesk-server
|
||||||
|
ports:
|
||||||
|
- 21115:21115
|
||||||
|
- 21116:21116
|
||||||
|
- 21116:21116/udp
|
||||||
|
- 21117:21117
|
||||||
|
- 21118:21118
|
||||||
|
- 21119:21119
|
||||||
|
image: rustdesk/rustdesk-server-s6:latest
|
||||||
|
environment:
|
||||||
|
- RELAY=192.168.1.66:21117
|
||||||
|
- ENCRYPTED_ONLY=1
|
||||||
|
- KEY=abc123456789
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./hbbr/run:/etc/s6-overlay/s6-rc.d/hbbr/run
|
||||||
|
- ./hbbs/run:/etc/s6-overlay/s6-rc.d/hbbs/run
|
||||||
|
restart: unless-stopped
|
||||||
|
rustdesk-api:
|
||||||
|
container_name: rustdesk-api
|
||||||
|
ports:
|
||||||
|
- 21114:21114
|
||||||
|
image: lejianwen/rustdesk-api
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
- RUSTDESK_API_RUSTDESK_ID_SERVER=192.168.1.66:21116
|
||||||
|
- RUSTDESK_API_RUSTDESK_RELAY_SERVER=192.168.1.66:21117
|
||||||
|
- RUSTDESK_API_RUSTDESK_API_SERVER=http://192.168.1.66:21114
|
||||||
|
- RUSTDESK_API_RUSTDESK_KEY=abc123456789
|
||||||
|
volumes:
|
||||||
|
- /data/rustdesk/api:/app/data #将数据库挂载
|
||||||
|
networks:
|
||||||
|
- rustdesk-net
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
#### Running from Release
|
#### Running from Release
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user