feat: 机器新增命令过滤配置、首页功能完善(操作记录与快捷操作)

This commit is contained in:
meilin.huang
2024-04-27 01:35:21 +08:00
parent a831614d5a
commit 653953ee76
75 changed files with 2224 additions and 895 deletions

View File

@@ -36,6 +36,8 @@ type MachineTermOp interface {
type machineTermOpAppImpl struct {
base.AppImpl[*entity.MachineTermOp, repository.MachineTermOp]
machineCmdConfApp MachineCmdConf `inject:"MachineCmdConfApp"`
}
// 注入MachineTermOpRepo
@@ -87,12 +89,17 @@ func (m *machineTermOpAppImpl) TermConn(ctx context.Context, cli *mcm.Cli, wsCon
LogCmd: cli.Info.EnableRecorder == 1,
}
// createTsParam.CmdFilterFuncs = []mcm.CmdFilterFunc{func(cmd string) error {
// if strings.HasPrefix(cmd, "rm") {
// return errorx.NewBiz("该命令已被禁用...")
// }
// return nil
// }}
cmdConfs := m.machineCmdConfApp.GetCmdConfsByMachineTags(cli.Info.TagPath...)
if len(cmdConfs) > 0 {
createTsParam.CmdFilterFuncs = []mcm.CmdFilterFunc{func(cmd string) error {
for _, cmdConf := range cmdConfs {
if cmdConf.CmdRegexp.Match([]byte(cmd)) {
return errorx.NewBiz("该命令已被禁用...")
}
}
return nil
}}
}
mts, err := mcm.NewTerminalSession(createTsParam)
if err != nil {