style: Module name

This commit is contained in:
lejianwen
2025-02-12 19:46:39 +08:00
parent a2672c9489
commit 6aebf061a4
79 changed files with 262 additions and 263 deletions

View File

@@ -2,18 +2,18 @@ package main
import (
"github.com/go-redis/redis/v8"
"github.com/lejianwen/rustdesk-api/config"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http"
"github.com/lejianwen/rustdesk-api/lib/cache"
"github.com/lejianwen/rustdesk-api/lib/jwt"
"github.com/lejianwen/rustdesk-api/lib/lock"
"github.com/lejianwen/rustdesk-api/lib/logger"
"github.com/lejianwen/rustdesk-api/lib/orm"
"github.com/lejianwen/rustdesk-api/lib/upload"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/utils"
"github.com/lejianwen/rustdesk-api/v2/config"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http"
"github.com/lejianwen/rustdesk-api/v2/lib/cache"
"github.com/lejianwen/rustdesk-api/v2/lib/jwt"
"github.com/lejianwen/rustdesk-api/v2/lib/lock"
"github.com/lejianwen/rustdesk-api/v2/lib/logger"
"github.com/lejianwen/rustdesk-api/v2/lib/orm"
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"github.com/lejianwen/rustdesk-api/v2/utils"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/spf13/cobra"
"os"
@@ -186,12 +186,12 @@ func DatabaseAutoUpdate() {
// 获取底层的 *sql.DB 对象,并确保在程序退出时关闭连接
sqlDBWithoutDB, err := dbWithoutDB.DB()
if err != nil {
global.Logger.Error("获取底层 *sql.DB 对象失败: %v\n", err)
global.Logger.Errorf("获取底层 *sql.DB 对象失败: %v", err)
return
}
defer func() {
if err := sqlDBWithoutDB.Close(); err != nil {
global.Logger.Error("关闭连接失败: %v\n", err)
global.Logger.Errorf("关闭连接失败: %v", err)
}
}()

View File

@@ -1,16 +1,16 @@
package config
type LdapUser struct {
BaseDn string `mapstructure:"base-dn"` // The base DN of the user for searching
EnableAttr string `mapstructure:"enable-attr"` // The attribute name of the user for enabling, in AD it is "userAccountControl", empty means no enable attribute, all users are enabled
EnableAttrValue string `mapstructure:"enable-attr-value"` // The value of the enable attribute when the user is enabled. If you are using AD, just leave it random str, it will be ignored.
Filter string `mapstructure:"filter"`
Username string `mapstructure:"username"`
Email string `mapstructure:"email"`
FirstName string `mapstructure:"first-name"`
LastName string `mapstructure:"last-name"`
Sync bool `mapstructure:"sync"` // Will sync the user's information to the internal database
AdminGroup string `mapstructure:"admin-group"` // Which group is the admin group
BaseDn string `mapstructure:"base-dn"` // The base DN of the user for searching
EnableAttr string `mapstructure:"enable-attr"` // The attribute name of the user for enabling, in AD it is "userAccountControl", empty means no enable attribute, all users are enabled
EnableAttrValue string `mapstructure:"enable-attr-value"` // The value of the enable attribute when the user is enabled. If you are using AD, just leave it random str, it will be ignored.
Filter string `mapstructure:"filter"`
Username string `mapstructure:"username"`
Email string `mapstructure:"email"`
FirstName string `mapstructure:"first-name"`
LastName string `mapstructure:"last-name"`
Sync bool `mapstructure:"sync"` // Will sync the user's information to the internal database
AdminGroup string `mapstructure:"admin-group"` // Which group is the admin group
}
// type LdapGroup struct {
@@ -24,13 +24,13 @@ type LdapUser struct {
// }
type Ldap struct {
Enable bool `mapstructure:"enable"`
Url string `mapstructure:"url"`
TLS bool `mapstructure:"tls"`
TlsVerify bool `mapstructure:"tls-verify"`
BaseDn string `mapstructure:"base-dn"`
BindDn string `mapstructure:"bind-dn"`
BindPassword string `mapstructure:"bind-password"`
User LdapUser `mapstructure:"user"`
Enable bool `mapstructure:"enable"`
Url string `mapstructure:"url"`
TLS bool `mapstructure:"tls"`
TlsVerify bool `mapstructure:"tls-verify"`
BaseDn string `mapstructure:"base-dn"`
BindDn string `mapstructure:"bind-dn"`
BindPassword string `mapstructure:"bind-password"`
User LdapUser `mapstructure:"user"`
// Group LdapGroup `mapstructure:"group"`
}
}

View File

@@ -17,4 +17,4 @@ type OidcOauth struct {
ClientId string `mapstructure:"client-id"`
ClientSecret string `mapstructure:"client-secret"`
RedirectUrl string `mapstructure:"redirect-url"`
}
}

View File

@@ -5,11 +5,11 @@ import (
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
"github.com/go-redis/redis/v8"
"github.com/lejianwen/rustdesk-api/config"
"github.com/lejianwen/rustdesk-api/lib/cache"
"github.com/lejianwen/rustdesk-api/lib/jwt"
"github.com/lejianwen/rustdesk-api/lib/lock"
"github.com/lejianwen/rustdesk-api/lib/upload"
"github.com/lejianwen/rustdesk-api/v2/config"
"github.com/lejianwen/rustdesk-api/v2/lib/cache"
"github.com/lejianwen/rustdesk-api/v2/lib/jwt"
"github.com/lejianwen/rustdesk-api/v2/lib/lock"
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"

View File

@@ -15,7 +15,6 @@ func InitI18n() {
fileInfos, err := os.ReadDir(dir)
if err != nil {
panic(err)
return
}
for _, fileInfo := range fileInfos {
//如果文件名不是.toml结尾

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/lejianwen/rustdesk-api
module github.com/lejianwen/rustdesk-api/v2
go 1.22

View File

@@ -4,10 +4,10 @@ import (
"encoding/json"
_ "encoding/json"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,9 +2,9 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"os"
"strings"
)

View File

@@ -3,9 +3,9 @@ package admin
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/lib/upload"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
"os"
"time"
)

View File

@@ -2,10 +2,10 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"strconv"
)

View File

@@ -3,14 +3,14 @@ package admin
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/controller/api"
"github.com/lejianwen/rustdesk-api/http/request/admin"
apiReq "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
adResp "github.com/lejianwen/rustdesk-api/http/response/admin"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/controller/api"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
apiReq "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
adResp "github.com/lejianwen/rustdesk-api/v2/http/response/admin"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"github.com/mojocn/base64Captcha"
"sync"
"time"

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -3,10 +3,10 @@ package my
import (
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,11 +2,11 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,11 +2,11 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,11 +2,11 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,9 +2,9 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"time"
)

View File

@@ -2,10 +2,10 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,10 +2,10 @@ package my
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
adminReq "github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
adminReq "github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"strconv"
)

View File

@@ -2,10 +2,10 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
"time"

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
)
type Rustdesk struct {

View File

@@ -2,10 +2,10 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -2,10 +2,10 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -2,12 +2,12 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
adResp "github.com/lejianwen/rustdesk-api/http/response/admin"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
adResp "github.com/lejianwen/rustdesk-api/v2/http/response/admin"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
"strconv"
)

