fix(app): layout height

This commit is contained in:
0xJacky 2023-11-26 18:21:17 +08:00
parent 91817a3a32
commit c1193a5b8c
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
2 changed files with 68 additions and 70 deletions

View file

@ -41,11 +41,12 @@ const lang = computed(() => {
const settings = useSettingsStore()
const is_theme_dark = computed(() => settings.theme == 'dark')
</script>
<template>
<a-config-provider :theme="{
algorithm: is_theme_dark?theme.darkAlgorithm:theme.defaultAlgorithm,
}" :locale="lang" :autoInsertSpaceInButton="false">
<a-layout style="min-height: 100%;">
<a-layout style="min-height: 100vh">
<div class="drawer-sidebar">
<a-drawer
:closable="false"

View file

@ -1,102 +1,99 @@
package nginx
import (
"github.com/0xJacky/Nginx-UI/server/internal/logger"
"github.com/0xJacky/Nginx-UI/server/settings"
"os/exec"
"path/filepath"
"regexp"
"github.com/0xJacky/Nginx-UI/server/internal/logger"
"github.com/0xJacky/Nginx-UI/server/settings"
"os/exec"
"path/filepath"
"regexp"
)
func execShell(cmdArgs ...string) (out string) {
cmd := []string{"-c"}
cmd = append(cmd, cmdArgs...)
bytes, err := exec.Command("/bin/sh", cmd...).CombinedOutput()
out = string(bytes)
if err != nil {
out += " " + err.Error()
}
return
func execShell(cmd string) (out string) {
bytes, err := exec.Command("/bin/sh -c", cmd).CombinedOutput()
out = string(bytes)
if err != nil {
out += " " + err.Error()
}
return
}
func TestConf() (out string) {
if settings.NginxSettings.TestConfigCmd != "" {
out = execShell(settings.NginxSettings.TestConfigCmd)
if settings.NginxSettings.TestConfigCmd != "" {
out = execShell(settings.NginxSettings.TestConfigCmd)
return
}
return
}
out = execShell("nginx", "-t")
out = execShell("nginx -t")
return
return
}
func Reload() (out string) {
if settings.NginxSettings.ReloadCmd != "" {
out = execShell(settings.NginxSettings.ReloadCmd)
return
}
if settings.NginxSettings.ReloadCmd != "" {
out = execShell(settings.NginxSettings.ReloadCmd)
return
}
out = execShell("nginx", "-s", "reload")
out = execShell("nginx -s reload")
return
return
}
func Restart() (out string) {
if settings.NginxSettings.RestartCmd != "" {
out = execShell(settings.NginxSettings.RestartCmd)
if settings.NginxSettings.RestartCmd != "" {
out = execShell(settings.NginxSettings.RestartCmd)
return
}
return
}
out = execShell("nginx", "-s", "reopen")
out = execShell("nginx -s reopen")
return
return
}
func GetConfPath(dir ...string) string {
var confPath string
var confPath string
if settings.NginxSettings.ConfigDir == "" {
out, err := exec.Command("nginx", "-V").CombinedOutput()
if err != nil {
logger.Error(err)
return ""
}
r, _ := regexp.Compile("--conf-path=(.*)/(.*.conf)")
match := r.FindStringSubmatch(string(out))
if len(match) < 1 {
logger.Error("nginx.GetConfPath len(match) < 1")
return ""
}
confPath = r.FindStringSubmatch(string(out))[1]
} else {
confPath = settings.NginxSettings.ConfigDir
}
if settings.NginxSettings.ConfigDir == "" {
out, err := exec.Command("nginx", "-V").CombinedOutput()
if err != nil {
logger.Error(err)
return ""
}
r, _ := regexp.Compile("--conf-path=(.*)/(.*.conf)")
match := r.FindStringSubmatch(string(out))
if len(match) < 1 {
logger.Error("nginx.GetConfPath len(match) < 1")
return ""
}
confPath = r.FindStringSubmatch(string(out))[1]
} else {
confPath = settings.NginxSettings.ConfigDir
}
return filepath.Join(confPath, filepath.Join(dir...))
return filepath.Join(confPath, filepath.Join(dir...))
}
func GetNginxPIDPath() string {
var confPath string
var confPath string
if settings.NginxSettings.PIDPath == "" {
out, err := exec.Command("nginx", "-V").CombinedOutput()
if err != nil {
logger.Error(err)
return ""
}
r, _ := regexp.Compile("--pid-path=(.*.pid)")
match := r.FindStringSubmatch(string(out))
if len(match) < 1 {
logger.Error("nginx.GetNginxPIDPath len(match) < 1")
return ""
}
confPath = r.FindStringSubmatch(string(out))[1]
} else {
confPath = settings.NginxSettings.PIDPath
}
if settings.NginxSettings.PIDPath == "" {
out, err := exec.Command("nginx", "-V").CombinedOutput()
if err != nil {
logger.Error(err)
return ""
}
r, _ := regexp.Compile("--pid-path=(.*.pid)")
match := r.FindStringSubmatch(string(out))
if len(match) < 1 {
logger.Error("nginx.GetNginxPIDPath len(match) < 1")
return ""
}
confPath = r.FindStringSubmatch(string(out))[1]
} else {
confPath = settings.NginxSettings.PIDPath
}
return confPath
return confPath
}