mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2026-02-07 23:00:36 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b66fc3c06d | ||
|
|
ab2e1a9236 | ||
|
|
ab77b400a1 | ||
|
|
eb7ab63563 | ||
|
|
4cf7d01622 |
45
README.md
45
README.md
@@ -49,21 +49,22 @@
|
|||||||
### API 服务
|
### API 服务
|
||||||
基本实现了PC端基础的接口。支持Personal版本接口,可以通过配置文件`rustdesk.personal`或环境变量`RUSTDESK_API_RUSTDESK_PERSONAL`来控制是否启用
|
基本实现了PC端基础的接口。支持Personal版本接口,可以通过配置文件`rustdesk.personal`或环境变量`RUSTDESK_API_RUSTDESK_PERSONAL`来控制是否启用
|
||||||
|
|
||||||
#### 登录
|
<table>
|
||||||
|
<tr>
|
||||||
- 添加了`github`, `google` 以及`OIDC`授权登录,需要在后台配置好就可以用了,具体可看后台OAuth配置
|
<td width="50%" align="center" colspan="2"><b>登录</b></td>
|
||||||
- 添加了web后台授权登录,点击后直接登录后台就自动登录客户端了
|
</tr>
|
||||||
|
<tr>
|
||||||

|
<td width="50%" align="center" colspan="2"><img src="docs/pc_login.png"></td>
|
||||||
|
</tr>
|
||||||
#### 地址簿
|
<tr>
|
||||||
|
<td width="50%" align="center"><b>地址簿</b></td>
|
||||||

|
<td width="50%" align="center"><b>群组</b></td>
|
||||||
|
</tr>
|
||||||
#### 群组
|
<tr>
|
||||||
群组分为`共享组`和`普通组`,共享组中所有人都能看到小组成员的设备,普通组只有管理员能看到所有小组成员的设备
|
<td width="50%" align="center"><img src="docs/pc_ab.png"></td>
|
||||||
|
<td width="50%" align="center"><img src="docs/pc_gr.png"></td>
|
||||||

|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
### Web Admin:
|
### Web Admin:
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@
|
|||||||

|

|
||||||
2. 普通用户界面
|
2. 普通用户界面
|
||||||

|

|
||||||
|
|
||||||
右上角可以更改密码,可以切换语言,可以切换`白天/黑夜`模式
|
右上角可以更改密码,可以切换语言,可以切换`白天/黑夜`模式
|
||||||
|
|
||||||

|

