Compare commits

...
2 Commits
Author SHA1 Message Date
UUBulb c58c4f866a do not check description file for theme-custom (#437)
* do not check description file for theme-custom

* deprecation note
2024-10-18 12:26:59 +08:00
UUBulb fc9f1b6bcc fix(ddns): handle second-level domain correctly (#438) 2024-10-18 12:26:43 +08:00
3 changed files with 13 additions and 1 deletions
+7
View File
@@ -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)
+1 -1
View File
@@ -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
} }
} }
+5
View File
@@ -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 {