fix(route): handle subdomain removal in URL construction for homepage items

This commit is contained in:
yusing
2025-08-18 20:46:59 +08:00
parent dfc2d5e35c
commit dfe0014609

View File

@@ -122,6 +122,9 @@ func HomepageItems(proto, hostname, categoryFilter, providerFilter string) homep
// append hostname if provided and only if alias is not FQDN
if hostname != "" && item.URL == "" {
if !strings.Contains(item.Alias, ".") {
if strings.Count(hostname, ".") > 1 {
_, hostname, _ = strings.Cut(hostname, ".") // remove the subdomain
}
item.URL = fmt.Sprintf("%s://%s.%s", proto, item.Alias, hostname)
}
}