From b0a7efe9c3af0baf7ba2ec1efe793c203759ff41 Mon Sep 17 00:00:00 2001 From: ChengPlay <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:13:00 +0800 Subject: [PATCH] feat: apply acme account use proxy (#8516) --- agent/app/service/app.go | 8 -------- agent/init/business/business.go | 7 ++++--- core/app/service/auth.go | 9 +++++++++ frontend/src/api/interface/setting.ts | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/agent/app/service/app.go b/agent/app/service/app.go index 10b01e854..88156e370 100644 --- a/agent/app/service/app.go +++ b/agent/app/service/app.go @@ -130,14 +130,6 @@ func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{ Description: ap.GetDescription(ctx), } appDTOs = append(appDTOs, appDTO) - appTags, err := appTagRepo.GetByAppId(ap.ID) - if err != nil { - continue - } - var tagIds []uint - for _, at := range appTags { - tagIds = append(tagIds, at.TagId) - } tags, err := getAppTags(ap.ID, lang) if err != nil { continue diff --git a/agent/init/business/business.go b/agent/init/business/business.go index 4786afcad..4986c1df1 100644 --- a/agent/init/business/business.go +++ b/agent/init/business/business.go @@ -58,9 +58,10 @@ func initAcmeAccount() { count, _, _ := acmeAccountService.Page(search) if count == 0 { createAcmeAccount := request.WebsiteAcmeAccountCreate{ - Email: "acme@1paneldev.com", - Type: "letsencrypt", - KeyType: "2048", + Email: "acme@1paneldev.com", + Type: "letsencrypt", + KeyType: "2048", + UseProxy: true, } if _, err := acmeAccountService.Create(createAcmeAccount); err != nil { global.LOG.Errorf("create acme account error: %s", err.Error()) diff --git a/core/app/service/auth.go b/core/app/service/auth.go index 64686eb10..726ab4bb1 100644 --- a/core/app/service/auth.go +++ b/core/app/service/auth.go @@ -2,6 +2,7 @@ package service import ( "crypto/hmac" + "encoding/base64" "strconv" "github.com/1Panel-dev/1Panel/core/app/dto" @@ -62,6 +63,10 @@ func (u *AuthService) Login(c *gin.Context, info dto.Login, entrance string) (*d if err != nil { return nil, "", err } + if entrance != "" { + entranceValue := base64.StdEncoding.EncodeToString([]byte(entrance)) + c.SetCookie("SecurityEntrance", entranceValue, 0, "", "", false, true) + } return res, "", nil } @@ -99,6 +104,10 @@ func (u *AuthService) MFALogin(c *gin.Context, info dto.MFALogin, entrance strin if err != nil { return nil, "", err } + if entrance != "" { + entranceValue := base64.StdEncoding.EncodeToString([]byte(entrance)) + c.SetCookie("SecurityEntrance", entranceValue, 0, "", "", false, true) + } return res, "", nil } diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index fa5d7aacd..fc699c60f 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -236,5 +236,6 @@ export namespace Setting { version: string; isXpack: boolean; isBound: boolean; + name: string; } }