fix: correctly allow resources from localhost

This commit is contained in:
Vendicated 2025-06-14 00:55:14 +02:00
parent b35b72c066
commit 2a398985cf
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
3 changed files with 11 additions and 9 deletions

View file

@ -375,13 +375,13 @@ export function CspErrorCard() {
const isImgurHtmlDomain = (url: string) => url.startsWith("https://imgur.com/");
const allowUrl = async (url: string) => {
const { origin: baseUrl, hostname } = new URL(url);
const { origin: baseUrl, host } = new URL(url);
const result = await VencordNative.csp.requestAddOverride(baseUrl, ["connect-src", "img-src", "style-src", "font-src"], "Vencord Themes");
if (result !== "ok") return;
CspBlockedUrls.forEach(url => {
if (new URL(url).hostname === hostname) {
if (new URL(url).host === host) {
CspBlockedUrls.delete(url);
}
});