This commit is contained in:
2025-10-27 14:28:52 +03:00
parent 302fbec3a2
commit a2adc9958a
3 changed files with 17 additions and 33 deletions

View File

@@ -76,36 +76,14 @@ let isPlaying = false;
if (!value) return "Bilinmiyor";
const raw = String(value).trim();
if (!raw) return "Bilinmiyor";
const normalise = (input) => {
try {
return new URL(input);
} catch {
try {
return new URL(`http://${input}`);
} catch {
return null;
}
}
};
const parsed = normalise(raw);
if (parsed) {
let host = parsed.hostname || "";
if (host.toLowerCase().startsWith("tracker.")) {
host = host.slice(8);
}
if (host) return host;
try {
const url = new URL(raw);
const host = url.hostname.replace(/^tracker\./i, "");
return host || raw;
} catch (err) {
const stripped = raw.replace(/^.*?:\/\//, "").replace(/\/.*$/, "");
return stripped.replace(/^tracker\./i, "") || raw;
}
const stripped = raw
.replace(/^.*?:\/\//, "")
.replace(/\/.*$/, "")
.replace(/:.*/, "");
if (stripped.toLowerCase().startsWith("tracker.")) {
return stripped.slice(8);
}
return stripped || raw;
}
function formatDateTime(value) {
if (!value) return "—";