View File

@@ -2,11 +2,11 @@ package admin
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/admin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"gorm.io/gorm"
)

View File

@@ -4,13 +4,13 @@ import (
"encoding/json"
"errors"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/utils"
"github.com/lejianwen/rustdesk-api/v2/global"
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"github.com/lejianwen/rustdesk-api/v2/utils"
"net/http"
"strconv"
"strings"

View File

@@ -3,10 +3,10 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
request "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
request "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"time"
)

View File

@@ -2,11 +2,11 @@ package api
import (
"github.com/gin-gonic/gin"
apiReq "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
apiReq "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
)

View File

@@ -2,10 +2,10 @@ package api
import (
"github.com/gin-gonic/gin"
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
"os"
"time"

View File

@@ -4,12 +4,12 @@ import (
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
)

View File

@@ -2,12 +2,12 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
)

View File

@@ -3,9 +3,9 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
)

View File

@@ -2,8 +2,8 @@ package api
import (
"github.com/gin-gonic/gin"
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/service"
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/service"
"net/http"
)

View File

@@ -2,10 +2,10 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/http/response/api"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/http/response/api"
"github.com/lejianwen/rustdesk-api/v2/service"
"time"
)

View File

@@ -2,7 +2,7 @@ package web
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/v2/global"
"strconv"
)

View File

@@ -2,9 +2,9 @@ package http
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/middleware"
"github.com/lejianwen/rustdesk-api/http/router"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
"github.com/lejianwen/rustdesk-api/v2/http/router"
"github.com/sirupsen/logrus"
"net/http"
"strings"

View File

@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
)
// AdminAuth 后台权限验证中间件

View File

@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
)
// AdminPrivilege ...

View File

@@ -2,9 +2,9 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/response"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/response"
"github.com/lejianwen/rustdesk-api/v2/service"
)
func JwtAuth() gin.HandlerFunc {

View File

@@ -2,7 +2,7 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/sirupsen/logrus"
)

View File

