* AP birthday, location * unset is null * isCatを検証対象に
This commit is contained in:
parent
dc8eb7d4fe
commit
23e2a870cc
4 changed files with 25 additions and 2 deletions
|
@ -138,6 +138,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
||||||
|
|
||||||
const isBot = object.type === 'Service';
|
const isBot = object.type === 'Service';
|
||||||
|
|
||||||
|
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
let user: IRemoteUser;
|
let user: IRemoteUser;
|
||||||
try {
|
try {
|
||||||
|
@ -168,6 +170,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
||||||
description: person.summary ? htmlToMfm(person.summary, person.tag) : null,
|
description: person.summary ? htmlToMfm(person.summary, person.tag) : null,
|
||||||
url: getOneApHrefNullable(person.url),
|
url: getOneApHrefNullable(person.url),
|
||||||
fields,
|
fields,
|
||||||
|
birthday: bday ? bday[0] : null,
|
||||||
|
location: person['vcard:Address'] || null,
|
||||||
userHost: host
|
userHost: host
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -319,6 +323,8 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
||||||
|
|
||||||
const tags = extractApHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32);
|
const tags = extractApHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32);
|
||||||
|
|
||||||
|
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
|
||||||
|
|
||||||
const updates = {
|
const updates = {
|
||||||
lastFetchedAt: new Date(),
|
lastFetchedAt: new Date(),
|
||||||
inbox: person.inbox,
|
inbox: person.inbox,
|
||||||
|
@ -356,6 +362,8 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
||||||
url: getOneApHrefNullable(person.url),
|
url: getOneApHrefNullable(person.url),
|
||||||
fields,
|
fields,
|
||||||
description: person.summary ? htmlToMfm(person.summary, person.tag) : null,
|
description: person.summary ? htmlToMfm(person.summary, person.tag) : null,
|
||||||
|
birthday: bday ? bday[0] : null,
|
||||||
|
location: person['vcard:Address'] || null,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ハッシュタグ更新
|
// ハッシュタグ更新
|
||||||
|
|
|
@ -49,6 +49,9 @@ export const attachLdSignature = async (activity: any, user: ILocalUser): Promis
|
||||||
'_misskey_reaction': 'misskey:_misskey_reaction',
|
'_misskey_reaction': 'misskey:_misskey_reaction',
|
||||||
'_misskey_votes': 'misskey:_misskey_votes',
|
'_misskey_votes': 'misskey:_misskey_votes',
|
||||||
'_misskey_talk': 'misskey:_misskey_talk',
|
'_misskey_talk': 'misskey:_misskey_talk',
|
||||||
|
'isCat': 'misskey:isCat',
|
||||||
|
// vcard
|
||||||
|
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
||||||
};
|
};
|
||||||
|
|
||||||
activity['@context'].push(obj);
|
activity['@context'].push(obj);
|
||||||
|
|
|
@ -52,7 +52,7 @@ export async function renderPerson(user: ILocalUser) {
|
||||||
|
|
||||||
const keypair = await UserKeypairs.findOne(user.id).then(ensure);
|
const keypair = await UserKeypairs.findOne(user.id).then(ensure);
|
||||||
|
|
||||||
return {
|
const person = {
|
||||||
type: isSystem ? 'Application' : user.isBot ? 'Service' : 'Person',
|
type: isSystem ? 'Application' : user.isBot ? 'Service' : 'Person',
|
||||||
id,
|
id,
|
||||||
inbox: `${id}/inbox`,
|
inbox: `${id}/inbox`,
|
||||||
|
@ -73,5 +73,15 @@ export async function renderPerson(user: ILocalUser) {
|
||||||
publicKey: renderKey(user, keypair, `#main-key`),
|
publicKey: renderKey(user, keypair, `#main-key`),
|
||||||
isCat: user.isCat,
|
isCat: user.isCat,
|
||||||
attachment: attachment.length ? attachment : undefined
|
attachment: attachment.length ? attachment : undefined
|
||||||
};
|
} as any;
|
||||||
|
|
||||||
|
if (profile?.birthday) {
|
||||||
|
person['vcard:bday'] = profile.birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile?.location) {
|
||||||
|
person['vcard:Address'] = profile.location;
|
||||||
|
}
|
||||||
|
|
||||||
|
return person;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,8 @@ export interface IPerson extends IObject {
|
||||||
endpoints?: {
|
endpoints?: {
|
||||||
sharedInbox?: string;
|
sharedInbox?: string;
|
||||||
};
|
};
|
||||||
|
'vcard:bday'?: string;
|
||||||
|
'vcard:Address'?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isCollection = (object: IObject): object is ICollection =>
|
export const isCollection = (object: IObject): object is ICollection =>
|
||||||
|
|
Loading…
Reference in a new issue