mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 01:30:23 +01:00
Fix: 判定方法を後方一致から完全一致に変更
This commit is contained in:
parent
4893f663ff
commit
49d335016f
1 changed files with 8 additions and 2 deletions
|
@ -50,13 +50,19 @@ export class UtilityService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public isBlockedHost(blockedHosts: string[], host: string | null): boolean {
|
public isBlockedHost(blockedHosts: string[], host: string | null): boolean {
|
||||||
if (host == null) return false;
|
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
|
@bindThis
|
||||||
public isAllowedHost(allowedHosts: string[], host: string | null): boolean {
|
public isAllowedHost(allowedHosts: string[], host: string | null): boolean {
|
||||||
if (host == null) return false;
|
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
|
@bindThis
|
||||||
|
|
Loading…
Reference in a new issue