Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c58c4f866a | ||
|
|
fc9f1b6bcc | ||
|
|
be7b6e9c5e |
@@ -96,6 +96,13 @@ func loadThirdPartyTemplates(tmpl *template.Template) *template.Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
themeDir := theme.Name()
|
themeDir := theme.Name()
|
||||||
|
if themeDir == "theme-custom" {
|
||||||
|
// for backward compatibility
|
||||||
|
// note: will remove this in future versions
|
||||||
|
ret = loadTemplates(ret, themeDir)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(themeDir, "dashboard-") {
|
if strings.HasPrefix(themeDir, "dashboard-") {
|
||||||
// load dashboard templates, ignore desc file
|
// load dashboard templates, ignore desc file
|
||||||
ret = loadTemplates(ret, themeDir)
|
ret = loadTemplates(ret, themeDir)
|
||||||
|
|||||||
@@ -781,6 +781,7 @@ type ddnsForm struct {
|
|||||||
AccessSecret string
|
AccessSecret string
|
||||||
WebhookURL string
|
WebhookURL string
|
||||||
WebhookMethod uint8
|
WebhookMethod uint8
|
||||||
|
WebhookRequestType uint8
|
||||||
WebhookRequestBody string
|
WebhookRequestBody string
|
||||||
WebhookHeaders string
|
WebhookHeaders string
|
||||||
}
|
}
|
||||||
@@ -809,6 +810,7 @@ func (ma *memberAPI) addOrEditDDNS(c *gin.Context) {
|
|||||||
p.AccessSecret = df.AccessSecret
|
p.AccessSecret = df.AccessSecret
|
||||||
p.WebhookURL = df.WebhookURL
|
p.WebhookURL = df.WebhookURL
|
||||||
p.WebhookMethod = df.WebhookMethod
|
p.WebhookMethod = df.WebhookMethod
|
||||||
|
p.WebhookRequestType = df.WebhookRequestType
|
||||||
p.WebhookRequestBody = df.WebhookRequestBody
|
p.WebhookRequestBody = df.WebhookRequestBody
|
||||||
p.WebhookHeaders = df.WebhookHeaders
|
p.WebhookHeaders = df.WebhookHeaders
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ var ProviderList = []DDNSProvider{
|
|||||||
AccessSecret: true,
|
AccessSecret: true,
|
||||||
WebhookURL: true,
|
WebhookURL: true,
|
||||||
WebhookMethod: true,
|
WebhookMethod: true,
|
||||||
|
WebhookRequestType: true,
|
||||||
WebhookRequestBody: true,
|
WebhookRequestBody: true,
|
||||||
WebhookHeaders: true,
|
WebhookHeaders: true,
|
||||||
},
|
},
|
||||||
@@ -93,6 +94,7 @@ type DDNSProvider struct {
|
|||||||
AccessSecret bool
|
AccessSecret bool
|
||||||
WebhookURL bool
|
WebhookURL bool
|
||||||
WebhookMethod bool
|
WebhookMethod bool
|
||||||
|
WebhookRequestType bool
|
||||||
WebhookRequestBody bool
|
WebhookRequestBody bool
|
||||||
WebhookHeaders bool
|
WebhookHeaders bool
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -108,7 +108,7 @@ func splitDomainSOA(domain string) (prefix string, zone string, err error) {
|
|||||||
if len(r.Answer) > 0 {
|
if len(r.Answer) > 0 {
|
||||||
if soa, ok := r.Answer[0].(*dns.SOA); ok {
|
if soa, ok := r.Answer[0].(*dns.SOA); ok {
|
||||||
zone = soa.Hdr.Name
|
zone = soa.Hdr.Name
|
||||||
prefix = domain[:len(domain)-len(zone)-1]
|
prefix = libdns.RelativeName(domain, zone)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ func TestSplitDomainSOA(t *testing.T) {
|
|||||||
zone: "example.com.",
|
zone: "example.com.",
|
||||||
prefix: "abc",
|
prefix: "abc",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
domain: "example.com",
|
||||||
|
zone: "example.com.",
|
||||||
|
prefix: "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
|
|||||||
@@ -159,6 +159,8 @@ func (provider *Provider) formatWebhookString(s string) string {
|
|||||||
"#domain#", provider.domain,
|
"#domain#", provider.domain,
|
||||||
"#type#", provider.ipType,
|
"#type#", provider.ipType,
|
||||||
"#record#", provider.recordType,
|
"#record#", provider.recordType,
|
||||||
|
"#access_id#", provider.DDNSProfile.AccessID,
|
||||||
|
"#access_secret#", provider.DDNSProfile.AccessSecret,
|
||||||
"\r", "",
|
"\r", "",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
@@ -670,6 +670,9 @@ other = "Webhook URL"
|
|||||||
[WebhookMethod]
|
[WebhookMethod]
|
||||||
other = "Webhook Request Method"
|
other = "Webhook Request Method"
|
||||||
|
|
||||||
|
[WebhookRequestType]
|
||||||
|
other = "Webhook Request Type"
|
||||||
|
|
||||||
[WebhookHeaders]
|
[WebhookHeaders]
|
||||||
other = "Webhook Request Headers"
|
other = "Webhook Request Headers"
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
@@ -670,6 +670,9 @@ other = "URL del Webhook"
|
|||||||
[WebhookMethod]
|
[WebhookMethod]
|
||||||
other = "Método de Solicitud del Webhook"
|
other = "Método de Solicitud del Webhook"
|
||||||
|
|
||||||
|
[WebhookRequestType]
|
||||||
|
other = "Tipo de solicitud del Webhook"
|
||||||
|
|
||||||
[WebhookHeaders]
|
[WebhookHeaders]
|
||||||
other = "Encabezados de Solicitud del Webhook"
|
other = "Encabezados de Solicitud del Webhook"
|
||||||
|
|
||||||
|
|||||||
Vendored
+8
-5
@@ -632,22 +632,22 @@ other = "DDNS配置"
|
|||||||
other = "新配置"
|
other = "新配置"
|
||||||
|
|
||||||
[EnableDDNS]
|
[EnableDDNS]
|
||||||
other = "启用DDNS"
|
other = "启用 DDNS"
|
||||||
|
|
||||||
[EnableIPv4]
|
[EnableIPv4]
|
||||||
other = "启用DDNS IPv4"
|
other = "启用 DDNS IPv4"
|
||||||
|
|
||||||
[EnableIPv6]
|
[EnableIPv6]
|
||||||
other = "启用DDNS IPv6"
|
other = "启用 DDNS IPv6"
|
||||||
|
|
||||||
[DDNSDomain]
|
[DDNSDomain]
|
||||||
other = "DDNS域名"
|
other = "DDNS 域名"
|
||||||
|
|
||||||
[DDNSDomains]
|
[DDNSDomains]
|
||||||
other = "域名(逗号分隔)"
|
other = "域名(逗号分隔)"
|
||||||
|
|
||||||
[DDNSProvider]
|
[DDNSProvider]
|
||||||
other = "DDNS供应商"
|
other = "DDNS 供应商"
|
||||||
|
|
||||||
[MaxRetries]
|
[MaxRetries]
|
||||||
other = "最大重试次数"
|
other = "最大重试次数"
|
||||||
@@ -670,6 +670,9 @@ other = "Webhook 地址"
|
|||||||
[WebhookMethod]
|
[WebhookMethod]
|
||||||
other = "Webhook 请求方式"
|
other = "Webhook 请求方式"
|
||||||
|
|
||||||
|
[WebhookRequestType]
|
||||||
|
other = "Webhook 请求类型"
|
||||||
|
|
||||||
[WebhookHeaders]
|
[WebhookHeaders]
|
||||||
other = "Webhook 请求头"
|
other = "Webhook 请求头"
|
||||||
|
|
||||||
|
|||||||
Vendored
+16
-13
@@ -632,49 +632,52 @@ other = "DDNS配置"
|
|||||||
other = "新增配置"
|
other = "新增配置"
|
||||||
|
|
||||||
[EnableDDNS]
|
[EnableDDNS]
|
||||||
other = "啟用DDNS"
|
other = "啟用 DDNS"
|
||||||
|
|
||||||
[EnableIPv4]
|
[EnableIPv4]
|
||||||
other = "啟用DDNS IPv4"
|
other = "啟用 DDNS IPv4"
|
||||||
|
|
||||||
[EnableIPv6]
|
[EnableIPv6]
|
||||||
other = "啟用DDNS IPv6"
|
other = "啟用 DDNS IPv6"
|
||||||
|
|
||||||
[DDNSDomain]
|
[DDNSDomain]
|
||||||
other = "DDNS域名"
|
other = "DDNS 域名"
|
||||||
|
|
||||||
[DDNSDomains]
|
[DDNSDomains]
|
||||||
other = "域名(逗號分隔)"
|
other = "域名(逗號分隔)"
|
||||||
|
|
||||||
[DDNSProvider]
|
[DDNSProvider]
|
||||||
other = "DDNS供應商"
|
other = "DDN S供應商"
|
||||||
|
|
||||||
[MaxRetries]
|
[MaxRetries]
|
||||||
other = "最大重試次數"
|
other = "最大重試次數"
|
||||||
|
|
||||||
[DDNSAccessID]
|
[DDNSAccessID]
|
||||||
other = "DDNS憑據1"
|
other = "DDNS 憑據 1"
|
||||||
|
|
||||||
[DDNSAccessSecret]
|
[DDNSAccessSecret]
|
||||||
other = "DDNS憑據2"
|
other = "DDNS 憑據 2"
|
||||||
|
|
||||||
[DDNSTokenID]
|
[DDNSTokenID]
|
||||||
other = "令牌ID"
|
other = "令牌 ID"
|
||||||
|
|
||||||
[DDNSTokenSecret]
|
[DDNSTokenSecret]
|
||||||
other = "令牌Secret"
|
other = "令牌 Secret"
|
||||||
|
|
||||||
[WebhookURL]
|
[WebhookURL]
|
||||||
other = "Webhook地址"
|
other = "Webhook 地址"
|
||||||
|
|
||||||
[WebhookMethod]
|
[WebhookMethod]
|
||||||
other = "Webhook請求方式"
|
other = "Webhook 請求方式"
|
||||||
|
|
||||||
|
[WebhookRequestType]
|
||||||
|
other = "Webhook 請求類型"
|
||||||
|
|
||||||
[WebhookHeaders]
|
[WebhookHeaders]
|
||||||
other = "Webhook請求頭"
|
other = "Webhook 請求頭"
|
||||||
|
|
||||||
[WebhookRequestBody]
|
[WebhookRequestBody]
|
||||||
other = "Webhook請求體"
|
other = "Webhook 請求體"
|
||||||
|
|
||||||
[Feature]
|
[Feature]
|
||||||
other = "功能"
|
other = "功能"
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
|||||||
item.name === "Duration" ||
|
item.name === "Duration" ||
|
||||||
item.name === "MaxRetries" ||
|
item.name === "MaxRetries" ||
|
||||||
item.name === "Provider" ||
|
item.name === "Provider" ||
|
||||||
item.name === "WebhookMethod"
|
item.name === "WebhookMethod" ||
|
||||||
|
item.name === "WebhookRequestType"
|
||||||
) {
|
) {
|
||||||
obj[item.name] = parseInt(item.value);
|
obj[item.name] = parseInt(item.value);
|
||||||
} else if (item.name.endsWith("Latency")) {
|
} else if (item.name.endsWith("Latency")) {
|
||||||
@@ -299,6 +300,9 @@ function addOrEditDDNS(ddns) {
|
|||||||
modal
|
modal
|
||||||
.find("select[name=WebhookMethod]")
|
.find("select[name=WebhookMethod]")
|
||||||
.val(ddns ? ddns.WebhookMethod : 1);
|
.val(ddns ? ddns.WebhookMethod : 1);
|
||||||
|
modal
|
||||||
|
.find("select[name=WebhookRequestType]")
|
||||||
|
.val(ddns ? ddns.WebhookRequestType : 1);
|
||||||
if (ddns && ddns.EnableIPv4) {
|
if (ddns && ddns.EnableIPv4) {
|
||||||
modal.find(".ui.enableipv4.checkbox").checkbox("set checked");
|
modal.find(".ui.enableipv4.checkbox").checkbox("set checked");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+7
@@ -48,6 +48,13 @@
|
|||||||
<option value="5">PUT</option>
|
<option value="5">PUT</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label>{{tr "WebhookRequestType"}}</label>
|
||||||
|
<select name="WebhookRequestType" class="ui fluid dropdown">
|
||||||
|
<option value="1">JSON</option>
|
||||||
|
<option value="2">Form</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>{{tr "WebhookHeaders"}}</label>
|
<label>{{tr "WebhookHeaders"}}</label>
|
||||||
<textarea name="WebhookHeaders" placeholder='{"User-Agent":"Nezha-Agent"}'></textarea>
|
<textarea name="WebhookHeaders" placeholder='{"User-Agent":"Nezha-Agent"}'></textarea>
|
||||||
|
|||||||
Reference in New Issue
Block a user