|
||||||
@@ -330,4 +332,15 @@ jwt:
|
|||||||
- [WIKI](https://github.com/lejianwen/rustdesk-api/wiki)
|
- [WIKI](https://github.com/lejianwen/rustdesk-api/wiki)
|
||||||
- [链接超时问题](https://github.com/lejianwen/rustdesk-api/issues/92)
|
- [链接超时问题](https://github.com/lejianwen/rustdesk-api/issues/92)
|
||||||
- [修改客户端ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
- [修改客户端ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
||||||
- [webclient来源](https://hub.docker.com/r/keyurbhole/flutter_web_desk)
|
- [webclient来源](https://hub.docker.com/r/keyurbhole/flutter_web_desk)
|
||||||
|
|
||||||
|
|
||||||
|
## 鸣谢
|
||||||
|
|
||||||
|
感谢所有做过贡献的人!
|
||||||
|
|
||||||
|
<a href="https://github.com/lejianwen/rustdesk-api/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=lejianwen/rustdesk-api" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
42
README_EN.md
42
README_EN.md
@@ -47,22 +47,22 @@ desktop software that provides self-hosted solutions.
|
|||||||
### API Service
|
### 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_API_RUSTDESK_PERSONAL` environment variable.
|
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_API_RUSTDESK_PERSONAL` environment variable.
|
||||||
|
|
||||||
#### Login
|
<table>
|
||||||
|
<tr>
|
||||||
- Added `GitHub`, `Google` and `OIDC` login, which can be used after configuration in the admin panel. See the OAuth
|
<td width="50%" align="center" colspan="2"><b>Login</b></td>
|
||||||
configuration section for details.
|
</tr>
|
||||||
- Added authorization login for the web admin panel.
|
<tr>
|
||||||
|
<td width="50%" align="center" colspan="2"><img src="docs/en_img/pc_login.png"></td>
|
||||||

|
</tr>
|
||||||
|
<tr>
|
||||||
#### Address Book
|
<td width="50%" align="center"><b>Address Book</b></td>
|
||||||
|
<td width="50%" align="center"><b>Groups</b></td>
|
||||||

|
</tr>
|
||||||
|
<tr>
|
||||||
#### Groups
|
<td width="50%" align="center"><img src="docs/en_img/pc_ab.png"></td>
|
||||||
Groups are divided into `shared groups` and `regular groups`. In shared groups, everyone can see the peers of all group members, while in regular groups, only administrators can see all members' peers.
|
<td width="50%" align="center"><img src="docs/en_img/pc_gr.png"></td>
|
||||||
|
</tr>
|
||||||

|
</table>
|
||||||
|
|
||||||
### Web Admin
|
### Web Admin
|
||||||
|
|
||||||
@@ -334,4 +334,12 @@ Download the release from [release](https://github.com/lejianwen/rustdesk-api/re
|
|||||||
- [WIKI](https://github.com/lejianwen/rustdesk-api/wiki)
|
- [WIKI](https://github.com/lejianwen/rustdesk-api/wiki)
|
||||||
- [Connection Timeout](https://github.com/lejianwen/rustdesk-api/issues/92)
|
- [Connection Timeout](https://github.com/lejianwen/rustdesk-api/issues/92)
|
||||||
- [Change client ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
- [Change client ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
||||||
- [Web client source](https://hub.docker.com/r/keyurbhole/flutter_web_desk)
|
- [Web client source](https://hub.docker.com/r/keyurbhole/flutter_web_desk)
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
Thanks to everyone who contributed!
|
||||||
|
|
||||||
|
<a href="https://github.com/lejianwen/rustdesk-api/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=lejianwen/rustdesk-api" />
|
||||||
|
</a>
|
||||||
|
|||||||
@@ -4,18 +4,19 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/go-playground/locales/en"
|
"github.com/go-playground/locales/en"
|
||||||
"github.com/go-playground/locales/es"
|
"github.com/go-playground/locales/es"
|
||||||
|
"github.com/go-playground/locales/fr"
|
||||||
"github.com/go-playground/locales/ko"
|
"github.com/go-playground/locales/ko"
|
||||||
"github.com/go-playground/locales/ru"
|
"github.com/go-playground/locales/ru"
|
||||||
"github.com/go-playground/locales/fr"
|
|
||||||
"github.com/go-playground/locales/zh_Hans_CN"
|
"github.com/go-playground/locales/zh_Hans_CN"
|
||||||
|
"github.com/go-playground/locales/zh_Hant"
|
||||||
ut "github.com/go-playground/universal-translator"
|
ut "github.com/go-playground/universal-translator"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
en_translations "github.com/go-playground/validator/v10/translations/en"
|
en_translations "github.com/go-playground/validator/v10/translations/en"
|
||||||
es_translations "github.com/go-playground/validator/v10/translations/es"
|
es_translations "github.com/go-playground/validator/v10/translations/es"
|
||||||
|
fr_translations "github.com/go-playground/validator/v10/translations/fr"
|
||||||
ru_translations "github.com/go-playground/validator/v10/translations/ru"
|
ru_translations "github.com/go-playground/validator/v10/translations/ru"
|
||||||
zh_translations "github.com/go-playground/validator/v10/translations/zh"
|
zh_translations "github.com/go-playground/validator/v10/translations/zh"
|
||||||
fr_translations "github.com/go-playground/validator/v10/translations/fr"
|
zh_tw_translations "github.com/go-playground/validator/v10/translations/zh_tw"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,8 +30,9 @@ func ApiInitValidator() {
|
|||||||
ruT := ru.New()
|
ruT := ru.New()
|
||||||
esT := es.New()
|
esT := es.New()
|
||||||
frT := fr.New()
|
frT := fr.New()
|
||||||
|
zhTwT := zh_Hant.New()
|
||||||
|
|
||||||
uni := ut.New(enT, cn, koT, ruT, esT, frT)
|
uni := ut.New(enT, cn, koT, ruT, esT, frT, zhTwT)
|
||||||
|
|
||||||
enTrans, _ := uni.GetTranslator("en")
|
enTrans, _ := uni.GetTranslator("en")
|
||||||
zhTrans, _ := uni.GetTranslator("zh_Hans_CN")
|
zhTrans, _ := uni.GetTranslator("zh_Hans_CN")
|
||||||
@@ -38,6 +40,7 @@ func ApiInitValidator() {
|
|||||||
ruTrans, _ := uni.GetTranslator("ru")
|
ruTrans, _ := uni.GetTranslator("ru")
|
||||||
esTrans, _ := uni.GetTranslator("es")
|
esTrans, _ := uni.GetTranslator("es")
|
||||||
frTrans, _ := uni.GetTranslator("fr")
|
frTrans, _ := uni.GetTranslator("fr")
|
||||||
|
zhTwTrans, _ := uni.GetTranslator("zh_Hant")
|
||||||
|
|
||||||
err := zh_translations.RegisterDefaultTranslations(validate, zhTrans)
|
err := zh_translations.RegisterDefaultTranslations(validate, zhTrans)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -65,6 +68,10 @@ func ApiInitValidator() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
err = zh_tw_translations.RegisterDefaultTranslations(validate, zhTwTrans)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
validate.RegisterTagNameFunc(func(field reflect.StructField) string {
|
validate.RegisterTagNameFunc(func(field reflect.StructField) string {
|
||||||
label := field.Tag.Get("label")
|
label := field.Tag.Get("label")
|
||||||
@@ -125,6 +132,13 @@ func getTranslatorForLang(lang string) ut.Translator {
|
|||||||
case "zh":
|
case "zh":
|
||||||
trans, _ := Validator.UT.GetTranslator("zh_Hans_CN")
|
trans, _ := Validator.UT.GetTranslator("zh_Hans_CN")
|
||||||
return trans
|
return trans
|
||||||
|
case "zh_TW":
|
||||||
|
fallthrough
|
||||||
|
case "zh-TW":
|
||||||
|
fallthrough
|
||||||
|
case "zh-tw":
|
||||||
|
trans, _ := Validator.UT.GetTranslator("zh_Hant")
|
||||||
|
return trans
|
||||||
case "ko":
|
case "ko":
|
||||||
trans, _ := Validator.UT.GetTranslator("ko")
|
trans, _ := Validator.UT.GetTranslator("ko")
|
||||||
return trans
|
return trans
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type User struct {
|
|||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} apiResp.UserPayload
|
// @Success 200 {object} apiResp.UserPayload
|
||||||
// @Failure 500 {object} response.Response
|
// @Failure 500 {object} response.Response
|
||||||
// @Router /api [get]
|
// @Router /currentUser [get]
|
||||||
// @Security token
|
// @Security token
|
||||||
func (u *User) Info(c *gin.Context) {
|
func (u *User) Info(c *gin.Context) {
|
||||||
user := service.AllService.UserService.CurUser(c)
|
user := service.AllService.UserService.CurUser(c)
|
||||||
|
|||||||
137
resources/i18n/zh_TW.toml
Normal file
137
resources/i18n/zh_TW.toml
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
[Test]
|
||||||
|
description = "test"
|
||||||
|
one = "測試1 {{.P0}}"
|
||||||
|
other = "測試2 {{.P0}}"
|
||||||
|
|
||||||
|
[ParamsError]
|
||||||
|
description = "Params validation failed."
|
||||||
|
one = "引數錯誤。"
|
||||||
|
other = "引數錯誤。"
|
||||||
|
|
||||||
|
[OperationFailed]
|
||||||
|
description = "OperationFailed."
|
||||||
|
one = "操作失敗。"
|
||||||
|
other = "操作失敗。"
|
||||||
|
|
||||||
|
[OperationSuccess]
|
||||||
|
description = "OperationSuccess."
|
||||||
|
one = "操作成功。"
|
||||||
|
other = "操作成功。"
|
||||||
|
|
||||||
|
[ItemExists]
|
||||||
|
description = "Item already exists."
|
||||||
|
one = "資料已存在。"
|
||||||
|
other = "資料已存在。"
|
||||||
|
|
||||||
|
[ItemNotFound]
|
||||||
|
description = "Item not found."
|
||||||
|
one = "資料不存在。"
|
||||||
|
other = "資料不存在。"
|
||||||
|
|
||||||
|
[NoAccess]
|
||||||
|
description = "No access."
|
||||||
|
one = "無許可權。"
|
||||||
|
other = "無許可權。"
|
||||||
|
|
||||||
|
[UsernameOrPasswordError]
|
||||||
|
description = "Username or password error."
|
||||||
|
one = "使用者名稱或密碼錯誤。"
|
||||||
|
other = "使用者名稱或密碼錯誤。"
|
||||||
|
|
||||||
|
[SystemError]
|
||||||
|
description = "System error."
|
||||||
|
one = "系統錯誤。"
|
||||||
|
other = "系統錯誤。"
|
||||||
|
|
||||||
|
[ConfigNotFound]
|
||||||
|
description = "Config not found."
|
||||||
|
one = "配置不存在。"
|
||||||
|
other = "配置不存在。"
|
||||||
|
|
||||||
|
#授權過期
|
||||||
|
[OauthExpired]
|
||||||
|
description = "Oauth expired."
|
||||||
|
one = "授權過期,請重新授權。"
|
||||||
|
other = "授權過期,請重新授權。"
|
||||||
|
|
||||||
|
[OauthFailed]
|
||||||
|
description = "Oauth failed."
|
||||||
|
one = "授權失敗。"
|
||||||
|
other = "授權失敗。"
|
||||||
|
|
||||||
|
[OauthHasBindOtherUser]
|
||||||
|
description = "Oauth has bind other user."
|
||||||
|
one = "授權已繫結其他使用者。"
|
||||||
|
other = "授權已繫結其他使用者。"
|
||||||
|
|
||||||
|
[ParamIsEmpty]
|
||||||
|
description = "Param is empty."
|
||||||
|
one = "{{.P0}} 為空。"
|
||||||
|
other = "{{.P0}} 為空。"
|
||||||
|
|
||||||
|
[BindFail]
|
||||||
|
description = "Bind fail."
|
||||||
|
one = "繫結失敗。"
|
||||||
|
other = "繫結失敗。"
|
||||||
|
[BindSuccess]
|
||||||
|
description = "Bind success."
|
||||||
|
one = "繫結成功。"
|
||||||
|
other = "繫結成功。"
|
||||||
|
[OauthHasBeenSuccess]
|
||||||
|
description = "Oauth has been success."
|
||||||
|
one = "授權已成功。"
|
||||||
|
other = "授權已成功。"
|
||||||
|
[OauthSuccess]
|
||||||
|
description = "Oauth success."
|
||||||
|
one = "授權成功。"
|
||||||
|
other = "授權成功。"
|
||||||
|
[OauthRegisterSuccess]
|
||||||
|
description = "Oauth register success."
|
||||||
|
one = "授權註冊成功。"
|
||||||
|
other = "授權註冊成功。"
|
||||||
|
[OauthRegisterFailed]
|
||||||
|
description = "Oauth register failed."
|
||||||
|
one = "授權註冊失敗。"
|
||||||
|
other = "授權註冊失敗。"
|
||||||
|
[GetOauthTokenError]
|
||||||
|
description = "Get oauth token error."
|
||||||
|
one = "獲取授權token失敗。"
|
||||||
|
other = "獲取授權token失敗。"
|
||||||
|
[GetOauthUserInfoError]
|
||||||
|
description = "Get oauth user info error."
|
||||||
|
one = "獲取授權使用者資訊失敗。"
|
||||||
|
other = "獲取授權使用者資訊失敗。"
|
||||||
|
[DecodeOauthUserInfoError]
|
||||||
|
description = "Decode oauth user info error."
|
||||||
|
one = "解析授權使用者資訊失敗。"
|
||||||
|
other = "解析授權使用者資訊失敗。"
|
||||||
|
|
||||||
|
[OldPasswordError]
|
||||||
|
description = "Old password error."
|
||||||
|
one = "舊密碼錯誤。"
|
||||||
|
other = "舊密碼錯誤。"
|
||||||
|
|
||||||
|
|
||||||
|
[DefaultGroup]
|
||||||
|
description = "Default group."
|
||||||
|
one = "預設組"
|
||||||
|
other = "預設組"
|
||||||
|
|
||||||
|
[ShareGroup]
|
||||||
|
description = "Share group."
|
||||||
|
one = "共享組"
|
||||||
|
other = "共享組"
|
||||||
|
[RegisterClosed]
|
||||||
|
description = "Register closed."
|
||||||
|
one = "註冊已關閉。"
|
||||||
|
other = "註冊已關閉。"
|
||||||
|
|
||||||
|
[CaptchaRequired]
|
||||||
|
description = "Captcha required."
|
||||||
|
one = "需要驗證碼。"
|
||||||
|
other = "需要驗證碼。"
|
||||||
|
|
||||||
|
[CaptchaError]
|
||||||
|
description = "Captcha error."
|
||||||
|
one = "驗證碼錯誤。"
|
||||||
|
other = "驗證碼錯誤。"
|
||||||
Reference in New Issue
Block a user