diff --git a/cmd/apimain.go b/cmd/apimain.go index 924f044..b541751 100644 --- a/cmd/apimain.go +++ b/cmd/apimain.go @@ -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) } }() diff --git a/config/ldap.go b/config/ldap.go index e165eb7..4d08607 100644 --- a/config/ldap.go +++ b/config/ldap.go @@ -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"` -} \ No newline at end of file +} diff --git a/config/oauth.go b/config/oauth.go index ff9272f..74aaffa 100644 --- a/config/oauth.go +++ b/config/oauth.go @@ -17,4 +17,4 @@ type OidcOauth struct { ClientId string `mapstructure:"client-id"` ClientSecret string `mapstructure:"client-secret"` RedirectUrl string `mapstructure:"redirect-url"` -} \ No newline at end of file +} diff --git a/global/global.go b/global/global.go index c888fa5..3c46d9c 100644 --- a/global/global.go +++ b/global/global.go @@ -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" diff --git a/global/i18n.go b/global/i18n.go index a7f2d46..82c395b 100644 --- a/global/i18n.go +++ b/global/i18n.go @@ -15,7 +15,6 @@ func InitI18n() { fileInfos, err := os.ReadDir(dir) if err != nil { panic(err) - return } for _, fileInfo := range fileInfos { //如果文件名不是.toml结尾 diff --git a/go.mod b/go.mod index a13eb90..c05d998 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/lejianwen/rustdesk-api +module github.com/lejianwen/rustdesk-api/v2 go 1.22 diff --git a/http/controller/admin/addressBook.go b/http/controller/admin/addressBook.go index 5f650cd..bf13a76 100644 --- a/http/controller/admin/addressBook.go +++ b/http/controller/admin/addressBook.go @@ -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" ) diff --git a/http/controller/admin/addressBookCollection.go b/http/controller/admin/addressBookCollection.go index deb1468..16396cd 100644 --- a/http/controller/admin/addressBookCollection.go +++ b/http/controller/admin/addressBookCollection.go @@ -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" ) diff --git a/http/controller/admin/addressBookCollectionRule.go b/http/controller/admin/addressBookCollectionRule.go index f02766a..e34304b 100644 --- a/http/controller/admin/addressBookCollectionRule.go +++ b/http/controller/admin/addressBookCollectionRule.go @@ -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" ) diff --git a/http/controller/admin/audit.go b/http/controller/admin/audit.go index 42a7a4d..6fe64a6 100644 --- a/http/controller/admin/audit.go +++ b/http/controller/admin/audit.go @@ -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" ) diff --git a/http/controller/admin/config.go b/http/controller/admin/config.go index 3fad31e..3032f1e 100644 --- a/http/controller/admin/config.go +++ b/http/controller/admin/config.go @@ -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" ) diff --git a/http/controller/admin/file.go b/http/controller/admin/file.go index f32ca12..ca9f60f 100644 --- a/http/controller/admin/file.go +++ b/http/controller/admin/file.go @@ -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" ) diff --git a/http/controller/admin/group.go b/http/controller/admin/group.go index e41730c..bf70ca9 100644 --- a/http/controller/admin/group.go +++ b/http/controller/admin/group.go @@ -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" ) diff --git a/http/controller/admin/login.go b/http/controller/admin/login.go index e3c4673..4a21f1b 100644 --- a/http/controller/admin/login.go +++ b/http/controller/admin/login.go @@ -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" diff --git a/http/controller/admin/loginLog.go b/http/controller/admin/loginLog.go index 27a5186..8d71f6b 100644 --- a/http/controller/admin/loginLog.go +++ b/http/controller/admin/loginLog.go @@ -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" ) diff --git a/http/controller/admin/my/addressBook.go b/http/controller/admin/my/addressBook.go index c84b4ce..1174d52 100644 --- a/http/controller/admin/my/addressBook.go +++ b/http/controller/admin/my/addressBook.go @@ -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" ) diff --git a/http/controller/admin/my/addressBookCollection.go b/http/controller/admin/my/addressBookCollection.go index e756805..f3b84ab 100644 --- a/http/controller/admin/my/addressBookCollection.go +++ b/http/controller/admin/my/addressBookCollection.go @@ -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" ) diff --git a/http/controller/admin/my/addressBookCollectionRule.go b/http/controller/admin/my/addressBookCollectionRule.go index 7c5ca79..c58a5f9 100644 --- a/http/controller/admin/my/addressBookCollectionRule.go +++ b/http/controller/admin/my/addressBookCollectionRule.go @@ -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" ) diff --git a/http/controller/admin/my/loginLog.go b/http/controller/admin/my/loginLog.go index d3f2bb0..ff7ea52 100644 --- a/http/controller/admin/my/loginLog.go +++ b/http/controller/admin/my/loginLog.go @@ -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" ) diff --git a/http/controller/admin/my/peer.go b/http/controller/admin/my/peer.go index dedca7e..e3b838e 100644 --- a/http/controller/admin/my/peer.go +++ b/http/controller/admin/my/peer.go @@ -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" ) diff --git a/http/controller/admin/my/shareRecord.go b/http/controller/admin/my/shareRecord.go index 6336569..54f7f23 100644 --- a/http/controller/admin/my/shareRecord.go +++ b/http/controller/admin/my/shareRecord.go @@ -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" ) diff --git a/http/controller/admin/my/tag.go b/http/controller/admin/my/tag.go index 657f6b5..8d867d5 100644 --- a/http/controller/admin/my/tag.go +++ b/http/controller/admin/my/tag.go @@ -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" ) diff --git a/http/controller/admin/oauth.go b/http/controller/admin/oauth.go index 1bab22c..eb2b4fc 100644 --- a/http/controller/admin/oauth.go +++ b/http/controller/admin/oauth.go @@ -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" ) diff --git a/http/controller/admin/peer.go b/http/controller/admin/peer.go index 0d71456..e9f9b38 100644 --- a/http/controller/admin/peer.go +++ b/http/controller/admin/peer.go @@ -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" diff --git a/http/controller/admin/rustdesk.go b/http/controller/admin/rustdesk.go index 96dc9a8..4556692 100644 --- a/http/controller/admin/rustdesk.go +++ b/http/controller/admin/rustdesk.go @@ -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 { diff --git a/http/controller/admin/shareRecord.go b/http/controller/admin/shareRecord.go index 293d83b..3d7038c 100644 --- a/http/controller/admin/shareRecord.go +++ b/http/controller/admin/shareRecord.go @@ -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" ) diff --git a/http/controller/admin/tag.go b/http/controller/admin/tag.go index 23cd0e9..decd80a 100644 --- a/http/controller/admin/tag.go +++ b/http/controller/admin/tag.go @@ -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" ) diff --git a/http/controller/admin/user.go b/http/controller/admin/user.go index ba1df48..4b389d9 100644 --- a/http/controller/admin/user.go +++ b/http/controller/admin/user.go @@ -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" ) diff --git a/http/controller/admin/userToken.go b/http/controller/admin/userToken.go index 4cbb5d5..ca230cc 100644 --- a/http/controller/admin/userToken.go +++ b/http/controller/admin/userToken.go @@ -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" ) diff --git a/http/controller/api/ab.go b/http/controller/api/ab.go index 0329c6e..e586385 100644 --- a/http/controller/api/ab.go +++ b/http/controller/api/ab.go @@ -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" diff --git a/http/controller/api/audit.go b/http/controller/api/audit.go index 1ffbbe5..a8c01dd 100644 --- a/http/controller/api/audit.go +++ b/http/controller/api/audit.go @@ -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" ) diff --git a/http/controller/api/group.go b/http/controller/api/group.go index 8cf6cf4..6efde55 100644 --- a/http/controller/api/group.go +++ b/http/controller/api/group.go @@ -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" ) diff --git a/http/controller/api/index.go b/http/controller/api/index.go index 007f856..248ccfe 100644 --- a/http/controller/api/index.go +++ b/http/controller/api/index.go @@ -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" diff --git a/http/controller/api/login.go b/http/controller/api/login.go index 8b4c323..f00a44c 100644 --- a/http/controller/api/login.go +++ b/http/controller/api/login.go @@ -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" ) diff --git a/http/controller/api/ouath.go b/http/controller/api/ouath.go index 6216e60..b1eaa41 100644 --- a/http/controller/api/ouath.go +++ b/http/controller/api/ouath.go @@ -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" ) diff --git a/http/controller/api/peer.go b/http/controller/api/peer.go index e96ff66..7c569ca 100644 --- a/http/controller/api/peer.go +++ b/http/controller/api/peer.go @@ -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" ) diff --git a/http/controller/api/user.go b/http/controller/api/user.go index 1611b06..9663c94 100644 --- a/http/controller/api/user.go +++ b/http/controller/api/user.go @@ -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" ) diff --git a/http/controller/api/webClient.go b/http/controller/api/webClient.go index 9fa0fa1..69aae45 100644 --- a/http/controller/api/webClient.go +++ b/http/controller/api/webClient.go @@ -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" ) diff --git a/http/controller/web/index.go b/http/controller/web/index.go index b06a27e..d2c093b 100644 --- a/http/controller/web/index.go +++ b/http/controller/web/index.go @@ -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" ) diff --git a/http/http.go b/http/http.go index c7a331f..d90549e 100644 --- a/http/http.go +++ b/http/http.go @@ -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" diff --git a/http/middleware/admin.go b/http/middleware/admin.go index 26e91fb..c621547 100644 --- a/http/middleware/admin.go +++ b/http/middleware/admin.go @@ -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 后台权限验证中间件 diff --git a/http/middleware/admin_privilege.go b/http/middleware/admin_privilege.go index 9531f36..f72be93 100644 --- a/http/middleware/admin_privilege.go +++ b/http/middleware/admin_privilege.go @@ -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 ... diff --git a/http/middleware/jwt.go b/http/middleware/jwt.go index 2ad2a09..288cc14 100644 --- a/http/middleware/jwt.go +++ b/http/middleware/jwt.go @@ -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 { diff --git a/http/middleware/logger.go b/http/middleware/logger.go index a32e28f..d22da85 100644 --- a/http/middleware/logger.go +++ b/http/middleware/logger.go @@ -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" ) diff --git a/http/middleware/rustauth.go b/http/middleware/rustauth.go index 99434f2..2d529aa 100644 --- a/http/middleware/rustauth.go +++ b/http/middleware/rustauth.go @@ -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 { diff --git a/http/request/admin/addressBook.go b/http/request/admin/addressBook.go index 89992cf..8337881 100644 --- a/http/request/admin/addressBook.go +++ b/http/request/admin/addressBook.go @@ -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 { diff --git a/http/request/admin/group.go b/http/request/admin/group.go index 931a93b..2b2125c 100644 --- a/http/request/admin/group.go +++ b/http/request/admin/group.go @@ -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"` diff --git a/http/request/admin/oauth.go b/http/request/admin/oauth.go index a9d0645..866b37a 100644 --- a/http/request/admin/oauth.go +++ b/http/request/admin/oauth.go @@ -1,7 +1,7 @@ package admin import ( - "github.com/lejianwen/rustdesk-api/model" + "github.com/lejianwen/rustdesk-api/v2/model" ) type BindOauthForm struct { diff --git a/http/request/admin/peer.go b/http/request/admin/peer.go index 68de0ef..a368a14 100644 --- a/http/request/admin/peer.go +++ b/http/request/admin/peer.go @@ -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" ` diff --git a/http/request/admin/tag.go b/http/request/admin/tag.go index abac3b2..c1ef96f 100644 --- a/http/request/admin/tag.go +++ b/http/request/admin/tag.go @@ -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"` diff --git a/http/request/admin/user.go b/http/request/admin/user.go index 604fc4e..0e730ce 100644 --- a/http/request/admin/user.go +++ b/http/request/admin/user.go @@ -1,7 +1,7 @@ package admin import ( - "github.com/lejianwen/rustdesk-api/model" + "github.com/lejianwen/rustdesk-api/v2/model" ) type UserForm struct { diff --git a/http/request/api/audit.go b/http/request/api/audit.go index a64a2bb..e7d42c1 100644 --- a/http/request/api/audit.go +++ b/http/request/api/audit.go @@ -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" ) diff --git a/http/request/api/peer.go b/http/request/api/peer.go index b7d2d05..0b51181 100644 --- a/http/request/api/peer.go +++ b/http/request/api/peer.go @@ -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"` diff --git a/http/response/admin/user.go b/http/response/admin/user.go index 5bdfeff..8472fda 100644 --- a/http/response/admin/user.go +++ b/http/response/admin/user.go @@ -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"` diff --git a/http/response/api/ab.go b/http/response/api/ab.go index 828b7f1..9c0a85d 100644 --- a/http/response/api/ab.go +++ b/http/response/api/ab.go @@ -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"` diff --git a/http/response/api/peer.go b/http/response/api/peer.go index 703f699..f201bc9 100644 --- a/http/response/api/peer.go +++ b/http/response/api/peer.go @@ -1,6 +1,6 @@ package api -import "github.com/lejianwen/rustdesk-api/model" +import "github.com/lejianwen/rustdesk-api/v2/model" /* GroupPeerPayload diff --git a/http/response/api/user.go b/http/response/api/user.go index 772a0af..0f466bb 100644 --- a/http/response/api/user.go +++ b/http/response/api/user.go @@ -1,6 +1,6 @@ package api -import "github.com/lejianwen/rustdesk-api/model" +import "github.com/lejianwen/rustdesk-api/v2/model" /* pub enum UserStatus { diff --git a/http/response/api/webClient.go b/http/response/api/webClient.go index 8e85189..bb85a53 100644 --- a/http/response/api/webClient.go +++ b/http/response/api/webClient.go @@ -1,7 +1,7 @@ package api import ( - "github.com/lejianwen/rustdesk-api/model" + "github.com/lejianwen/rustdesk-api/v2/model" "time" ) diff --git a/http/response/response.go b/http/response/response.go index a86d2a5..ecf40ce 100644 --- a/http/response/response.go +++ b/http/response/response.go @@ -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" ) diff --git a/http/router/admin.go b/http/router/admin.go index 36eb915..fad66c5 100644 --- a/http/router/admin.go +++ b/http/router/admin.go @@ -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" ) diff --git a/http/router/api.go b/http/router/api.go index 6bd8be3..38a8ee4 100644 --- a/http/router/api.go +++ b/http/router/api.go @@ -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" diff --git a/http/router/router.go b/http/router/router.go index ba6d0d3..d887774 100644 --- a/http/router/router.go +++ b/http/router/router.go @@ -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" ) diff --git a/lib/orm/mysql.go b/lib/orm/mysql.go index 33d843a..c35d579 100644 --- a/lib/orm/mysql.go +++ b/lib/orm/mysql.go @@ -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" diff --git a/lib/orm/sqlite.go b/lib/orm/sqlite.go index 394e49b..69ef426 100644 --- a/lib/orm/sqlite.go +++ b/lib/orm/sqlite.go @@ -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" diff --git a/model/addressBook.go b/model/addressBook.go index 8017d3b..a0701b6 100644 --- a/model/addressBook.go +++ b/model/addressBook.go @@ -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 diff --git a/model/model.go b/model/model.go index e504d68..fe3cb9d 100644 --- a/model/model.go +++ b/model/model.go @@ -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 diff --git a/model/userToken.go b/model/userToken.go index fce216e..8fba177 100644 --- a/model/userToken.go +++ b/model/userToken.go @@ -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 } diff --git a/service/addressBook.go b/service/addressBook.go index aece31d..f6f88d9 100644 --- a/service/addressBook.go +++ b/service/addressBook.go @@ -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" ) diff --git a/service/audit.go b/service/audit.go index 6e005c4..acc3d80 100644 --- a/service/audit.go +++ b/service/audit.go @@ -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" ) diff --git a/service/group.go b/service/group.go index 9810d47..8291d9b 100644 --- a/service/group.go +++ b/service/group.go @@ -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" ) diff --git a/service/ldap.go b/service/ldap.go index 5fb7f15..337b6b5 100644 --- a/service/ldap.go +++ b/service/ldap.go @@ -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 ( diff --git a/service/loginLog.go b/service/loginLog.go index 9eb3aa6..719aaf0 100644 --- a/service/loginLog.go +++ b/service/loginLog.go @@ -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" ) diff --git a/service/oauth.go b/service/oauth.go index 7e40b23..f1d97aa 100644 --- a/service/oauth.go +++ b/service/oauth.go @@ -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" diff --git a/service/peer.go b/service/peer.go index 7c194a0..f2f5850 100644 --- a/service/peer.go +++ b/service/peer.go @@ -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" ) diff --git a/service/serverCmd.go b/service/serverCmd.go index 77c4ed8..5681054 100644 --- a/service/serverCmd.go +++ b/service/serverCmd.go @@ -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" ) diff --git a/service/service.go b/service/service.go index ab137ee..bfd01db 100644 --- a/service/service.go +++ b/service/service.go @@ -1,7 +1,7 @@ package service import ( - "github.com/lejianwen/rustdesk-api/model" + "github.com/lejianwen/rustdesk-api/v2/model" "gorm.io/gorm" ) diff --git a/service/shareRecord.go b/service/shareRecord.go index 8a02f6a..c6b5892 100644 --- a/service/shareRecord.go +++ b/service/shareRecord.go @@ -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" ) diff --git a/service/tag.go b/service/tag.go index fad947a..3443af9 100644 --- a/service/tag.go +++ b/service/tag.go @@ -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" ) diff --git a/service/user.go b/service/user.go index bcdc030..5d75006 100644 --- a/service/user.go +++ b/service/user.go @@ -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{}