Implement instance blocking (#4182)
* Implement instance blocking * Add missing text * Delete unnecessary file * Covert Punycode to Unicode
This commit is contained in:
parent
5a28632af7
commit
e6612f610c
7 changed files with 105 additions and 4 deletions
|
@ -45,6 +45,15 @@ export default async (job: bq.Job, done: any): Promise<void> => {
|
|||
return;
|
||||
}
|
||||
|
||||
// ブロックしてたら中断
|
||||
// TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく
|
||||
const instance = await Instance.findOne({ host: host.toLowerCase() });
|
||||
if (instance && instance.isBlocked) {
|
||||
logger.warn(`Blocked request: ${host}`);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
user = await User.findOne({ usernameLower: username, host: host.toLowerCase() }) as IRemoteUser;
|
||||
} else {
|
||||
// アクティビティ内のホストの検証
|
||||
|
@ -57,6 +66,15 @@ export default async (job: bq.Job, done: any): Promise<void> => {
|
|||
return;
|
||||
}
|
||||
|
||||
// ブロックしてたら中断
|
||||
// TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく
|
||||
const instance = await Instance.findOne({ host: host.toLowerCase() });
|
||||
if (instance && instance.isBlocked) {
|
||||
logger.warn(`Blocked request: ${host}`);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
user = await User.findOne({
|
||||
host: { $ne: null },
|
||||
'publicKey.id': signature.keyId
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue