feat: implement encrypted form handling and refactor backup restore logic

This commit is contained in:
Jacky 2025-03-29 14:33:05 +00:00
parent ed320f32cc
commit 8860f71bc7
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
15 changed files with 643 additions and 368 deletions

View file

@ -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)