mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-15 06:41:46 +08:00
chore: you saw nothing
This commit is contained in:
parent
3906ae8c2e
commit
03f48a6eae
@ -78,7 +78,6 @@ const renderer = {
|
||||
}
|
||||
},
|
||||
link({ href, title, tokens }) {
|
||||
console.log("link", href, title, tokens, linkout(href));
|
||||
return `<a href="${linkout(href)}"` + (title ? ` title="${title}">` : ">") + this.parser?.parseInline(tokens) + "DUM</a>";
|
||||
},
|
||||
} satisfies Partial<Renderer>;
|
||||
|
@ -9,31 +9,24 @@ const isSafeHost = (host: string) => {
|
||||
};
|
||||
|
||||
const isSafe = (urlString: string) => {
|
||||
console.log("safe?", urlString, useBackendData.security.safeDownloadHosts);
|
||||
if (!urlString) {
|
||||
console.log("1");
|
||||
return false;
|
||||
}
|
||||
if (urlString.startsWith("#") || urlString.startsWith("/")) {
|
||||
console.log("2");
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const url = new URL(urlString);
|
||||
const host = url.hostname;
|
||||
if (url.protocol?.startsWith("mailto")) {
|
||||
console.log("3");
|
||||
return true;
|
||||
} else if (!host || isSafeHost(host)) {
|
||||
console.log("4");
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
console.log("5");
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log("6");
|
||||
return false;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user