Skip to content

Commit 62daf1e

Browse files
authored
fix: improve ssh config file editing and include handling (#12398)
Refs #11899
1 parent f5e75d4 commit 62daf1e

19 files changed

Lines changed: 701 additions & 145 deletions

File tree

agent/app/api/v2/ssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ func (b *BaseApi) LoadSSHFile(c *gin.Context) {
249249
// @Tags SSH
250250
// @Summary Update host SSH setting by file
251251
// @Accept json
252-
// @Param request body dto.SSHConf true "request"
252+
// @Param request body dto.SSHConfUpdate true "request"
253253
// @Success 200
254254
// @Security ApiKeyAuth
255255
// @Security Timestamp
256256
// @Router /hosts/ssh/file/update [post]
257257
// @x-panel-log {"bodyKeys":["key"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置文件 [key]","formatEN":"update SSH conf [key]"}
258258
func (b *BaseApi) UpdateSSHByFile(c *gin.Context) {
259-
var req dto.SettingUpdate
259+
var req dto.SSHConfUpdate
260260
if err := helper.CheckBindAndValidate(&req, c); err != nil {
261261
return
262262
}

agent/app/dto/ssh.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import "time"
44

55
type SSHUpdate struct {
66
Key string `json:"key" validate:"required"`
7-
OldValue string `json:"oldValue"`
87
NewValue string `json:"newValue"`
98
}
109

@@ -50,6 +49,12 @@ type GenerateLoad struct {
5049
type SSHConf struct {
5150
File string `json:"file"`
5251
}
52+
53+
type SSHConfUpdate struct {
54+
Key string `json:"key" validate:"required"`
55+
Path string `json:"path"`
56+
Value string `json:"value"`
57+
}
5358
type SearchSSHLog struct {
5459
PageInfo
5560
Info string `json:"info"`

0 commit comments

Comments
 (0)