From 6c3311ba3c0c1226f4b8bbd1046147986faa10f7 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:54:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=9F=E4=B8=80=E6=8A=BD=E5=B1=89?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=20(#6650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/app/service/backup_website.go | 2 +- agent/app/service/container.go | 3 +- agent/app/service/website_ca.go | 17 +- agent/app/service/website_utils.go | 3 + frontend/src/components/compose-log/index.vue | 115 +++++------ frontend/src/views/app-store/detail/index.vue | 13 +- .../src/views/app-store/installed/index.vue | 6 - .../views/container/container/log/index.vue | 97 ++++----- .../src/views/website/ssl/ca/detail/index.vue | 7 +- .../config/basic/proxy/create/index.vue | 195 ++++++++---------- 10 files changed, 203 insertions(+), 255 deletions(-) diff --git a/agent/app/service/backup_website.go b/agent/app/service/backup_website.go index e5ce7f527..fb574eba6 100644 --- a/agent/app/service/backup_website.go +++ b/agent/app/service/backup_website.go @@ -181,7 +181,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback } taskName := i18n.GetMsgByKey("TaskRecover") + i18n.GetMsgByKey("websiteDir") t.Log(taskName) - if err = handleUnTar(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetWebSiteRootDir(), ""); err != nil { + if err = handleUnTar(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetSitePath(*website, SiteDir), ""); err != nil { t.LogFailedWithErr(taskName, err) return err } diff --git a/agent/app/service/container.go b/agent/app/service/container.go index 1d79b7ad4..6483a9e1e 100644 --- a/agent/app/service/container.go +++ b/agent/app/service/container.go @@ -769,8 +769,7 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, containerType, commandName := "docker" commandArg := []string{"logs", container} if containerType == "compose" { - commandName = "docker compose" - commandArg = []string{"-f", container, "logs"} + commandArg = []string{"compose", "-f", container, "logs"} } if tail != "0" { commandArg = append(commandArg, "--tail") diff --git a/agent/app/service/website_ca.go b/agent/app/service/website_ca.go index 90bcf1251..6f1c09c53 100644 --- a/agent/app/service/website_ca.go +++ b/agent/app/service/website_ca.go @@ -10,6 +10,7 @@ import ( "crypto/x509/pkix" "encoding/pem" "fmt" + "github.com/1Panel-dev/1Panel/agent/utils/common" "log" "math/big" "net" @@ -26,7 +27,6 @@ import ( "github.com/1Panel-dev/1Panel/agent/global" "github.com/1Panel-dev/1Panel/agent/i18n" "github.com/1Panel-dev/1Panel/agent/utils/cmd" - "github.com/1Panel-dev/1Panel/agent/utils/common" "github.com/1Panel-dev/1Panel/agent/utils/files" "github.com/1Panel-dev/1Panel/agent/utils/ssl" "github.com/go-acme/lego/v4/certcrypto" @@ -218,15 +218,14 @@ func (w WebsiteCAService) ObtainSSL(req request.WebsiteCAObtain) (*model.Website if req.Domains != "" { domainArray := strings.Split(req.Domains, "\n") for _, domain := range domainArray { - if !common.IsValidDomain(domain) { - err = buserr.WithName("ErrDomainFormat", domain) - return nil, err - } else { - if ipAddress := net.ParseIP(domain); ipAddress == nil { - domains = append(domains, domain) - } else { - ips = append(ips, ipAddress) + if ipAddress := net.ParseIP(domain); ipAddress == nil { + if !common.IsValidDomain(domain) { + err = buserr.WithName("ErrDomainFormat", domain) + return nil, err } + domains = append(domains, domain) + } else { + ips = append(ips, ipAddress) } } if len(domains) > 0 { diff --git a/agent/app/service/website_utils.go b/agent/app/service/website_utils.go index 5710c11e2..6718c90d7 100644 --- a/agent/app/service/website_utils.go +++ b/agent/app/service/website_utils.go @@ -1206,6 +1206,7 @@ const ( SiteRedirectDir = "SiteRedirectDir" SiteCacheDir = "SiteCacheDir" SiteConfDir = "SiteConfDir" + SitesRootDir = "SitesRootDir" ) func GetSitePath(website model.Website, confType string) string { @@ -1234,6 +1235,8 @@ func GetSitePath(website model.Website, confType string) string { return path.Join(GteSiteDir(website.Alias), "redirect") case SiteConfDir: return path.Join(GetWebSiteRootDir(), "conf.d") + case SitesRootDir: + return path.Join(GetWebSiteRootDir(), "sites") } return "" } diff --git a/frontend/src/components/compose-log/index.vue b/frontend/src/components/compose-log/index.vue index 5d4c82b3d..05a5d78d9 100644 --- a/frontend/src/components/compose-log/index.vue +++ b/frontend/src/components/compose-log/index.vue @@ -1,54 +1,51 @@