hostLowerは廃止してhostにlowerしたものを入れるように
This commit is contained in:
@ -74,8 +74,7 @@ export async function createPerson(value: any, resolver?: Resolver): Promise<IUs
|
||||
webFinger(person.id)
|
||||
]);
|
||||
|
||||
const host = toUnicode(finger.subject.replace(/^.*?@/, ''));
|
||||
const hostLower = host.replace(/[A-Z]+/, matched => 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<IUs
|
||||
username: person.preferredUsername,
|
||||
usernameLower: person.preferredUsername.toLowerCase(),
|
||||
host,
|
||||
hostLower,
|
||||
publicKey: {
|
||||
id: person.publicKey.id,
|
||||
publicKeyPem: person.publicKey.publicKeyPem
|
||||
|
@ -4,19 +4,19 @@ import webFinger from './webfinger';
|
||||
import config from '../config';
|
||||
import { createPerson } from './activitypub/objects/person';
|
||||
|
||||
export default async (username, host, option) => {
|
||||
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');
|
||||
|
Reference in New Issue
Block a user