修改首页描述和api

pull/79/head^2
zhangchenhao 2025-05-09 14:36:28 +08:00
parent 400d7e6db8
commit c012704c9a
2 changed files with 5 additions and 2 deletions

View File

@ -113,9 +113,9 @@ func GetWorkflowHistory() ([]map[string]any, error) {
}
switch v["exec_type"] {
case "manual":
mode = "手动触发"
mode = "手动"
case "auto":
mode = "定时触发"
mode = "自动"
}
wk, err := s.Where("id=?", []interface{}{v["workflow_id"]}).Select()
if err != nil {

View File

@ -131,6 +131,7 @@ func checkApiKey(c *gin.Context) bool {
err := c.Bind(&form)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
c.Abort()
return false
}
if form.ApiToken == "" || form.Timestamp == "" {
@ -139,12 +140,14 @@ func checkApiKey(c *gin.Context) bool {
apiKey := public.GetSettingIgnoreError("api_key")
if apiKey == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "未开启api"})
c.Abort()
return false
}
// timestamp := time.Now().Unix()
ApiToken := generateSignature(form.Timestamp, apiKey)
if form.ApiToken != ApiToken {
c.JSON(http.StatusUnauthorized, gin.H{"error": "invalid token"})
c.Abort()
return false
}
// 这里可以添加其他的验证逻辑,比如检查时间戳是否过期等