Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be4742382d | ||
|
|
70d2f1a055 | ||
|
|
877fe50049 | ||
|
|
7d505705ee | ||
|
|
38f81a03b5 | ||
|
|
d549d23819 | ||
|
|
934675e0f0 | ||
|
|
2be397aa38 | ||
|
|
a0a422ed45 |
28
.github/workflows/build.yml
vendored
@@ -48,10 +48,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
job:
|
||||||
- { platform: "amd64", goos: "linux" }
|
- { platform: "amd64", goos: "linux", file_ext: "tar.gz" }
|
||||||
- { platform: "arm64", goos: "linux" }
|
- { platform: "arm64", goos: "linux", file_ext: "tar.gz" }
|
||||||
- { platform: "amd64", goos: "windows" }
|
- { platform: "armv7l", goos: "linux", file_ext: "tar.gz" }
|
||||||
|
- { platform: "amd64", goos: "windows", file_ext: "zip" }
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -96,18 +96,23 @@ jobs:
|
|||||||
if [ "${{ matrix.job.goos }}" = "windows" ]; then
|
if [ "${{ matrix.job.goos }}" = "windows" ]; then
|
||||||
sudo apt-get install gcc-mingw-w64-x86-64 zip -y
|
sudo apt-get install gcc-mingw-w64-x86-64 zip -y
|
||||||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go
|
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go
|
||||||
zip -r ${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip ./release
|
zip -r ${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} ./release
|
||||||
else
|
else
|
||||||
if [ "${{ matrix.job.platform }}" = "arm64" ]; then
|
if [ "${{ matrix.job.platform }}" = "arm64" ]; then
|
||||||
wget https://musl.cc/aarch64-linux-musl-cross.tgz
|
wget https://musl.cc/aarch64-linux-musl-cross.tgz
|
||||||
tar -xf aarch64-linux-musl-cross.tgz
|
tar -xf aarch64-linux-musl-cross.tgz
|
||||||
export PATH=$PATH:$PWD/aarch64-linux-musl-cross/bin
|
export PATH=$PATH:$PWD/aarch64-linux-musl-cross/bin
|
||||||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
||||||
|
elif [ "${{ matrix.job.platform }}" = "armv7l" ]; then
|
||||||
|
wget https://musl.cc/armv7l-linux-musleabihf-cross.tgz
|
||||||
|
tar -xf armv7l-linux-musleabihf-cross.tgz
|
||||||
|
export PATH=$PATH:$PWD/armv7l-linux-musleabihf-cross/bin
|
||||||
|
GOOS=${{ matrix.job.goos }} GOARCH=arm GOARM=7 CC=armv7l-linux-musleabihf-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
||||||
else
|
else
|
||||||
sudo apt-get install musl musl-dev musl-tools -y
|
sudo apt-get install musl musl-dev musl-tools -y
|
||||||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
||||||
fi
|
fi
|
||||||
tar -czf ${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz ./release
|
tar -czf ${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} ./release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
@@ -115,14 +120,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }}
|
name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }}
|
||||||
path: |
|
path: |
|
||||||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz
|
${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}}
|
||||||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip
|
|
||||||
- name: Upload to GitHub Release
|
- name: Upload to GitHub Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz
|
${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}}
|
||||||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip
|
|
||||||
# tag_name: ${{ env.LATEST_TAG }}
|
# tag_name: ${{ env.LATEST_TAG }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -137,6 +140,7 @@ jobs:
|
|||||||
job:
|
job:
|
||||||
- { platform: "amd64", goos: "linux", docker_platform: "linux/amd64" }
|
- { platform: "amd64", goos: "linux", docker_platform: "linux/amd64" }
|
||||||
- { platform: "arm64", goos: "linux", docker_platform: "linux/arm64" }
|
- { platform: "arm64", goos: "linux", docker_platform: "linux/arm64" }
|
||||||
|
- { platform: "armv7l", goos: "linux", docker_platform: "linux/arm/v7" }
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -257,6 +261,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
base-image: ${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}
|
base-image: ${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}
|
||||||
extra-images: ${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-amd64,
|
extra-images: ${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-amd64,
|
||||||
|
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-armv7l,
|
||||||
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-arm64
|
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-arm64
|
||||||
push: true
|
push: true
|
||||||
|
|
||||||
@@ -266,6 +271,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
base-image: ghcr.io/${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}
|
base-image: ghcr.io/${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}
|
||||||
extra-images: ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-amd64,
|
extra-images: ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-amd64,
|
||||||
|
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-armv7l,
|
||||||
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-arm64
|
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:${{ env.TAG }}-arm64
|
||||||
push: true
|
push: true
|
||||||
amend: true
|
amend: true
|
||||||
@@ -276,6 +282,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
base-image: ${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:latest
|
base-image: ${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:latest
|
||||||
extra-images: ${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:latest-amd64,
|
extra-images: ${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:latest-amd64,
|
||||||
|
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:latest-armv7l,
|
||||||
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:latest-arm64
|
${{ env.DOCKERHUB_IMAGE_NAMESPACE }}/rustdesk-api:latest-arm64
|
||||||
push: true
|
push: true
|
||||||
|
|
||||||
@@ -285,6 +292,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
base-image: ghcr.io/${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:latest
|
base-image: ghcr.io/${{ env.BASE_IMAGE_NAMESPACE }}/rustdesk-api:latest
|
||||||
extra-images: ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:latest-amd64,
|
extra-images: ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:latest-amd64,
|
||||||
|
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:latest-armv7l,
|
||||||
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:latest-arm64
|
ghcr.io/${{ env.GHCR_IMAGE_NAMESPACE }}/rustdesk-api:latest-arm64
|
||||||
push: true
|
push: true
|
||||||
amend: true
|
amend: true
|
||||||
10
README.md
@@ -28,6 +28,9 @@
|
|||||||
- 标签管理
|
- 标签管理
|
||||||
- 群组管理
|
- 群组管理
|
||||||
- Oauth 管理
|
- Oauth 管理
|
||||||
|
- 登录日志
|
||||||
|
- 链接日志
|
||||||
|
- 文件传输日志
|
||||||
- 快速使用web client
|
- 快速使用web client
|
||||||
- i18n
|
- i18n
|
||||||
- 通过 web client 分享给游客
|
- 通过 web client 分享给游客
|
||||||
@@ -44,7 +47,7 @@
|
|||||||
#### PC客户端使用的是 ***1.3.0***,经测试 ***1.2.6+*** 都可以
|
#### PC客户端使用的是 ***1.3.0***,经测试 ***1.2.6+*** 都可以
|
||||||
|
|
||||||
#### 关于PC端链接超时或者链接不上的问题以及解决方案
|
#### 关于PC端链接超时或者链接不上的问题以及解决方案
|
||||||
##### 链接不上是或者超时
|
##### 链接不上或者超时
|
||||||
因为server端相对于客户端落后版本,server不会响应客户端的`secure_tcp`请求,所以客户端超时。
|
因为server端相对于客户端落后版本,server不会响应客户端的`secure_tcp`请求,所以客户端超时。
|
||||||
相关代码代码位置在`https://github.com/rustdesk/rustdesk/blob/master/src/client.rs#L322`
|
相关代码代码位置在`https://github.com/rustdesk/rustdesk/blob/master/src/client.rs#L322`
|
||||||
```rust
|
```rust
|
||||||
@@ -113,12 +116,13 @@
|
|||||||

|

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

|

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

|

|
||||||
|
|
||||||
3. 分组可以自定义,方便管理,暂时支持两种类型: `共享组` 和 `普通组`
|
3. 分组可以自定义,方便管理,暂时支持两种类型: `共享组` 和 `普通组`
|
||||||

|

|
||||||
4. 可以直接打开webclient,方便使用;也可以分享给游客,游客可以直接通过webclient远程到设备
|
4. You can directly launch the client, or open the web client for convenient use; you can also share it with guests, allowing them to remotely access the device through the web client.
|
||||||
|
|
||||||

|

|
||||||
5. Oauth,暂时只支持了`Github`和`Google`, 需要创建一个`OAuth App`,然后配置到后台
|
5. Oauth,暂时只支持了`Github`和`Google`, 需要创建一个`OAuth App`,然后配置到后台
|
||||||

|

|
||||||
|
|||||||
17
README_EN.md
@@ -27,6 +27,9 @@ desktop software that provides self-hosted solutions.
|
|||||||
- Tag Management
|
- Tag Management
|
||||||
- Group Management
|
- Group Management
|
||||||
- OAuth Management
|
- OAuth Management
|
||||||
|
- Login Logs
|
||||||
|
- Connection Logs
|
||||||
|
- File Transfer Logs
|
||||||
- Quick access to web client
|
- Quick access to web client
|
||||||
- i18n
|
- i18n
|
||||||
- Share to guest by web client
|
- Share to guest by web client
|
||||||
@@ -117,15 +120,16 @@ installation are `admin` `admin`, please change the password immediately.
|
|||||||

|

|
||||||
2. Regular user interface:
|
2. Regular user interface:
|
||||||

|

|
||||||
You can change your password from the top right corner:
|
In the top right corner, you can change the password, switch languages, and toggle between `day/night` mode.
|
||||||
|
|
||||||

|

|
||||||
3. Groups can be customized for easy management. Currently, two types are supported: `shared group` and `regular group`.
|
3. Groups can be customized for easy management. Currently, two types are supported: `shared group` and `regular group`.
|
||||||

|

|
||||||
4. You can directly open the web client for convenient use; it can also be shared with guests, allowing them to remotely access the device via the web client.
|
4. You can directly launch the client or open the web client for convenience; you can also share it with guests, who can remotely access the device via the web client.
|
||||||
|
|
||||||

|

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

|

|
||||||
- Create a `GitHub OAuth App`
|
- Create a `GitHub OAuth App`
|
||||||
at `Settings` -> `Developer settings` -> `OAuth Apps` -> `New OAuth App` [here](https://github.com/settings/developers).
|
at `Settings` -> `Developer settings` -> `OAuth Apps` -> `New OAuth App` [here](https://github.com/settings/developers).
|
||||||
@@ -135,7 +139,7 @@ installation are `admin` `admin`, please change the password immediately.
|
|||||||
### Web Client:
|
### Web Client:
|
||||||
|
|
||||||
1. If you're already logged into the admin panel, the web client will log in automatically.
|
1. If you're already logged into the admin panel, the web client will log in automatically.
|
||||||
2. If you're not logged in, simply click the login button at the top right corner, and the API server will be
|
2. If you're not logged in, simply click the login button in the top right corner, and the API server will be
|
||||||
pre-configured.
|
pre-configured.
|
||||||

|

|
||||||
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.
|
||||||
@@ -183,6 +187,9 @@ logger:
|
|||||||
path: "./runtime/log.txt"
|
path: "./runtime/log.txt"
|
||||||
level: "warn" #trace,debug,info,warn,error,fatal
|
level: "warn" #trace,debug,info,warn,error,fatal
|
||||||
report-caller: true
|
report-caller: true
|
||||||
|
proxy:
|
||||||
|
enable: false
|
||||||
|
host: ""
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|||||||
141
cmd/apimain.go
@@ -12,19 +12,8 @@ import (
|
|||||||
"Gwen/model"
|
"Gwen/model"
|
||||||
"Gwen/service"
|
"Gwen/service"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/BurntSushi/toml"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/go-playground/locales/en"
|
|
||||||
"github.com/go-playground/locales/zh_Hans_CN"
|
|
||||||
ut "github.com/go-playground/universal-translator"
|
|
||||||
"github.com/go-playground/validator/v10"
|
|
||||||
en_translations "github.com/go-playground/validator/v10/translations/en"
|
|
||||||
zh_translations "github.com/go-playground/validator/v10/translations/zh"
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"golang.org/x/text/language"
|
|
||||||
nethttp "net/http"
|
|
||||||
"reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title 管理系统API
|
// @title 管理系统API
|
||||||
@@ -48,7 +37,7 @@ func main() {
|
|||||||
ReportCaller: global.Config.Logger.ReportCaller,
|
ReportCaller: global.Config.Logger.ReportCaller,
|
||||||
})
|
})
|
||||||
|
|
||||||
InitI18n()
|
global.InitI18n()
|
||||||
|
|
||||||
//redis
|
//redis
|
||||||
global.Redis = redis.NewClient(&redis.Options{
|
global.Redis = redis.NewClient(&redis.Options{
|
||||||
@@ -87,7 +76,7 @@ func main() {
|
|||||||
DatabaseAutoUpdate()
|
DatabaseAutoUpdate()
|
||||||
|
|
||||||
//validator
|
//validator
|
||||||
ApiInitValidator()
|
global.ApiInitValidator()
|
||||||
|
|
||||||
//oss
|
//oss
|
||||||
global.Oss = &upload.Oss{
|
global.Oss = &upload.Oss{
|
||||||
@@ -111,94 +100,6 @@ func main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ApiInitValidator() {
|
|
||||||
validate := validator.New()
|
|
||||||
|
|
||||||
// 定义不同的语言翻译
|
|
||||||
enT := en.New()
|
|
||||||
cn := zh_Hans_CN.New()
|
|
||||||
|
|
||||||
uni := ut.New(enT, cn)
|
|
||||||
|
|
||||||
enTrans, _ := uni.GetTranslator("en")
|
|
||||||
zhTrans, _ := uni.GetTranslator("zh_Hans_CN")
|
|
||||||
|
|
||||||
err := zh_translations.RegisterDefaultTranslations(validate, zhTrans)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
err = en_translations.RegisterDefaultTranslations(validate, enTrans)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
validate.RegisterTagNameFunc(func(field reflect.StructField) string {
|
|
||||||
label := field.Tag.Get("label")
|
|
||||||
if label == "" {
|
|
||||||
return field.Name
|
|
||||||
}
|
|
||||||
return label
|
|
||||||
})
|
|
||||||
global.Validator.Validate = validate
|
|
||||||
global.Validator.UT = uni // 存储 Universal Translator
|
|
||||||
global.Validator.VTrans = zhTrans
|
|
||||||
|
|
||||||
global.Validator.ValidStruct = func(ctx *gin.Context, i interface{}) []string {
|
|
||||||
err := global.Validator.Validate.Struct(i)
|
|
||||||
lang := ctx.GetHeader("Accept-Language")
|
|
||||||
if lang == "" {
|
|
||||||
lang = global.Config.Lang
|
|
||||||
}
|
|
||||||
trans := getTranslatorForLang(lang)
|
|
||||||
errList := make([]string, 0, 10)
|
|
||||||
if err != nil {
|
|
||||||
if _, ok := err.(*validator.InvalidValidationError); ok {
|
|
||||||
errList = append(errList, err.Error())
|
|
||||||
return errList
|
|
||||||
}
|
|
||||||
for _, err2 := range err.(validator.ValidationErrors) {
|
|
||||||
errList = append(errList, err2.Translate(trans))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return errList
|
|
||||||
}
|
|
||||||
global.Validator.ValidVar = func(ctx *gin.Context, field interface{}, tag string) []string {
|
|
||||||
err := global.Validator.Validate.Var(field, tag)
|
|
||||||
lang := ctx.GetHeader("Accept-Language")
|
|
||||||
if lang == "" {
|
|
||||||
lang = global.Config.Lang
|
|
||||||
}
|
|
||||||
trans := getTranslatorForLang(lang)
|
|
||||||
errList := make([]string, 0, 10)
|
|
||||||
if err != nil {
|
|
||||||
if _, ok := err.(*validator.InvalidValidationError); ok {
|
|
||||||
errList = append(errList, err.Error())
|
|
||||||
return errList
|
|
||||||
}
|
|
||||||
for _, err2 := range err.(validator.ValidationErrors) {
|
|
||||||
errList = append(errList, err2.Translate(trans))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return errList
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
func getTranslatorForLang(lang string) ut.Translator {
|
|
||||||
switch lang {
|
|
||||||
case "zh_CN":
|
|
||||||
fallthrough
|
|
||||||
case "zh-CN":
|
|
||||||
fallthrough
|
|
||||||
case "zh":
|
|
||||||
trans, _ := global.Validator.UT.GetTranslator("zh_Hans_CN")
|
|
||||||
return trans
|
|
||||||
case "en":
|
|
||||||
fallthrough
|
|
||||||
default:
|
|
||||||
trans, _ := global.Validator.UT.GetTranslator("en")
|
|
||||||
return trans
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func DatabaseAutoUpdate() {
|
func DatabaseAutoUpdate() {
|
||||||
version := 235
|
version := 235
|
||||||
|
|
||||||
@@ -273,9 +174,7 @@ func Migrate(version uint) {
|
|||||||
var vc int64
|
var vc int64
|
||||||
global.DB.Model(&model.Version{}).Count(&vc)
|
global.DB.Model(&model.Version{}).Count(&vc)
|
||||||
if vc == 1 {
|
if vc == 1 {
|
||||||
localizer := global.Localizer(&gin.Context{
|
localizer := global.Localizer("")
|
||||||
Request: &nethttp.Request{},
|
|
||||||
})
|
|
||||||
defaultGroup, _ := localizer.LocalizeMessage(&i18n.Message{
|
defaultGroup, _ := localizer.LocalizeMessage(&i18n.Message{
|
||||||
ID: "DefaultGroup",
|
ID: "DefaultGroup",
|
||||||
})
|
})
|
||||||
@@ -307,37 +206,3 @@ func Migrate(version uint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitI18n() {
|
|
||||||
bundle := i18n.NewBundle(language.English)
|
|
||||||
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
|
||||||
bundle.LoadMessageFile(global.Config.Gin.ResourcesPath + "/i18n/en.toml")
|
|
||||||
bundle.LoadMessageFile(global.Config.Gin.ResourcesPath + "/i18n/zh_CN.toml")
|
|
||||||
global.Localizer = func(ctx *gin.Context) *i18n.Localizer {
|
|
||||||
lang := ctx.GetHeader("Accept-Language")
|
|
||||||
if lang == "" {
|
|
||||||
lang = global.Config.Lang
|
|
||||||
}
|
|
||||||
if lang == "en" {
|
|
||||||
return i18n.NewLocalizer(bundle, "en")
|
|
||||||
} else {
|
|
||||||
return i18n.NewLocalizer(bundle, lang, "en")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//personUnreadEmails := localizer.MustLocalize(&i18n.LocalizeConfig{
|
|
||||||
// DefaultMessage: &i18n.Message{
|
|
||||||
// ID: "PersonUnreadEmails",
|
|
||||||
// },
|
|
||||||
// PluralCount: 6,
|
|
||||||
// TemplateData: map[string]interface{}{
|
|
||||||
// "Name": "LE",
|
|
||||||
// "PluralCount": 6,
|
|
||||||
// },
|
|
||||||
//})
|
|
||||||
//personUnreadEmails, err := global.Localizer.LocalizeMessage(&i18n.Message{
|
|
||||||
// ID: "ParamsError",
|
|
||||||
//})
|
|
||||||
//fmt.Println(err, personUnreadEmails)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.7 KiB |
124
global/apiValidator.go
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
package global
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/go-playground/locales/en"
|
||||||
|
"github.com/go-playground/locales/ko"
|
||||||
|
"github.com/go-playground/locales/ru"
|
||||||
|
"github.com/go-playground/locales/zh_Hans_CN"
|
||||||
|
|
||||||
|
ut "github.com/go-playground/universal-translator"
|
||||||
|
"github.com/go-playground/validator/v10"
|
||||||
|
en_translations "github.com/go-playground/validator/v10/translations/en"
|
||||||
|
ru_translations "github.com/go-playground/validator/v10/translations/ru"
|
||||||
|
zh_translations "github.com/go-playground/validator/v10/translations/zh"
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ApiInitValidator() {
|
||||||
|
validate := validator.New()
|
||||||
|
|
||||||
|
// 定义不同的语言翻译
|
||||||
|
enT := en.New()
|
||||||
|
cn := zh_Hans_CN.New()
|
||||||
|
koT := ko.New()
|
||||||
|
ruT := ru.New()
|
||||||
|
|
||||||
|
uni := ut.New(enT, cn, koT, ruT)
|
||||||
|
|
||||||
|
enTrans, _ := uni.GetTranslator("en")
|
||||||
|
zhTrans, _ := uni.GetTranslator("zh_Hans_CN")
|
||||||
|
koTrans, _ := uni.GetTranslator("ko")
|
||||||
|
ruTrans, _ := uni.GetTranslator("ru")
|
||||||
|
|
||||||
|
err := zh_translations.RegisterDefaultTranslations(validate, zhTrans)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
err = en_translations.RegisterDefaultTranslations(validate, enTrans)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
//validate没有ko的翻译,使用zh的翻译
|
||||||
|
err = zh_translations.RegisterDefaultTranslations(validate, koTrans)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
err = ru_translations.RegisterDefaultTranslations(validate, ruTrans)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
validate.RegisterTagNameFunc(func(field reflect.StructField) string {
|
||||||
|
label := field.Tag.Get("label")
|
||||||
|
if label == "" {
|
||||||
|
return field.Name
|
||||||
|
}
|
||||||
|
return label
|
||||||
|
})
|
||||||
|
Validator.Validate = validate
|
||||||
|
Validator.UT = uni // 存储 Universal Translator
|
||||||
|
Validator.VTrans = zhTrans
|
||||||
|
|
||||||
|
Validator.ValidStruct = func(ctx *gin.Context, i interface{}) []string {
|
||||||
|
err := Validator.Validate.Struct(i)
|
||||||
|
lang := ctx.GetHeader("Accept-Language")
|
||||||
|
if lang == "" {
|
||||||
|
lang = Config.Lang
|
||||||
|
}
|
||||||
|
trans := getTranslatorForLang(lang)
|
||||||
|
errList := make([]string, 0, 10)
|
||||||
|
if err != nil {
|
||||||
|
if _, ok := err.(*validator.InvalidValidationError); ok {
|
||||||
|
errList = append(errList, err.Error())
|
||||||
|
return errList
|
||||||
|
}
|
||||||
|
for _, err2 := range err.(validator.ValidationErrors) {
|
||||||
|
errList = append(errList, err2.Translate(trans))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errList
|
||||||
|
}
|
||||||
|
Validator.ValidVar = func(ctx *gin.Context, field interface{}, tag string) []string {
|
||||||
|
err := Validator.Validate.Var(field, tag)
|
||||||
|
lang := ctx.GetHeader("Accept-Language")
|
||||||
|
if lang == "" {
|
||||||
|
lang = Config.Lang
|
||||||
|
}
|
||||||
|
trans := getTranslatorForLang(lang)
|
||||||
|
errList := make([]string, 0, 10)
|
||||||
|
if err != nil {
|
||||||
|
if _, ok := err.(*validator.InvalidValidationError); ok {
|
||||||
|
errList = append(errList, err.Error())
|
||||||
|
return errList
|
||||||
|
}
|
||||||
|
for _, err2 := range err.(validator.ValidationErrors) {
|
||||||
|
errList = append(errList, err2.Translate(trans))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func getTranslatorForLang(lang string) ut.Translator {
|
||||||
|
switch lang {
|
||||||
|
case "zh_CN":
|
||||||
|
fallthrough
|
||||||
|
case "zh-CN":
|
||||||
|
fallthrough
|
||||||
|
case "zh":
|
||||||
|
trans, _ := Validator.UT.GetTranslator("zh_Hans_CN")
|
||||||
|
return trans
|
||||||
|
case "ko":
|
||||||
|
trans, _ := Validator.UT.GetTranslator("ko")
|
||||||
|
return trans
|
||||||
|
case "ru":
|
||||||
|
trans, _ := Validator.UT.GetTranslator("ru")
|
||||||
|
return trans
|
||||||
|
case "en":
|
||||||
|
fallthrough
|
||||||
|
default:
|
||||||
|
trans, _ := Validator.UT.GetTranslator("en")
|
||||||
|
return trans
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,5 +33,5 @@ var (
|
|||||||
Oss *upload.Oss
|
Oss *upload.Oss
|
||||||
Jwt *jwt.Jwt
|
Jwt *jwt.Jwt
|
||||||
Lock lock.Locker
|
Lock lock.Locker
|
||||||
Localizer func(ctx *gin.Context) *i18n.Localizer
|
Localizer func(lang string) *i18n.Localizer
|
||||||
)
|
)
|
||||||
|
|||||||
53
global/i18n.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package global
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
|
"golang.org/x/text/language"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitI18n() {
|
||||||
|
bundle := i18n.NewBundle(language.English)
|
||||||
|
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||||
|
//读取global.Config.Gin.ResourcesPath下的所有语言文件
|
||||||
|
dir := Config.Gin.ResourcesPath + "/i18n"
|
||||||
|
fileInfos, err := os.ReadDir(dir)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, fileInfo := range fileInfos {
|
||||||
|
//如果文件名不是.toml结尾
|
||||||
|
if fileInfo.IsDir() || fileInfo.Name()[len(fileInfo.Name())-5:] != ".toml" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
bundle.LoadMessageFile(Config.Gin.ResourcesPath + "/i18n/" + fileInfo.Name())
|
||||||
|
}
|
||||||
|
Localizer = func(lang string) *i18n.Localizer {
|
||||||
|
if lang == "" {
|
||||||
|
lang = Config.Lang
|
||||||
|
}
|
||||||
|
if lang == "en" {
|
||||||
|
return i18n.NewLocalizer(bundle, "en")
|
||||||
|
} else {
|
||||||
|
return i18n.NewLocalizer(bundle, lang, "en")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//personUnreadEmails := localizer.MustLocalize(&i18n.LocalizeConfig{
|
||||||
|
// DefaultMessage: &i18n.Message{
|
||||||
|
// ID: "PersonUnreadEmails",
|
||||||
|
// },
|
||||||
|
// PluralCount: 6,
|
||||||
|
// TemplateData: map[string]interface{}{
|
||||||
|
// "Name": "LE",
|
||||||
|
// "PluralCount": 6,
|
||||||
|
// },
|
||||||
|
//})
|
||||||
|
//personUnreadEmails, err := global.Localizer.LocalizeMessage(&i18n.Message{
|
||||||
|
// ID: "ParamsError",
|
||||||
|
//})
|
||||||
|
//fmt.Println(err, personUnreadEmails)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -56,7 +56,7 @@ type ServerConfigResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TranslateMsg(c *gin.Context, messageId string) string {
|
func TranslateMsg(c *gin.Context, messageId string) string {
|
||||||
localizer := global.Localizer(c)
|
localizer := global.Localizer(c.GetHeader("Accept-Language"))
|
||||||
errMsg, err := localizer.LocalizeMessage(&i18n.Message{
|
errMsg, err := localizer.LocalizeMessage(&i18n.Message{
|
||||||
ID: messageId,
|
ID: messageId,
|
||||||
})
|
})
|
||||||
@@ -67,7 +67,7 @@ func TranslateMsg(c *gin.Context, messageId string) string {
|
|||||||
return errMsg
|
return errMsg
|
||||||
}
|
}
|
||||||
func TranslateTempMsg(c *gin.Context, messageId string, templateData map[string]interface{}) string {
|
func TranslateTempMsg(c *gin.Context, messageId string, templateData map[string]interface{}) string {
|
||||||
localizer := global.Localizer(c)
|
localizer := global.Localizer(c.GetHeader("Accept-Language"))
|
||||||
errMsg, err := localizer.Localize(&i18n.LocalizeConfig{
|
errMsg, err := localizer.Localize(&i18n.LocalizeConfig{
|
||||||
DefaultMessage: &i18n.Message{
|
DefaultMessage: &i18n.Message{
|
||||||
ID: messageId,
|
ID: messageId,
|
||||||
@@ -81,7 +81,7 @@ func TranslateTempMsg(c *gin.Context, messageId string, templateData map[string]
|
|||||||
return errMsg
|
return errMsg
|
||||||
}
|
}
|
||||||
func TranslateParamMsg(c *gin.Context, messageId string, params ...string) string {
|
func TranslateParamMsg(c *gin.Context, messageId string, params ...string) string {
|
||||||
localizer := global.Localizer(c)
|
localizer := global.Localizer(c.GetHeader("Accept-Language"))
|
||||||
templateData := make(map[string]interface{})
|
templateData := make(map[string]interface{})
|
||||||
for i, v := range params {
|
for i, v := range params {
|
||||||
k := fmt.Sprintf("P%d", i)
|
k := fmt.Sprintf("P%d", i)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ func WebInit(g *gin.Engine) {
|
|||||||
|
|
||||||
if global.Config.App.WebClient == 1 {
|
if global.Config.App.WebClient == 1 {
|
||||||
g.StaticFS("/webclient", http.Dir(global.Config.Gin.ResourcesPath+"/web"))
|
g.StaticFS("/webclient", http.Dir(global.Config.Gin.ResourcesPath+"/web"))
|
||||||
|
g.StaticFS("/webclient2", http.Dir(global.Config.Gin.ResourcesPath+"/web2"))
|
||||||
}
|
}
|
||||||
g.StaticFS("/_admin", http.Dir(global.Config.Gin.ResourcesPath+"/admin"))
|
g.StaticFS("/_admin", http.Dir(global.Config.Gin.ResourcesPath+"/admin"))
|
||||||
}
|
}
|
||||||
|
|||||||
123
resources/i18n/ko.toml
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
[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 = "인증 토큰을 획득하지 못했습니다."
|
||||||
|
other = "인증 토큰을 획득하지 못했습니다."
|
||||||
|
[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 = "공유 그룹"
|
||||||
129
resources/i18n/ru.toml
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
[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 = "Не удалось получить токен авторизации."
|
||||||
|
other = "Не удалось получить токен авторизации."
|
||||||
|
|
||||||
|
[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 = "Общая группа"
|
||||||