summaryrefslogtreecommitdiff
path: root/src/remote
diff options
context:
space:
mode:
Diffstat (limited to 'src/remote')
-rw-r--r--src/remote/activitypub/request.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts
index 7264bef24c..df8eced13d 100644
--- a/src/remote/activitypub/request.ts
+++ b/src/remote/activitypub/request.ts
@@ -4,11 +4,13 @@ import { URL } from 'url';
import * as crypto from 'crypto';
import { lookup, IRunOptions } from 'lookup-dns-cache';
import * as promiseAny from 'promise-any';
+import { toUnicode } from 'punycode';
import config from '../../config';
import { ILocalUser } from '../../models/user';
import { publishApLogStream } from '../../services/stream';
import { apLogger } from './logger';
+import Instance from '../../models/instance';
export const logger = apLogger.createSubLogger('deliver');
@@ -19,6 +21,11 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
const { protocol, host, hostname, port, pathname, search } = new URL(url);
+ // ブロックしてたら中断
+ // TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく
+ const instance = await Instance.findOne({ host: toUnicode(host) });
+ if (instance && instance.isBlocked) return;
+
const data = JSON.stringify(object);
const sha256 = crypto.createHash('sha256');