mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
feat: implement encrypted form handling and refactor backup restore logic
This commit is contained in:
parent
ed320f32cc
commit
8860f71bc7
15 changed files with 643 additions and 368 deletions
|
@ -1,10 +1,12 @@
|
|||
package nginx
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -74,6 +76,28 @@ func GetLastOutput() string {
|
|||
return lastOutput
|
||||
}
|
||||
|
||||
// GetModulesPath returns the nginx modules path
|
||||
func GetModulesPath() string {
|
||||
// First try to get from nginx -V output
|
||||
output := execCommand("nginx", "-V")
|
||||
if output != "" {
|
||||
// Look for --modules-path in the output
|
||||
if strings.Contains(output, "--modules-path=") {
|
||||
parts := strings.Split(output, "--modules-path=")
|
||||
if len(parts) > 1 {
|
||||
// Extract the path
|
||||
path := strings.Split(parts[1], " ")[0]
|
||||
// Remove quotes if present
|
||||
path = strings.Trim(path, "\"")
|
||||
return path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default path if not found
|
||||
return "/usr/lib/nginx/modules"
|
||||
}
|
||||
|
||||
func execShell(cmd string) (out string) {
|
||||
bytes, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput()
|
||||
out = string(bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue