upd: apply suggestions

This commit is contained in:
Marie 2024-10-04 08:41:23 +02:00
parent 323c075483
commit 4b31004c2b
No known key found for this signature in database
GPG Key ID: 7ADF6C9CD9A28555

View File

@ -21,8 +21,11 @@ export async function warningExternalWebsite(url: string) {
if (r) { if (r) {
return new RegExp(r[1], r[2]).test(url); return new RegExp(r[1], r[2]).test(url);
} else if (expression.includes(' ')) return expression.split(' ').every(keyword => url.includes(keyword)); } else if (expression.includes(' ')) {
else return domain.endsWith(expression); return expression.split(' ').every(keyword => url.includes(keyword));
} else {
return domain.endsWith(expression);
}
}); });
const isTrustedByUser = defaultStore.reactiveState.trustedDomains.value.includes(domain); const isTrustedByUser = defaultStore.reactiveState.trustedDomains.value.includes(domain);
@ -33,7 +36,7 @@ export async function warningExternalWebsite(url: string) {
url, url,
}, { }, {
done: result => { done: result => {
resolve(result ? result : { canceled: true }); resolve(result ?? { canceled: true });
}, },
closed: () => dispose(), closed: () => dispose(),
}); });