mirror of https://github.com/allinssl/allinssl
修改工作流主方法,修改证书申请
parent
eb6172436c
commit
6a2d3f98cd
|
@ -125,3 +125,13 @@ func GetAccountList(c *gin.Context) {
|
||||||
}
|
}
|
||||||
public.SuccessData(c, accounts, total)
|
public.SuccessData(c, accounts, total)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCaList(c *gin.Context) {
|
||||||
|
cas, total, err := apply.GetCaList()
|
||||||
|
if err != nil {
|
||||||
|
public.FailMsg(c, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
public.SuccessData(c, cas, total)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -228,3 +228,34 @@ func GetAccountList(search, ca string, p, limit int64) ([]map[string]interface{}
|
||||||
|
|
||||||
return data, int(count), nil
|
return data, int(count), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCaList() ([]string, int, error) {
|
||||||
|
db, err := GetSqlite()
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, fmt.Errorf("failed to get sqlite: %w", err)
|
||||||
|
}
|
||||||
|
data, err := db.Field([]string{"type"}).GroupBy("type").Select()
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, fmt.Errorf("failed to get CA list: %w", err)
|
||||||
|
}
|
||||||
|
caList := []string{"letsencrypt", "buypass", "zerossl"}
|
||||||
|
for i := range data {
|
||||||
|
if data[i]["type"] == "Let's Encrypt" {
|
||||||
|
data[i]["type"] = "letsencrypt"
|
||||||
|
}
|
||||||
|
if !containsString(caList, data[i]["type"].(string)) {
|
||||||
|
caList = append(caList, data[i]["type"].(string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count := len(caList)
|
||||||
|
return caList, count, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func containsString(slice []string, target string) bool {
|
||||||
|
for _, v := range slice {
|
||||||
|
if v == target {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
@ -343,8 +343,15 @@ func GetAcmeClient(email, algorithm, eabId, ca string, httpClient *http.Client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var reg *registration.Resource
|
var (
|
||||||
|
reg *registration.Resource
|
||||||
|
Kid, HmacEncoded string
|
||||||
|
)
|
||||||
if eabData != nil {
|
if eabData != nil {
|
||||||
|
Kid = eabData["Kid"].(string)
|
||||||
|
HmacEncoded = eabData["HmacEncoded"].(string)
|
||||||
|
}
|
||||||
|
if Kid != "" && HmacEncoded != "" {
|
||||||
Kid := eabData["Kid"].(string)
|
Kid := eabData["Kid"].(string)
|
||||||
HmacEncoded := eabData["HmacEncoded"].(string)
|
HmacEncoded := eabData["HmacEncoded"].(string)
|
||||||
reg, err = client.Registration.RegisterWithExternalAccountBinding(registration.RegisterEABOptions{
|
reg, err = client.Registration.RegisterWithExternalAccountBinding(registration.RegisterEABOptions{
|
||||||
|
|
|
@ -83,10 +83,10 @@ func Deploy(cfg map[string]any, logger *public.Logger) error {
|
||||||
// 调用插件
|
// 调用插件
|
||||||
logger.Debug(fmt.Sprintf("调用插件%s:%s", pluginName, action))
|
logger.Debug(fmt.Sprintf("调用插件%s:%s", pluginName, action))
|
||||||
|
|
||||||
rep, err := CallPlugin(pluginName, action, pluginConfig, logger)
|
_, err = CallPlugin(pluginName, action, pluginConfig, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("调用插件失败:%v", err)
|
return fmt.Errorf("调用插件失败:%v", err)
|
||||||
}
|
}
|
||||||
fmt.Println(rep)
|
//fmt.Println(rep)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,6 +286,10 @@ func RunNode(node *WorkflowNode, ctx *ExecutionContext) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.ChildNode != nil {
|
if node.ChildNode != nil {
|
||||||
|
fromNodeData, ok := ctx.GetOutput(node.Id)
|
||||||
|
if ok && fromNodeData != nil && node.ChildNode.Config["fromNodeData"] == nil {
|
||||||
|
node.ChildNode.Config["fromNodeData"] = fromNodeData
|
||||||
|
}
|
||||||
return RunNode(node.ChildNode, ctx)
|
return RunNode(node.ChildNode, ctx)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -60,6 +60,7 @@ func Register(r *gin.Engine) {
|
||||||
acmeAccount := v1.Group("/acme_account")
|
acmeAccount := v1.Group("/acme_account")
|
||||||
{
|
{
|
||||||
acmeAccount.POST("/get_list", api.GetAccountList)
|
acmeAccount.POST("/get_list", api.GetAccountList)
|
||||||
|
acmeAccount.POST("/get_ca_list", api.GetCaList)
|
||||||
acmeAccount.POST("/add_account", api.AddAccount)
|
acmeAccount.POST("/add_account", api.AddAccount)
|
||||||
acmeAccount.POST("/del_account", api.DelAccount)
|
acmeAccount.POST("/del_account", api.DelAccount)
|
||||||
acmeAccount.POST("/upd_account", api.UpdateAccount)
|
acmeAccount.POST("/upd_account", api.UpdateAccount)
|
||||||
|
|
Loading…
Reference in New Issue