style: Module name
This commit is contained in:
@@ -2,18 +2,18 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"github.com/lejianwen/rustdesk-api/config"
|
"github.com/lejianwen/rustdesk-api/v2/config"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http"
|
"github.com/lejianwen/rustdesk-api/v2/http"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/cache"
|
"github.com/lejianwen/rustdesk-api/v2/lib/cache"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/jwt"
|
"github.com/lejianwen/rustdesk-api/v2/lib/jwt"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/lock"
|
"github.com/lejianwen/rustdesk-api/v2/lib/lock"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/logger"
|
"github.com/lejianwen/rustdesk-api/v2/lib/logger"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/orm"
|
"github.com/lejianwen/rustdesk-api/v2/lib/orm"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/upload"
|
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"github.com/lejianwen/rustdesk-api/utils"
|
"github.com/lejianwen/rustdesk-api/v2/utils"
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"os"
|
"os"
|
||||||
@@ -186,12 +186,12 @@ func DatabaseAutoUpdate() {
|
|||||||
// 获取底层的 *sql.DB 对象,并确保在程序退出时关闭连接
|
// 获取底层的 *sql.DB 对象,并确保在程序退出时关闭连接
|
||||||
sqlDBWithoutDB, err := dbWithoutDB.DB()
|
sqlDBWithoutDB, err := dbWithoutDB.DB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.Logger.Error("获取底层 *sql.DB 对象失败: %v\n", err)
|
global.Logger.Errorf("获取底层 *sql.DB 对象失败: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := sqlDBWithoutDB.Close(); err != nil {
|
if err := sqlDBWithoutDB.Close(); err != nil {
|
||||||
global.Logger.Error("关闭连接失败: %v\n", err)
|
global.Logger.Errorf("关闭连接失败: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
type LdapUser struct {
|
type LdapUser struct {
|
||||||
BaseDn string `mapstructure:"base-dn"` // The base DN of the user for searching
|
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
|
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.
|
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"`
|
Filter string `mapstructure:"filter"`
|
||||||
Username string `mapstructure:"username"`
|
Username string `mapstructure:"username"`
|
||||||
Email string `mapstructure:"email"`
|
Email string `mapstructure:"email"`
|
||||||
FirstName string `mapstructure:"first-name"`
|
FirstName string `mapstructure:"first-name"`
|
||||||
LastName string `mapstructure:"last-name"`
|
LastName string `mapstructure:"last-name"`
|
||||||
Sync bool `mapstructure:"sync"` // Will sync the user's information to the internal database
|
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
|
AdminGroup string `mapstructure:"admin-group"` // Which group is the admin group
|
||||||
}
|
}
|
||||||
|
|
||||||
// type LdapGroup struct {
|
// type LdapGroup struct {
|
||||||
@@ -24,13 +24,13 @@ type LdapUser struct {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
type Ldap struct {
|
type Ldap struct {
|
||||||
Enable bool `mapstructure:"enable"`
|
Enable bool `mapstructure:"enable"`
|
||||||
Url string `mapstructure:"url"`
|
Url string `mapstructure:"url"`
|
||||||
TLS bool `mapstructure:"tls"`
|
TLS bool `mapstructure:"tls"`
|
||||||
TlsVerify bool `mapstructure:"tls-verify"`
|
TlsVerify bool `mapstructure:"tls-verify"`
|
||||||
BaseDn string `mapstructure:"base-dn"`
|
BaseDn string `mapstructure:"base-dn"`
|
||||||
BindDn string `mapstructure:"bind-dn"`
|
BindDn string `mapstructure:"bind-dn"`
|
||||||
BindPassword string `mapstructure:"bind-password"`
|
BindPassword string `mapstructure:"bind-password"`
|
||||||
User LdapUser `mapstructure:"user"`
|
User LdapUser `mapstructure:"user"`
|
||||||
// Group LdapGroup `mapstructure:"group"`
|
// Group LdapGroup `mapstructure:"group"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ type OidcOauth struct {
|
|||||||
ClientId string `mapstructure:"client-id"`
|
ClientId string `mapstructure:"client-id"`
|
||||||
ClientSecret string `mapstructure:"client-secret"`
|
ClientSecret string `mapstructure:"client-secret"`
|
||||||
RedirectUrl string `mapstructure:"redirect-url"`
|
RedirectUrl string `mapstructure:"redirect-url"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import (
|
|||||||
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"
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"github.com/lejianwen/rustdesk-api/config"
|
"github.com/lejianwen/rustdesk-api/v2/config"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/cache"
|
"github.com/lejianwen/rustdesk-api/v2/lib/cache"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/jwt"
|
"github.com/lejianwen/rustdesk-api/v2/lib/jwt"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/lock"
|
"github.com/lejianwen/rustdesk-api/v2/lib/lock"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/upload"
|
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
|
||||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ func InitI18n() {
|
|||||||
fileInfos, err := os.ReadDir(dir)
|
fileInfos, err := os.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
for _, fileInfo := range fileInfos {
|
for _, fileInfo := range fileInfos {
|
||||||
//如果文件名不是.toml结尾
|
//如果文件名不是.toml结尾
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/lejianwen/rustdesk-api
|
module github.com/lejianwen/rustdesk-api/v2
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
_ "encoding/json"
|
_ "encoding/json"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package admin
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/lib/upload"
|
"github.com/lejianwen/rustdesk-api/v2/lib/upload"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package admin
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/controller/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/controller/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
apiReq "github.com/lejianwen/rustdesk-api/http/request/api"
|
apiReq "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
adResp "github.com/lejianwen/rustdesk-api/http/response/admin"
|
adResp "github.com/lejianwen/rustdesk-api/v2/http/response/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"github.com/mojocn/base64Captcha"
|
"github.com/mojocn/base64Captcha"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package my
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package my
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
adminReq "github.com/lejianwen/rustdesk-api/http/request/admin"
|
adminReq "github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Rustdesk struct {
|
type Rustdesk struct {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
adResp "github.com/lejianwen/rustdesk-api/http/response/admin"
|
adResp "github.com/lejianwen/rustdesk-api/v2/http/response/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
|
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"github.com/lejianwen/rustdesk-api/utils"
|
"github.com/lejianwen/rustdesk-api/v2/utils"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package api
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
request "github.com/lejianwen/rustdesk-api/http/request/api"
|
request "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
apiReq "github.com/lejianwen/rustdesk-api/http/request/api"
|
apiReq "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
|
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
|
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
|
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/request/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
|
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package api
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
requstform "github.com/lejianwen/rustdesk-api/http/request/api"
|
requstform "github.com/lejianwen/rustdesk-api/v2/http/request/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
|
apiResp "github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/response/api"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package http
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/middleware"
|
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
|
||||||
"github.com/lejianwen/rustdesk-api/http/router"
|
"github.com/lejianwen/rustdesk-api/v2/http/router"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdminAuth 后台权限验证中间件
|
// AdminAuth 后台权限验证中间件
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdminPrivilege ...
|
// AdminPrivilege ...
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/response"
|
"github.com/lejianwen/rustdesk-api/v2/http/response"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
func JwtAuth() gin.HandlerFunc {
|
func JwtAuth() gin.HandlerFunc {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/service"
|
"github.com/lejianwen/rustdesk-api/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RustAuth() gin.HandlerFunc {
|
func RustAuth() gin.HandlerFunc {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package admin
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddressBookForm struct {
|
type AddressBookForm struct {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type GroupForm struct {
|
type GroupForm struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BindOauthForm struct {
|
type BindOauthForm struct {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type PeerForm struct {
|
type PeerForm struct {
|
||||||
RowId uint `json:"row_id" `
|
RowId uint `json:"row_id" `
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type TagForm struct {
|
type TagForm struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserForm struct {
|
type UserForm struct {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type AddressBookFormData struct {
|
type AddressBookFormData struct {
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type LoginPayload struct {
|
type LoginPayload struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
type AbList struct {
|
type AbList struct {
|
||||||
Peers []*model.AddressBook `json:"peers,omitempty"`
|
Peers []*model.AddressBook `json:"peers,omitempty"`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GroupPeerPayload
|
GroupPeerPayload
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model"
|
import "github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pub enum UserStatus {
|
pub enum UserStatus {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package response
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"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"
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
_ "github.com/lejianwen/rustdesk-api/docs/admin"
|
_ "github.com/lejianwen/rustdesk-api/v2/docs/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/controller/admin"
|
"github.com/lejianwen/rustdesk-api/v2/http/controller/admin"
|
||||||
"github.com/lejianwen/rustdesk-api/http/controller/admin/my"
|
"github.com/lejianwen/rustdesk-api/v2/http/controller/admin/my"
|
||||||
"github.com/lejianwen/rustdesk-api/http/middleware"
|
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
|
||||||
swaggerFiles "github.com/swaggo/files"
|
swaggerFiles "github.com/swaggo/files"
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
_ "github.com/lejianwen/rustdesk-api/docs/api"
|
_ "github.com/lejianwen/rustdesk-api/v2/docs/api"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/controller/api"
|
"github.com/lejianwen/rustdesk-api/v2/http/controller/api"
|
||||||
"github.com/lejianwen/rustdesk-api/http/middleware"
|
"github.com/lejianwen/rustdesk-api/v2/http/middleware"
|
||||||
swaggerFiles "github.com/swaggo/files"
|
swaggerFiles "github.com/swaggo/files"
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/http/controller/web"
|
"github.com/lejianwen/rustdesk-api/v2/http/controller/web"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package orm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/logger"
|
"gorm.io/gorm/logger"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package orm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"gorm.io/driver/sqlite"
|
"gorm.io/driver/sqlite"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/logger"
|
"gorm.io/gorm/logger"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import "github.com/lejianwen/rustdesk-api/model/custom_types"
|
import "github.com/lejianwen/rustdesk-api/v2/model/custom_types"
|
||||||
|
|
||||||
// final String id;
|
// final String id;
|
||||||
// String hash; // personal ab hash password
|
// String hash; // personal ab hash password
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/model/custom_types"
|
"github.com/lejianwen/rustdesk-api/v2/model/custom_types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatusCode int
|
type StatusCode int
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package model
|
|||||||
|
|
||||||
type UserToken struct {
|
type UserToken struct {
|
||||||
IdModel
|
IdModel
|
||||||
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
|
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
|
||||||
DeviceUuid string `json:"device_uuid" gorm:"default:'';omitempty;"`
|
DeviceUuid string `json:"device_uuid" gorm:"default:'';omitempty;"`
|
||||||
DeviceId string `json:"device_id" gorm:"default:'';omitempty;"`
|
DeviceId string `json:"device_id" gorm:"default:'';omitempty;"`
|
||||||
Token string `json:"token" gorm:"default:'';not null;index"`
|
Token string `json:"token" gorm:"default:'';not null;index"`
|
||||||
ExpiredAt int64 `json:"expired_at" gorm:"default:0;not null;"`
|
ExpiredAt int64 `json:"expired_at" gorm:"default:0;not null;"`
|
||||||
TimeModel
|
TimeModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package service
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
"github.com/go-ldap/ldap/v3"
|
||||||
|
|
||||||
"github.com/lejianwen/rustdesk-api/config"
|
"github.com/lejianwen/rustdesk-api/v2/config"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/utils"
|
"github.com/lejianwen/rustdesk-api/v2/utils"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/github"
|
"golang.org/x/oauth2/github"
|
||||||
// "golang.org/x/oauth2/google"
|
// "golang.org/x/oauth2/google"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/lejianwen/rustdesk-api/global"
|
"github.com/lejianwen/rustdesk-api/v2/global"
|
||||||
"github.com/lejianwen/rustdesk-api/model"
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
||||||
"github.com/lejianwen/rustdesk-api/utils"
|
"github.com/lejianwen/rustdesk-api/v2/utils"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -52,7 +52,7 @@ func (us *UserService) InfoByUsernamePassword(username, password string) *model.
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return u
|
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")
|
global.Logger.Warn("Fallback to local database")
|
||||||
}
|
}
|
||||||
u := &model.User{}
|
u := &model.User{}
|
||||||
|
|||||||
Reference in New Issue
Block a user