Files

165 lines
4.5 KiB
HTML
Raw Permalink Normal View History

2026-07-26 18:09:45 +00:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>DOMAIN STATUS LIST</title>
2026-07-26 19:12:49 +00:00
<link rel="icon" href="favicon.png" type="image/x-icon">
2026-07-26 18:09:45 +00:00
<style>
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 24px; }
table { border-collapse: collapse; width: 100%; max-width: 1100px; }
th, td { border: 1px solid #ddd; padding: 10px; vertical-align: top; }
th { background: #f6f7f9; text-align: left; }
.up { background: #e9fbe9; }
.degraded { background: #fff4e5; }
.down { background: #ffecec; }
.muted { color: #555; font-size: 0.95em; }
code { white-space: pre-wrap; word-break: break-word; }
button { margin-bottom: 12px; padding: 8px 12px; cursor: pointer; }
</style>
</head>
<body>
<h1>DOMAIN STATUS LIST</h1>
<p class="muted" id="lastChecked">Not checked yet</p>
<button id="checkBtn">CHECK NOW</button>
<table>
<thead>
<tr>
<th>DOMAIN</th>
<th>STATUS</th>
<th>DETAILS</th>
<th>URL</th>
</tr>
</thead>
<tbody id="rows"></tbody>
</table>
<script>
// DOMAINS
const targets = [
"servzero.net",
2026-07-26 18:42:38 +00:00
"servtx.net",
2026-07-26 18:09:45 +00:00
];
function normalize(url) {
url = String(url).trim();
if (!/^https?:\/\//i.test(url)) url = "https://" + url;
return url;
}
const timeoutMs = 5000;
async function checkOne(url) {
const controller = new AbortController();
const t = setTimeout(() => controller.abort(), timeoutMs);
// HEAD, GET AS FALLBACK
for (const method of ["HEAD", "GET"]) {
try {
const res = await fetch(url, {
method,
mode: "no-cors", // CORS WORKAROUND
redirect: "follow",
signal: controller.signal
});
clearTimeout(t);
const status = res.status;
const ok = (status === 0) ? true : status < 400;
return {
reachable: true,
httpCode: (status === 0 ? null : status),
status: ok ? "UP" : "DEGRADED",
detail: (status === 0 ? (method + " SUCCESS") : ("HTTP " + status))
};
} catch (e) {
continue;
}
}
clearTimeout(t);
return {
reachable: false,
httpCode: null,
status: "DOWN",
2026-07-26 18:42:38 +00:00
detail: "REQUEST FAILED: NO RESPONSE"
2026-07-26 18:09:45 +00:00
};
}
function hostFromUrl(url) {
try {
return new URL(url).host;
} catch {
return url;
}
}
function clsFor(status) {
if (status === "UP") return "up";
if (status === "DEGRADED") return "degraded";
return "down";
}
function renderEmpty() {
const tbody = document.getElementById("rows");
tbody.innerHTML = "";
for (const raw of targets) {
const url = normalize(raw);
const host = hostFromUrl(url);
const tr = document.createElement("tr");
tr.innerHTML = `
<td>${host}</td>
<td class="${clsFor("DOWN")}"><strong id="s-${CSS.escape(host)}">CHECKING...</strong></td>
<td><code id="d-${CSS.escape(host)}">-</code></td>
<td><a href="${url}" target="_blank" rel="noreferrer">${url}</a></td>
`;
tbody.appendChild(tr);
}
}
async function checkAll() {
document.getElementById("lastChecked").textContent =
"CHECKING...";
renderEmpty();
const tbody = document.getElementById("rows");
const hostList = targets.map(normalize).map(hostFromUrl);
const jobs = targets.map(async raw => {
const url = normalize(raw);
const host = hostFromUrl(url);
const r = await checkOne(url);
return { host, url, ...r };
});
const results = await Promise.all(jobs);
for (const r of results) {
const host = r.host;
const sEl = document.getElementById("s-" + CSS.escape(host));
const dEl = document.getElementById("d-" + CSS.escape(host));
const tr = sEl.closest("tr");
tr.querySelector("td:nth-child(2)").className = clsFor(r.status);
sEl.textContent = r.status;
dEl.textContent = r.detail || "-";
}
document.getElementById("lastChecked").textContent =
"CHECKED " + new Date().toLocaleString();
}
document.getElementById("checkBtn").addEventListener("click", checkAll);
// AUTORUN
checkAll();
</script>
</body>
</html>