mirror of
https://github.com/zhaojh329/rttys.git
synced 2026-02-27 09:53:21 +08:00
refactor: password not required for execute command
Usually, commands are executed in batches on multiple devices, but the password for each device is different. Therefore, the password parameter is removed. Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
+5
-6
@@ -95,17 +95,16 @@ func handleCmdReq(br *broker, c *gin.Context) {
|
||||
|
||||
params := jsoniter.Get(content, "params")
|
||||
|
||||
data := make([]string, 5)
|
||||
data := make([]string, 4)
|
||||
|
||||
data[0] = jsoniter.Get(content, "username").ToString()
|
||||
data[1] = jsoniter.Get(content, "password").ToString()
|
||||
data[2] = jsoniter.Get(content, "cmd").ToString()
|
||||
data[3] = token
|
||||
data[4] = string(byte(params.Size()))
|
||||
data[1] = jsoniter.Get(content, "cmd").ToString()
|
||||
data[2] = token
|
||||
data[3] = string(byte(params.Size()))
|
||||
|
||||
msg := []byte(strings.Join(data, string(byte(0))))
|
||||
|
||||
for i := 0; i < params.Size(); i++ {
|
||||
for i := range params.Size() {
|
||||
msg = append(msg, params.Get(i).ToString()...)
|
||||
msg = append(msg, 0)
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
<el-form-item :label="$t('Username')" prop="username">
|
||||
<el-input v-model="cmdData.username"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Password')" prop="password">
|
||||
<el-input type="password" v-model="cmdData.password" show-password/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Command')" prop="cmd">
|
||||
<el-input v-model.trim="cmdData.cmd"/>
|
||||
</el-form-item>
|
||||
@@ -130,7 +127,6 @@ export default {
|
||||
},
|
||||
cmdData: {
|
||||
username: '',
|
||||
password: '',
|
||||
cmd: '',
|
||||
params: [],
|
||||
currentParam: '',
|
||||
@@ -309,17 +305,18 @@ export default {
|
||||
doCmd() {
|
||||
(this.$refs['cmdForm']).validate(valid => {
|
||||
if (valid) {
|
||||
const selection = this.selection.filter(item => item.proto > 4)
|
||||
|
||||
this.cmdModal = false
|
||||
this.cmdStatus.modal = true
|
||||
this.cmdStatus.total = this.selection.length
|
||||
this.cmdStatus.execing = this.selection.length
|
||||
this.cmdStatus.total = selection.length
|
||||
this.cmdStatus.execing = selection.length
|
||||
this.cmdStatus.fail = 0
|
||||
this.cmdStatus.responses = []
|
||||
|
||||
this.selection.forEach(item => {
|
||||
selection.forEach(item => {
|
||||
const data = {
|
||||
username: this.cmdData.username,
|
||||
password: this.cmdData.password,
|
||||
cmd: this.cmdData.cmd,
|
||||
params: this.cmdData.params
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user