ResMan update

This commit is contained in:
ecki
2026-03-09 18:05:07 +01:00
parent aabdb61f51
commit a244225887
+30 -2
View File
@@ -345,7 +345,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<label>IP Adresse</label> <input id="domain_ip"> <label>IP Adresse</label> <input id="domain_ip">
<label>Jährliche Kosten</label> <input id="domain_cost"> <label>Jährliche Kosten</label> <input id="domain_cost" type="number" step="0.01">>
<label>Notizen</label> <label>Notizen</label>
@@ -843,9 +843,15 @@ if(cost){
cost=cost.replace(",",".") cost=cost.replace(",",".")
} }
let domain=document.getElementById("domain_name").value
/* https:// entfernen */
domain=domain.replace("https://","").replace("http://","").replace("/","")
const data={ const data={
domain_name:document.getElementById("domain_name").value, domain_name:domain,
provider:document.getElementById("domain_provider").value, provider:document.getElementById("domain_provider").value,
ip_address:document.getElementById("domain_ip").value, ip_address:document.getElementById("domain_ip").value,
yearly_cost:cost || null, yearly_cost:cost || null,
@@ -853,6 +859,8 @@ notes:document.getElementById("domain_notes").value
} }
/* speichern */
if(id){ if(id){
await fetch(API+"/domains/"+id,{ await fetch(API+"/domains/"+id,{
@@ -871,6 +879,25 @@ body:JSON.stringify(data)
} }
/* DNS automatisch prüfen */
try{
const dnsRes = await fetch(API+"/dns/"+domain)
const result = await dnsRes.json()
if(result.ips && result.ips.length){
data.ip_address=result.ips[0]
}
}catch(e){
console.log("DNS check failed")
}
closeDomainModal() closeDomainModal()
loadDomains() loadDomains()
@@ -880,6 +907,7 @@ loadCosts()
} }
async function deleteDomain(id){ async function deleteDomain(id){
await fetch(API+"/domains/"+id,{method:"DELETE"}) await fetch(API+"/domains/"+id,{method:"DELETE"})