From ddae6e089b6a7c0bf48a695b9af3572a4def9b52 Mon Sep 17 00:00:00 2001 From: Robin B Date: Sun, 21 Jun 2020 07:07:27 +0200 Subject: [PATCH 1/2] Update english nyaize (#6456) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update english nyaize * Update src/misc/nyaize.ts Co-authored-by: Acid Chicken (硫酸鶏) Co-authored-by: Acid Chicken (硫酸鶏) --- src/misc/nyaize.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/misc/nyaize.ts b/src/misc/nyaize.ts index 6ee3b6847..500d1db2c 100644 --- a/src/misc/nyaize.ts +++ b/src/misc/nyaize.ts @@ -3,7 +3,9 @@ export function nyaize(text: string): string { // ja-JP .replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ') // en-US - .replace(/morning/gi, 'mornyan').replace(/everyone/gi, 'everynyan') + .replace(/(?<=n)a/gi, x => x === 'A' ? 'YA' : 'ya') + .replace(/(?<=morn)ing/gi, x => x === 'ING' ? 'YAN' : 'yan') + .replace(/(?<=every)one/gi, x => x === 'ONE' ? 'NYAN' : 'nyan') // ko-KR .replace(/[나-낳]/g, match => String.fromCharCode( match.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0) From 95b3184d7e07ba8686d8c25a37afd0479880865b Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 21 Jun 2020 14:09:01 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=81=AE=E3=80=8C=E5=A0=B4=E6=89=80=E3=80=8D?= =?UTF-8?q?=E3=80=8C=E8=AA=95=E7=94=9F=E6=97=A5=E3=80=8D=E3=82=92=E9=80=A3?= =?UTF-8?q?=E5=90=88=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20Resove?= =?UTF-8?q?=20#6461=20(#6463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * AP birthday, location * unset is null * isCatを検証対象に --- src/remote/activitypub/models/person.ts | 8 ++++++++ src/remote/activitypub/renderer/index.ts | 3 +++ src/remote/activitypub/renderer/person.ts | 14 ++++++++++++-- src/remote/activitypub/type.ts | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 4b8fa9a55..a3093786d 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -138,6 +138,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise tag.toLowerCase()).splice(0, 32); + const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/); + const updates = { lastFetchedAt: new Date(), inbox: person.inbox, @@ -356,6 +362,8 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint url: getOneApHrefNullable(person.url), fields, description: person.summary ? htmlToMfm(person.summary, person.tag) : null, + birthday: bday ? bday[0] : null, + location: person['vcard:Address'] || null, }); // ハッシュタグ更新 diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts index e84a7d90a..cf0fd8d85 100644 --- a/src/remote/activitypub/renderer/index.ts +++ b/src/remote/activitypub/renderer/index.ts @@ -49,6 +49,9 @@ export const attachLdSignature = async (activity: any, user: ILocalUser): Promis '_misskey_reaction': 'misskey:_misskey_reaction', '_misskey_votes': 'misskey:_misskey_votes', '_misskey_talk': 'misskey:_misskey_talk', + 'isCat': 'misskey:isCat', + // vcard + vcard: 'http://www.w3.org/2006/vcard/ns#', }; activity['@context'].push(obj); diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts index bc8a462d2..87dca19ac 100644 --- a/src/remote/activitypub/renderer/person.ts +++ b/src/remote/activitypub/renderer/person.ts @@ -52,7 +52,7 @@ export async function renderPerson(user: ILocalUser) { const keypair = await UserKeypairs.findOne(user.id).then(ensure); - return { + const person = { type: isSystem ? 'Application' : user.isBot ? 'Service' : 'Person', id, inbox: `${id}/inbox`, @@ -73,5 +73,15 @@ export async function renderPerson(user: ILocalUser) { publicKey: renderKey(user, keypair, `#main-key`), isCat: user.isCat, 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; } diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts index d47a0967f..0533506cd 100644 --- a/src/remote/activitypub/type.ts +++ b/src/remote/activitypub/type.ts @@ -140,6 +140,8 @@ export interface IPerson extends IObject { endpoints?: { sharedInbox?: string; }; + 'vcard:bday'?: string; + 'vcard:Address'?: string; } export const isCollection = (object: IObject): object is ICollection =>