From 0bb59bd73b6d6ba92e0843f420bc80d830b07710 Mon Sep 17 00:00:00 2001 From: mei23 Date: Sun, 22 Apr 2018 00:41:07 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20Misskey=E5=90=8C=E5=A3=AB=E3=81=A7?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AD=E3=83=BC=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/queue/processors/http/process-inbox.ts | 5 +++++ src/remote/activitypub/request.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/queue/processors/http/process-inbox.ts b/src/queue/processors/http/process-inbox.ts index 75ff5918f..dfafe64a7 100644 --- a/src/queue/processors/http/process-inbox.ts +++ b/src/queue/processors/http/process-inbox.ts @@ -33,6 +33,11 @@ export default async (job: kue.Job, done): Promise => { } user = await User.findOne({ usernameLower: username, host: host.toLowerCase() }) as IRemoteUser; + + // アクティビティを送信してきたユーザーがまだMisskeyサーバーに登録されていなかったら登録する + if (user === null) { + user = await resolvePerson(activity.actor); + } } else { user = await User.findOne({ host: { $ne: null }, diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index 85f43eb91..e6861fdb3 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -40,5 +40,10 @@ export default (user: ILocalUser, url: string, object) => new Promise((resolve, keyId: `acct:${user.username}@${config.host}` }); + // Signature: Signature ... => Signature: ... + let sig = req.getHeader('Signature').toString(); + sig = sig.replace(/^Signature /, ''); + req.setHeader('Signature', sig); + req.end(JSON.stringify(object)); });