インスタンスブロックチェック時のhostのnormalizeを統一 (#4669)
This commit is contained in:
		| @@ -12,6 +12,7 @@ import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-ins | ||||
| import Instance from '../../models/instance'; | ||||
| import instanceChart from '../../services/chart/instance'; | ||||
| import { validActor } from '../../remote/activitypub/type'; | ||||
| import { toDbHost } from '../../misc/convert-host'; | ||||
|  | ||||
| const logger = new Logger('inbox'); | ||||
|  | ||||
| @@ -47,7 +48,7 @@ export default async (job: Bull.Job): Promise<void> => { | ||||
|  | ||||
| 		// ブロックしてたら中断 | ||||
| 		// TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく | ||||
| 		const instance = await Instance.findOne({ host: host.toLowerCase() }); | ||||
| 		const instance = await Instance.findOne({ host: toDbHost(host) }); | ||||
| 		if (instance && instance.isBlocked) { | ||||
| 			logger.info(`Blocked request: ${host}`); | ||||
| 			return; | ||||
| @@ -66,7 +67,7 @@ export default async (job: Bull.Job): Promise<void> => { | ||||
|  | ||||
| 		// ブロックしてたら中断 | ||||
| 		// TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく | ||||
| 		const instance = await Instance.findOne({ host: host.toLowerCase() }); | ||||
| 		const instance = await Instance.findOne({ host: toDbHost(host) }); | ||||
| 		if (instance && instance.isBlocked) { | ||||
| 			logger.warn(`Blocked request: ${host}`); | ||||
| 			return; | ||||
|   | ||||
| @@ -4,13 +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'; | ||||
| import { toDbHost } from '../../misc/convert-host'; | ||||
|  | ||||
| export const logger = apLogger.createSubLogger('deliver'); | ||||
|  | ||||
| @@ -23,7 +23,7 @@ export default async (user: ILocalUser, url: string, object: any) => { | ||||
|  | ||||
| 	// ブロックしてたら中断 | ||||
| 	// TODO: いちいちデータベースにアクセスするのはコスト高そうなのでどっかにキャッシュしておく | ||||
| 	const instance = await Instance.findOne({ host: toUnicode(host) }); | ||||
| 	const instance = await Instance.findOne({ host: toDbHost(host) }); | ||||
| 	if (instance && instance.isBlocked) return; | ||||
|  | ||||
| 	const data = JSON.stringify(object); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MeiMei
					MeiMei