修复DDNS部分手动触发webhook失效问题.

This commit is contained in:
古大羊 2022-08-16 06:49:30 +08:00
parent 6b4cd37d1a
commit 7ef78d4bc5
1 changed files with 12 additions and 14 deletions

View File

@ -751,7 +751,7 @@ func netinterfaces(c *gin.Context) {
func webhookTest(c *gin.Context) { func webhookTest(c *gin.Context) {
key := c.Query("key") key := c.Query("key")
ddnsTask := config.GetDDNSTaskByKey(key) ddnsTask := ddnscore.GetDDNSTaskInfoByKey(key)
if ddnsTask == nil { if ddnsTask == nil {
c.JSON(http.StatusOK, gin.H{"ret": 1, "msg": fmt.Sprintf("找不到key对应的DDNS任务:%s", key)}) c.JSON(http.StatusOK, gin.H{"ret": 1, "msg": fmt.Sprintf("找不到key对应的DDNS任务:%s", key)})
@ -775,25 +775,23 @@ func webhookTest(c *gin.Context) {
return return
} }
// responseStr, err := config.WebhookTest(&ddnsTask.DDNSTask, responseStr, err := ddnscore.WebhookTest(ddnsTask,
// request.WebhookURL, request.WebhookURL,
// request.WebhookMethod, request.WebhookMethod,
// request.WebhookRequestBody, request.WebhookRequestBody,
// request.WebhookProxy, request.WebhookProxy,
// request.WebhookProxyAddr, request.WebhookProxyAddr,
// request.WebhookProxyUser, request.WebhookProxyUser,
// request.WebhookProxyPassword, request.WebhookProxyPassword,
// request.WebhookHeaders, request.WebhookHeaders,
// request.WebhookSuccessContent) request.WebhookSuccessContent)
//fmt.Printf("request:%s\n", request)
msg := "Webhook接口调用成功" msg := "Webhook接口调用成功"
if err != nil { if err != nil {
msg = err.Error() msg = err.Error()
} }
c.JSON(http.StatusOK, gin.H{"ret": 0, "msg": msg, "Response": "responseStr"}) c.JSON(http.StatusOK, gin.H{"ret": 0, "msg": msg, "Response": responseStr})
} }
func IPRegTest(c *gin.Context) { func IPRegTest(c *gin.Context) {