diff --git a/README.md b/README.md
index 8de6a6e..af3721c 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
LOGO designed by 熊大 .
-
+
:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。
diff --git a/cmd/agent/pty/pty.go b/cmd/agent/pty/pty.go index c9d578c..81e7497 100644 --- a/cmd/agent/pty/pty.go +++ b/cmd/agent/pty/pty.go @@ -4,12 +4,15 @@ package pty import ( + "errors" "os" "os/exec" opty "github.com/creack/pty" ) +var defaultShells = []string{"zsh", "fish", "bash", "sh"} + type Pty struct { tty *os.File cmd *exec.Cmd @@ -19,9 +22,15 @@ func DownloadDependency() { } func Start() (*Pty, error) { - shellPath := os.Getenv("SHELL") + var shellPath string + for i := 0; i < len(defaultShells); i++ { + shellPath, _ = exec.LookPath(defaultShells[i]) + if shellPath != "" { + break + } + } if shellPath == "" { - shellPath = "sh" + return nil, errors.New("没有可用终端") } cmd := exec.Command(shellPath) cmd.Env = append(os.Environ(), "TERM=xterm") diff --git a/cmd/agent/pty/pty_windows.go b/cmd/agent/pty/pty_windows.go index 19b4c94..2190419 100644 --- a/cmd/agent/pty/pty_windows.go +++ b/cmd/agent/pty/pty_windows.go @@ -73,12 +73,12 @@ func Start() (*Pty, error) { if err != nil { return nil, err } - tty, err := winpty.Open(path, shellPath) + tty, err := winpty.OpenDefault(path, shellPath) return &Pty{tty: tty}, err } func (pty *Pty) Write(p []byte) (n int, err error) { - return pty.tty.StdIn.Read(p) + return pty.tty.StdIn.Write(p) } func (pty *Pty) Read(p []byte) (n int, err error) { diff --git a/resource/static/main.js b/resource/static/main.js index cd0d1ad..8292c14 100644 --- a/resource/static/main.js +++ b/resource/static/main.js @@ -163,6 +163,7 @@ function post(path, params, method = 'post') { const form = document.createElement('form'); form.method = method; form.action = path; + form.target = "_blank"; for (const key in params) { if (params.hasOwnProperty(key)) { @@ -176,6 +177,7 @@ function post(path, params, method = 'post') { document.body.appendChild(form); form.submit(); + document.removeChild(form); } function addOrEditServer(server, conf) { diff --git a/resource/template/common/footer.html b/resource/template/common/footer.html index 19fcc82..ef19ded 100644 --- a/resource/template/common/footer.html +++ b/resource/template/common/footer.html @@ -9,7 +9,7 @@ - +