Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
746e2a6052 | ||
|
|
dc03d5d83d | ||
|
|
b770ab178d | ||
|
|
fd7e022e88 | ||
|
|
ac5df6826b | ||
|
|
91908859bc |
@@ -76,7 +76,6 @@ COPY --from=builder-backend /app/release /app/
|
||||
COPY --from=builder-backend /app/conf /app/conf/
|
||||
COPY --from=builder-backend /app/resources /app/resources/
|
||||
COPY --from=builder-backend /app/docs /app/docs/
|
||||
COPY --from=builder-backend /app/http/templates /app/http/templates
|
||||
# Copy frontend build from builder2 stage
|
||||
COPY --from=builder-admin-frontend /frontend/dist/ /app/resources/admin/
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
| RUSTDESK_API_RUSTDESK_KEY | Rustdesk的key | 123456789 |
|
||||
| RUSTDESK_API_RUSTDESK_KEY_FILE | Rustdesk存放key的文件 | `./conf/data/id_ed25519.pub` |
|
||||
| RUSTDESK_API_RUSTDESK_WEBCLIENT<br/>_MAGIC_QUERYONLINE | Web client v2 中是否启用新的在线状态查询方法; `1`:启用,`0`:不启用,默认不启用 | `0` |
|
||||
| RUSTDESK_API_RUSTDESK_WS_HOST | 自定义Websocket Host | |
|
||||
| RUSTDESK_API_RUSTDESK_WS_HOST | 自定义Websocket Host | `wss://192.168.1.123:1234` |
|
||||
| ----PROXY配置----- | ---------- | ---------- |
|
||||
| RUSTDESK_API_PROXY_ENABLE | 是否启用代理:`false`, `true` | `false` |
|
||||
| RUSTDESK_API_PROXY_HOST | 代理地址 | `http://127.0.0.1:1080` |
|
||||
|
||||
@@ -185,7 +185,7 @@ The table below does not list all configurations. Please refer to the configurat
|
||||
| RUSTDESK_API_RUSTDESK_KEY | Rustdesk key | 123456789 |
|
||||
| RUSTDESK_API_RUSTDESK_KEY_FILE | Rustdesk key file | `./conf/data/id_ed25519.pub` |
|
||||
| RUSTDESK_API_RUSTDESK<br/>_WEBCLIENT_MAGIC_QUERYONLINE | New online query method is enabled in the web client v2; '1': Enabled, '0': Disabled, not enabled by default | `0` |
|
||||
| RUSTDESK_API_RUSTDESK_WS_HOST | Custom Websocket Host | |
|
||||
| RUSTDESK_API_RUSTDESK_WS_HOST | Custom Websocket Host | `wss://192.168.1.123:1234` |
|
||||
| ---- PROXY ----- | --------------- | ---------- |
|
||||
| RUSTDESK_API_PROXY_ENABLE | proxy_enable :`false`, `true` | `false` |
|
||||
| RUSTDESK_API_PROXY_HOST | proxy_host | `http://127.0.0.1:1080` |
|
||||
|
||||
@@ -51,6 +51,10 @@ var resetPwdCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
pwd := args[0]
|
||||
admin := service.AllService.UserService.InfoById(1)
|
||||
if admin.Id == 0 {
|
||||
global.Logger.Warn("user not found! ")
|
||||
return
|
||||
}
|
||||
err := service.AllService.UserService.UpdatePassword(admin, pwd)
|
||||
if err != nil {
|
||||
global.Logger.Error("reset password fail! ", err)
|
||||
@@ -77,6 +81,10 @@ var resetUserPwdCmd = &cobra.Command{
|
||||
return
|
||||
}
|
||||
u := service.AllService.UserService.InfoById(uint(uid))
|
||||
if u.Id == 0 {
|
||||
global.Logger.Warn("user not found! ")
|
||||
return
|
||||
}
|
||||
err = service.AllService.UserService.UpdatePassword(u, pwd)
|
||||
if err != nil {
|
||||
global.Logger.Warn("reset password fail! ", err)
|
||||
@@ -144,7 +152,6 @@ func InitGlobal() {
|
||||
MaxOpenConns: global.Config.Gorm.MaxOpenConns,
|
||||
})
|
||||
}
|
||||
DatabaseAutoUpdate()
|
||||
|
||||
//validator
|
||||
global.ApiInitValidator()
|
||||
@@ -167,6 +174,8 @@ func InitGlobal() {
|
||||
|
||||
//service
|
||||
service.New(&global.Config, global.DB, global.Logger, global.Jwt, global.Lock)
|
||||
|
||||
DatabaseAutoUpdate()
|
||||
}
|
||||
func DatabaseAutoUpdate() {
|
||||
version := 262
|
||||
|
||||
@@ -108,6 +108,12 @@ func (ct *Peer) List(c *gin.Context) {
|
||||
if query.Uuids != "" {
|
||||
tx.Where("uuid in (?)", query.Uuids)
|
||||
}
|
||||
if query.Username != "" {
|
||||
tx.Where("username like ?", "%"+query.Username+"%")
|
||||
}
|
||||
if query.Ip != "" {
|
||||
tx.Where("last_online_ip like ?", "%"+query.Ip+"%")
|
||||
}
|
||||
})
|
||||
response.Success(c, res)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func (i *Index) Heartbeat(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
//如果在40s以内则不更新
|
||||
if time.Now().Unix()-peer.LastOnlineTime > 40 {
|
||||
if time.Now().Unix()-peer.LastOnlineTime >= 30 {
|
||||
upp := &model.Peer{RowId: peer.RowId, LastOnlineTime: time.Now().Unix(), LastOnlineIp: c.ClientIP()}
|
||||
service.AllService.PeerService.Update(upp)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ type PeerQuery struct {
|
||||
Id string `json:"id" form:"id"`
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
Uuids string `json:"uuids" form:"uuids"`
|
||||
Ip string `json:"ip" form:"ip"`
|
||||
Username string `json:"username" form:"username"`
|
||||
}
|
||||
|
||||
type SimpleDataQuery struct {
|
||||
|
||||
@@ -30,6 +30,7 @@ var (
|
||||
ErrLdapBindFailed = errors.New("LdapBindFailed")
|
||||
ErrLdapToLocalUserFailed = errors.New("LdapToLocalUserFailed")
|
||||
ErrLdapCreateUserFailed = errors.New("LdapCreateUserFailed")
|
||||
ErrLdapPasswordNotMatch = errors.New("PasswordNotMatch")
|
||||
)
|
||||
|
||||
// LdapService is responsible for LDAP authentication and user synchronization.
|
||||
@@ -119,7 +120,7 @@ func (ls *LdapService) connectAndBindAdmin(cfg *config.Ldap) (*ldap.Conn, error)
|
||||
func (ls *LdapService) verifyCredentials(cfg *config.Ldap, username, password string) error {
|
||||
ldapConn, err := ls.connectAndBind(cfg, username, password)
|
||||
if err != nil {
|
||||
return err
|
||||
return ErrLdapPasswordNotMatch
|
||||
}
|
||||
defer ldapConn.Close()
|
||||
return nil
|
||||
@@ -136,6 +137,10 @@ func (ls *LdapService) Authenticate(username, password string) (*model.User, err
|
||||
return nil, ErrLdapUserDisabled
|
||||
}
|
||||
cfg := &Config.Ldap
|
||||
err = ls.verifyCredentials(cfg, ldapUser.Dn, password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := ls.mapToLocalUser(cfg, ldapUser)
|
||||
if err != nil {
|
||||
return nil, errors.Join(ErrLdapToLocalUserFailed, err)
|
||||
|
||||
@@ -126,7 +126,14 @@ func (ps *PeerService) GetUuidListByIDs(ids []uint) ([]string, error) {
|
||||
err := DB.Model(&model.Peer{}).
|
||||
Where("row_id in (?)", ids).
|
||||
Pluck("uuid", &uuids).Error
|
||||
return uuids, err
|
||||
//过滤uuids中的空字符串
|
||||
var newUuids []string
|
||||
for _, uuid := range uuids {
|
||||
if uuid != "" {
|
||||
newUuids = append(newUuids, uuid)
|
||||
}
|
||||
}
|
||||
return newUuids, err
|
||||
}
|
||||
|
||||
// BatchDelete 批量删除, 同时也应该删除token
|
||||
|
||||
Reference in New Issue
Block a user