This commit is contained in:
MeiMei 2019-10-28 20:34:01 +09:00 committed by syuilo
parent 7a94117d90
commit 4f2b4366f2
2 changed files with 19 additions and 14 deletions

View File

@ -3,7 +3,7 @@ import * as promiseLimit from 'promise-limit';
import config from '../../../config'; import config from '../../../config';
import Resolver from '../resolver'; import Resolver from '../resolver';
import { resolveImage } from './image'; import { resolveImage } from './image';
import { isCollectionOrOrderedCollection, isCollection, IPerson } from '../type'; import { isCollectionOrOrderedCollection, isCollection, IPerson, getApId } from '../type';
import { DriveFile } from '../../../models/entities/drive-file'; import { DriveFile } from '../../../models/entities/drive-file';
import { fromHtml } from '../../../mfm/fromHtml'; import { fromHtml } from '../../../mfm/fromHtml';
import { resolveNote, extractEmojis } from './note'; import { resolveNote, extractEmojis } from './note';
@ -152,11 +152,11 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
name: person.name, name: person.name,
isLocked: !!person.manuallyApprovesFollowers, isLocked: !!person.manuallyApprovesFollowers,
username: person.preferredUsername, username: person.preferredUsername,
usernameLower: person.preferredUsername.toLowerCase(), usernameLower: person.preferredUsername!.toLowerCase(),
host, host,
inbox: person.inbox, inbox: person.inbox,
sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined), sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
featured: person.featured, featured: person.featured ? getApId(person.featured) : undefined,
uri: person.id, uri: person.id,
tags, tags,
isBot, isBot,

View File

@ -100,17 +100,22 @@ export const validActor = ['Person', 'Service'];
export interface IPerson extends IObject { export interface IPerson extends IObject {
type: 'Person'; type: 'Person';
name: string; name?: string;
preferredUsername: string; preferredUsername?: string;
manuallyApprovesFollowers: boolean; manuallyApprovesFollowers?: boolean;
inbox: string; inbox?: string;
sharedInbox?: string; sharedInbox?: string; // 後方互換性のため
publicKey: any; publicKey: {
followers: any; id: string;
following: any; publicKeyPem: string;
featured?: any; };
outbox: any; followers?: string | ICollection | IOrderedCollection;
endpoints: any; following?: string | ICollection | IOrderedCollection;
featured?: string | IOrderedCollection;
outbox?: string | IOrderedCollection;
endpoints?: {
sharedInbox?: string;
};
} }
export const isCollection = (object: IObject): object is ICollection => export const isCollection = (object: IObject): object is ICollection =>