@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/service"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/service"
)
func RustAuth() gin.HandlerFunc {

View File

@@ -2,7 +2,7 @@ package admin
import (
"encoding/json"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/model"
)
type AddressBookForm struct {

View File

@@ -1,6 +1,6 @@
package admin
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type GroupForm struct {
Id uint `json:"id"`

View File

@@ -1,7 +1,7 @@
package admin
import (
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/model"
)
type BindOauthForm struct {

View File

@@ -1,6 +1,6 @@
package admin
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type PeerForm struct {
RowId uint `json:"row_id" `

View File

@@ -1,6 +1,6 @@
package admin
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type TagForm struct {
Id uint `json:"id"`

View File

@@ -1,7 +1,7 @@
package admin
import (
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/model"
)
type UserForm struct {

View File

@@ -2,8 +2,8 @@ package api
import (
"encoding/json"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"strconv"
)

View File

@@ -1,6 +1,6 @@
package api
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type AddressBookFormData struct {
Tags []string `json:"tags"`

View File

@@ -1,6 +1,6 @@
package admin
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type LoginPayload struct {
Username string `json:"username"`

View File

@@ -1,6 +1,6 @@
package api
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
type AbList struct {
Peers []*model.AddressBook `json:"peers,omitempty"`

View File

@@ -1,6 +1,6 @@
package api
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
/*
GroupPeerPayload

View File

@@ -1,6 +1,6 @@
package api
import "github.com/lejianwen/rustdesk-api/model"
import "github.com/lejianwen/rustdesk-api/v2/model"
/*
pub enum UserStatus {

View File

@@ -1,7 +1,7 @@
package api
import (
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/model"
"time"
)

View File

@@ -3,7 +3,7 @@ package response
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/nicksnyder/go-i18n/v2/i18n"
"net/http"
)

View File

@@ -2,11 +2,11 @@ package router
import (
"github.com/gin-gonic/gin"
_ "github.com/lejianwen/rustdesk-api/docs/admin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/controller/admin"
"github.com/lejianwen/rustdesk-api/http/controller/admin/my"
"github.com/lejianwen/rustdesk-api/http/middleware"
_ "github.com/lejianwen/rustdesk-api/v2/docs/admin"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/controller/admin"
"github.com/lejianwen/rustdesk-api/v2/http/controller/admin/my"
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)

View File

@@ -2,10 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
_ "github.com/lejianwen/rustdesk-api/docs/api"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/controller/api"
"github.com/lejianwen/rustdesk-api/http/middleware"
_ "github.com/lejianwen/rustdesk-api/v2/docs/api"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/controller/api"
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"net/http"

View File

@@ -2,8 +2,8 @@ package router
import (
"github.com/gin-gonic/gin"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/http/controller/web"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/http/controller/web"
"net/http"
)

View File

@@ -2,7 +2,7 @@ package orm
import (
"fmt"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/v2/global"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"

View File

@@ -2,7 +2,7 @@ package orm
import (
"fmt"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/v2/global"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"

View File

@@ -1,6 +1,6 @@
package model
import "github.com/lejianwen/rustdesk-api/model/custom_types"
import "github.com/lejianwen/rustdesk-api/v2/model/custom_types"
// final String id;
// String hash; // personal ab hash password

View File

@@ -1,7 +1,7 @@
package model
import (
"github.com/lejianwen/rustdesk-api/model/custom_types"
"github.com/lejianwen/rustdesk-api/v2/model/custom_types"
)
type StatusCode int

View File

@@ -2,11 +2,11 @@ package model
type UserToken struct {
IdModel
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
DeviceUuid string `json:"device_uuid" gorm:"default:'';omitempty;"`
DeviceId string `json:"device_id" gorm:"default:'';omitempty;"`
Token string `json:"token" gorm:"default:'';not null;index"`
ExpiredAt int64 `json:"expired_at" gorm:"default:0;not null;"`
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
DeviceUuid string `json:"device_uuid" gorm:"default:'';omitempty;"`
DeviceId string `json:"device_id" gorm:"default:'';omitempty;"`
Token string `json:"token" gorm:"default:'';not null;index"`
ExpiredAt int64 `json:"expired_at" gorm:"default:0;not null;"`
TimeModel
}

View File

@@ -3,8 +3,8 @@ package service
import (
"encoding/json"
"github.com/google/uuid"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
"strings"
)

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -9,9 +9,9 @@ import (
"github.com/go-ldap/ldap/v3"
"github.com/lejianwen/rustdesk-api/config"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/config"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
)
var (

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -4,9 +4,9 @@ import (
"context"
"encoding/json"
"errors"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/utils"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/utils"
"golang.org/x/oauth2"
"golang.org/x/oauth2/github"
// "golang.org/x/oauth2/google"

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -2,8 +2,8 @@ package service
import (
"fmt"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"net"
"time"
)

View File

@@ -1,7 +1,7 @@
package service
import (
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -1,8 +1,8 @@
package service
import (
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"gorm.io/gorm"
)

View File

@@ -2,9 +2,9 @@ package service
import (
"errors"
"github.com/lejianwen/rustdesk-api/global"
"github.com/lejianwen/rustdesk-api/model"
"github.com/lejianwen/rustdesk-api/utils"
"github.com/lejianwen/rustdesk-api/v2/global"
"github.com/lejianwen/rustdesk-api/v2/model"
"github.com/lejianwen/rustdesk-api/v2/utils"
"math/rand"
"strconv"
"strings"
@@ -52,7 +52,7 @@ func (us *UserService) InfoByUsernamePassword(username, password string) *model.
if err == nil {
return u
}
global.Logger.Error("LDAP authentication failed, %v", err)
global.Logger.Errorf("LDAP authentication failed, %v", err)
global.Logger.Warn("Fallback to local database")
}
u := &model.User{}