mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
Added setting for customizing webshell start command
This commit is contained in:
parent
70e3f2d372
commit
acc1aabaf7
5 changed files with 9 additions and 3 deletions
|
@ -4,3 +4,4 @@ RunMode = debug
|
||||||
JwtSecret =
|
JwtSecret =
|
||||||
Email =
|
Email =
|
||||||
HTTPChallengePort = 9180
|
HTTPChallengePort = 9180
|
||||||
|
StartCmd = login
|
||||||
|
|
BIN
nginx-ui
BIN
nginx-ui
Binary file not shown.
|
@ -23,6 +23,7 @@ type Server struct {
|
||||||
HTTPChallengePort string
|
HTTPChallengePort string
|
||||||
Email string
|
Email string
|
||||||
Database string
|
Database string
|
||||||
|
StartCmd string
|
||||||
Demo bool
|
Demo bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ var ServerSettings = &Server{
|
||||||
RunMode: "debug",
|
RunMode: "debug",
|
||||||
HTTPChallengePort: "9180",
|
HTTPChallengePort: "9180",
|
||||||
Database: "database",
|
Database: "database",
|
||||||
|
StartCmd: "login",
|
||||||
Demo: false,
|
Demo: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@ func ReloadNginx() string {
|
||||||
|
|
||||||
output := string(out)
|
output := string(out)
|
||||||
log.Println(output)
|
log.Println(output)
|
||||||
|
if strings.Contains(output, "failed") {
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func GetNginxConfPath(dir string) string {
|
func GetNginxConfPath(dir string) string {
|
||||||
out, err := exec.Command("nginx", "-V").CombinedOutput()
|
out, err := exec.Command("nginx", "-V").CombinedOutput()
|
||||||
|
|
|
@ -2,6 +2,7 @@ package pty
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/0xJacky/Nginx-UI/server/settings"
|
||||||
"github.com/creack/pty"
|
"github.com/creack/pty"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -24,7 +25,7 @@ type Message struct {
|
||||||
const bufferSize = 2048
|
const bufferSize = 2048
|
||||||
|
|
||||||
func NewPipeLine(conn *websocket.Conn) (p *Pipeline, err error) {
|
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})
|
ptmx, err := pty.StartWithSize(c, &pty.Winsize{Cols: 90, Rows: 60})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue