Skip to content

Commit acc1aab

Browse files
committed
Added setting for customizing webshell start command
1 parent 70e3f2d commit acc1aab

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ RunMode = debug
44
JwtSecret =
55
Email =
66
HTTPChallengePort = 9180
7+
StartCmd = login

nginx-ui

240 Bytes
Binary file not shown.

server/settings/settings.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Server struct {
2323
HTTPChallengePort string
2424
Email string
2525
Database string
26+
StartCmd string
2627
Demo bool
2728
}
2829

@@ -31,6 +32,7 @@ var ServerSettings = &Server{
3132
RunMode: "debug",
3233
HTTPChallengePort: "9180",
3334
Database: "database",
35+
StartCmd: "login",
3436
Demo: false,
3537
}
3638

server/tool/nginx/nginx.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ func ReloadNginx() string {
3232

3333
output := string(out)
3434
log.Println(output)
35-
36-
return output
35+
if strings.Contains(output, "failed") {
36+
return output
37+
}
38+
return ""
3739
}
3840

3941
func GetNginxConfPath(dir string) string {

server/tool/pty/pipeline.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pty
22

33
import (
44
"encoding/json"
5+
"github.com/0xJacky/Nginx-UI/server/settings"
56
"github.com/creack/pty"
67
"github.com/gorilla/websocket"
78
"github.com/pkg/errors"
@@ -24,7 +25,7 @@ type Message struct {
2425
const bufferSize = 2048
2526

2627
func NewPipeLine(conn *websocket.Conn) (p *Pipeline, err error) {
27-
c := exec.Command("login")
28+
c := exec.Command(settings.ServerSettings.StartCmd)
2829

2930
ptmx, err := pty.StartWithSize(c, &pty.Winsize{Cols: 90, Rows: 60})
3031
if err != nil {

0 commit comments

Comments
 (0)