This commit is contained in:
Mateusz Gruszczyński committed 2026-10-13 21:29:57 +02:00
1 parent bb025dcf44
commit b0f211555a
74 files changed
+6089 -556

No files matched your search

+2 -1
View File
@@ -198,7 +198,8 @@ function memberRow(parent, value = { id: `origin-${parent.children.length + 1}`,
const id = field(main, "member-id", "vhMemberId", value.id, "text", { pattern: "[A-Za-z0-9_-]{1,64}", maxLength: 64 });
const url = field(main, "member-url", "vhUrl", value.url, "url", { maxLength: 512 });
field(main, "member-weight", "vhWeight", value.weight ?? 1, "number", { required: true, min: 1, max: 256 });
const protocol = field(main, "member-protocol", "vhProtocol", value.protocol || "http1", "select", { values: [["http1", "vhProtocolHttp1"], ["auto", "vhProtocolAuto"], ["http2", "vhProtocolHttp2"]] });
const protocol = field(main, "member-protocol", "vhProtocol", value.protocol || "http1", "select", { values: [["http1", "vhProtocolHttp1"], ["auto", "vhProtocolAuto"], ["http2", "vhProtocolHttp2"], ["h2", "vhProtocolH2Strict"]] });
attachOriginProtocolDetails(main, protocol, url);
const routing = el("div", undefined, "vh-wide vh-backend-switches"); main.append(routing);
const controls = {};
+20
View File
@@ -0,0 +1,20 @@
function attachOriginProtocolDetails(main, protocol, url) {
const transportInfo = el("small", undefined, "fine vh-wide vh-origin-protocol-info");
const compatibility = el("small", undefined, "fine vh-wide vh-origin-protocol-warning");
compatibility.dataset.i18n = "vhProtocolCompatibilityWarning";
compatibility.textContent = t("vhProtocolCompatibilityWarning");
main.append(transportInfo, compatibility);
const explainProtocol = () => {
const https = /^https:\/\//i.test(url.value.trim());
const name = protocol.value === "http1" ? "vhProtocolHttp1Details" :
protocol.value === "auto" ? (https ? "vhProtocolAutoHttpsDetails" : "vhProtocolAutoHttpDetails") :
protocol.value === "http2" ? (https ? "vhProtocolLegacyHttp2HttpsDetails" : "vhProtocolLegacyHttp2HttpDetails") :
(https ? "vhProtocolH2HttpsDetails" : "vhProtocolH2HttpDetails");
transportInfo.dataset.i18n = name;
transportInfo.textContent = t(name);
compatibility.hidden = protocol.value !== "http2" || !https;
};
protocol.addEventListener("change", explainProtocol);
url.addEventListener("input", explainProtocol);
explainProtocol();
}