Browse Source

perf: 新增outgoing类型机器人下使用的放通逻辑 (#177)

Finly 2 years ago
parent
commit
830e43bf2d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      public/tools.go

+ 3 - 2
public/tools.go

@@ -79,10 +79,11 @@ func GetReadTime(t time.Time) string {
 
 func CheckRequest(ts, sg string) bool {
 	appSecrets := Config.AppSecrets
-	// 如果没有指定,则默认不做校验
-	if len(appSecrets) == 0 {
+	// 如果没有指定或者outgoing类型机器人下使用,则默认不做校验
+	if len(appSecrets) == 0 || sg == "" {
 		return true
 	}
+	// 校验appSecret
 	for _, secret := range appSecrets {
 		stringToSign := fmt.Sprintf("%s\n%s", ts, secret)
 		mac := hmac.New(sha256.New, []byte(secret))