Added setting for customizing webshell start command

This commit is contained in:
0xJacky 2022-07-24 20:43:51 +08:00
parent 70e3f2d372
commit acc1aabaf7
5 changed files with 9 additions and 3 deletions

View file

@ -4,3 +4,4 @@ RunMode = debug
JwtSecret =
Email =
HTTPChallengePort = 9180
StartCmd = login

BIN
nginx-ui

Binary file not shown.

View file

@ -23,6 +23,7 @@ type Server struct {
HTTPChallengePort string
Email string
Database string
StartCmd string
Demo bool
}
@ -31,6 +32,7 @@ var ServerSettings = &Server{
RunMode: "debug",
HTTPChallengePort: "9180",
Database: "database",
StartCmd: "login",
Demo: false,
}

View file

@ -32,8 +32,10 @@ func ReloadNginx() string {
output := string(out)
log.Println(output)
return output
if strings.Contains(output, "failed") {
return output
}
return ""
}
func GetNginxConfPath(dir string) string {

View file

@ -2,6 +2,7 @@ package pty
import (
"encoding/json"
"github.com/0xJacky/Nginx-UI/server/settings"
"github.com/creack/pty"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
@ -24,7 +25,7 @@ type Message struct {
const bufferSize = 2048
func NewPipeLine(conn *websocket.Conn) (p *Pipeline, err error) {
c := exec.Command("login")
c := exec.Command(settings.ServerSettings.StartCmd)
ptmx, err := pty.StartWithSize(c, &pty.Winsize{Cols: 90, Rows: 60})
if err != nil {