www/caddy: Show only wildcard domains in subdomain selection, show only wildcard domains in handler selection if a subdomain is selected (#4646)

This commit is contained in:
Monviech
2025-04-16 08:20:54 +02:00
committed by GitHub
parent 3b2345c7df
commit efab3474f9
2 changed files with 26 additions and 0 deletions
@@ -302,6 +302,9 @@
<items>reverseproxy.reverse</items>
<display>FromDomain,FromPort</display>
<display_format>%s %s</display_format>
<filters>
<FromDomain>/^\*\./</FromDomain>
</filters>
</reverseproxy>
</Model>
</reverse>
@@ -336,6 +336,9 @@
.selectpicker('val', selectedDomains)
.selectpicker('refresh');
}
// Trigger to filter the dropdowns if subdomains are selected
$("#handle\\.subdomain").trigger("change");
}
});
@@ -387,6 +390,26 @@
});
});
// When subdomain is selected in handler show only wildcard domains
$("#handle\\.subdomain").on("change", function () {
const subdomainSelected = $("#handle\\.subdomain").val() !== "";
$("#handle\\.reverse").find("option").each(function () {
const isWildcard = $(this).text().includes("*.");
$(this).toggle(!subdomainSelected || isWildcard);
});
if (subdomainSelected) {
const selectedText = $("#handle\\.reverse").find("option:selected").text();
if (!selectedText.includes("*.")) {
// Clear selection if not a wildcard
$("#handle\\.reverse").val("").change();
}
}
$("#handle\\.reverse").selectpicker("refresh");
});
// Trigger bootgrid setup for handlers tab too (even if not active) to ensure command buttons always work
$('a[href="#handlers"]').trigger('shown.bs.tab');