Fix: 判定方法を後方一致から完全一致に変更

This commit is contained in:
鴇峰 朔華 2024-11-30 15:33:35 +09:00
parent 4893f663ff
commit 49d335016f

View file

@ -50,13 +50,19 @@ export class UtilityService {
@bindThis
public isBlockedHost(blockedHosts: string[], host: string | null): boolean {
if (host == null) return false;
return blockedHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`));
return blockedHosts.some(x => {
if (x.startsWith('.')) return `.${host.toLowerCase()}`.endsWith(x);
return host.toLowerCase() === x;
});
}
@bindThis
public isAllowedHost(allowedHosts: string[], host: string | null): boolean {
if (host == null) return false;
return allowedHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`));
return allowedHosts.some(x => {
if (x.startsWith('.')) return `.${host.toLowerCase()}`.endsWith(x);
return host.toLowerCase() === x;
});
}
@bindThis