From d81c20f163f0884d04cd11e46221bfefc0ac9f22 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 14 Apr 2018 14:39:07 +0900 Subject: hostLowerは廃止してhostにlowerしたものを入れるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/remote/activitypub/objects/person.ts | 4 +--- src/remote/resolve-user.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/remote') diff --git a/src/remote/activitypub/objects/person.ts b/src/remote/activitypub/objects/person.ts index f7ec064cdb..6c060f879c 100644 --- a/src/remote/activitypub/objects/person.ts +++ b/src/remote/activitypub/objects/person.ts @@ -74,8 +74,7 @@ export async function createPerson(value: any, resolver?: Resolver): Promise matched.toLowerCase()); + const host = toUnicode(finger.subject.replace(/^.*?@/, '')).toLowerCase(); const summaryDOM = JSDOM.fragment(person.summary); // Create user @@ -92,7 +91,6 @@ export async function createPerson(value: any, resolver?: Resolver): Promise { +export default async (username, _host, option) => { const usernameLower = username.toLowerCase(); - const hostLowerAscii = toASCII(host).toLowerCase(); - const hostLower = toUnicode(hostLowerAscii); + const hostAscii = toASCII(_host).toLowerCase(); + const host = toUnicode(hostAscii); - if (config.host == hostLower) { + if (config.host == host) { return await User.findOne({ usernameLower }); } - let user = await User.findOne({ usernameLower, hostLower }, option); + let user = await User.findOne({ usernameLower, host }, option); if (user === null) { - const acctLower = `${usernameLower}@${hostLowerAscii}`; + const acctLower = `${usernameLower}@${hostAscii}`; const finger = await webFinger(acctLower); const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self'); -- cgit v1.2.3-freya