feat: manage TLSA records
Test / test (push) Successful in 28m4s
Build and publish image / image (push) Successful in 28m43s

This commit is contained in:
bryanpedini committed 2026-11-22 11:31:59 +01:00
1 parent 9c2fb9d15b
commit a67183b646
14 files changed
+141 -15

No files matched your search

+3 -2
View File
@@ -309,7 +309,8 @@ function buildTypeFields(type, values) {
let control;
const current = values[spec.key] === undefined || values[spec.key] === null ? "" : String(values[spec.key]);
if (spec.options) {
control = h("select", { id, name: spec.key }, spec.options.map(([value, label]) => option(value, label, value === current)));
const choices = current !== "" && !spec.options.some(([value]) => value === current) ? [...spec.options, [current, current]] : spec.options;
control = h("select", { id, name: spec.key }, choices.map(([value, label]) => option(value, label, value === current)));
} else if (spec.multiline) {
control = h("textarea", { id, name: spec.key, rows: 3, autocomplete: "off", spellcheck: "false", placeholder: spec.placeholder, value: current });
} else {
@@ -376,7 +377,7 @@ function recordBody(form) {
const data = {};
for (const spec of FIELD_SPECS[type] || []) {
const value = form.elements[spec.key].value;
data[spec.key] = spec.numeric || spec.options ? parseNumber(value) : spec.multiline || (type === "CAA" && spec.key === "value") ? value : value.trim();
data[spec.key] = spec.numeric || spec.options ? parseNumber(value) : spec.hex ? value.replace(/[\s:]/g, "").toLowerCase() : spec.multiline || (type === "CAA" && spec.key === "value") ? value : value.trim();
}
return { name: form.elements.name.value.trim(), type, ttl: parseNumber(form.elements.ttl.value), data };
}