/* ========================= DNS CACHE (mit TTL) ========================= */ const dnsCache = {} async function getDNS(domain){ const now = Date.now() const TTL = 30000 // 30 Sekunden if(dnsCache[domain] && (now - dnsCache[domain].time < TTL)){ return dnsCache[domain].ips } try{ const res = await api(API + "/dns/" + domain, {}, { showError: false }) const ips = res.ips || [] dnsCache[domain] = { ips: ips, time: now } return ips }catch(e){ dnsCache[domain] = { ips: [], time: now } return [] } } function dnsStatusMarkup(expectedIp, ips){ if(!ips.length){ return ` Kein DNS ` } const matches = expectedIp && ips.includes(expectedIp) const badgeClass = matches ? "ok" : "warn" const label = matches ? "DNS OK" : "DNS Abweichung" return ` ${label} ${ips.join(", ")} ` } function chipMarkup(label, muted = false){ return `` } /* ========================= DOMAINS + SUBDOMAINS ========================= */ window.loadDomains = async function(){ const domains = await api(API + "/domains") const subs = await api(API + "/subdomains") window.domainList = domains const resources = window.resources || [] const table = document.getElementById("domains") table.innerHTML = "" for(const d of domains){ const tr = document.createElement("tr") const domainSubs = subs.filter(s => s.domain_id === d.id) const sublist = domainSubs.length ? `