mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-10 15:36:45 +08:00
feat: apply acme account use proxy (#8516)
This commit is contained in:
parent
4dfa421c1a
commit
b0a7efe9c3
4 changed files with 14 additions and 11 deletions
|
@ -130,14 +130,6 @@ func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{
|
||||||
Description: ap.GetDescription(ctx),
|
Description: ap.GetDescription(ctx),
|
||||||
}
|
}
|
||||||
appDTOs = append(appDTOs, appDTO)
|
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)
|
tags, err := getAppTags(ap.ID, lang)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -58,9 +58,10 @@ func initAcmeAccount() {
|
||||||
count, _, _ := acmeAccountService.Page(search)
|
count, _, _ := acmeAccountService.Page(search)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
createAcmeAccount := request.WebsiteAcmeAccountCreate{
|
createAcmeAccount := request.WebsiteAcmeAccountCreate{
|
||||||
Email: "acme@1paneldev.com",
|
Email: "acme@1paneldev.com",
|
||||||
Type: "letsencrypt",
|
Type: "letsencrypt",
|
||||||
KeyType: "2048",
|
KeyType: "2048",
|
||||||
|
UseProxy: true,
|
||||||
}
|
}
|
||||||
if _, err := acmeAccountService.Create(createAcmeAccount); err != nil {
|
if _, err := acmeAccountService.Create(createAcmeAccount); err != nil {
|
||||||
global.LOG.Errorf("create acme account error: %s", err.Error())
|
global.LOG.Errorf("create acme account error: %s", err.Error())
|
||||||
|
|
|
@ -2,6 +2,7 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
|
"encoding/base64"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/core/app/dto"
|
"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 {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
if entrance != "" {
|
||||||
|
entranceValue := base64.StdEncoding.EncodeToString([]byte(entrance))
|
||||||
|
c.SetCookie("SecurityEntrance", entranceValue, 0, "", "", false, true)
|
||||||
|
}
|
||||||
return res, "", nil
|
return res, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +104,10 @@ func (u *AuthService) MFALogin(c *gin.Context, info dto.MFALogin, entrance strin
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
if entrance != "" {
|
||||||
|
entranceValue := base64.StdEncoding.EncodeToString([]byte(entrance))
|
||||||
|
c.SetCookie("SecurityEntrance", entranceValue, 0, "", "", false, true)
|
||||||
|
}
|
||||||
return res, "", nil
|
return res, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,5 +236,6 @@ export namespace Setting {
|
||||||
version: string;
|
version: string;
|
||||||
isXpack: boolean;
|
isXpack: boolean;
|
||||||
isBound: boolean;
|
isBound: boolean;
|
||||||
|
name: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue