parent
							
								
									5f86509abc
								
							
						
					
					
						commit
						a6cfb5a7db
					
				
					 4 changed files with 14 additions and 7 deletions
				
			
		|  | @ -13,6 +13,7 @@ | ||||||
| - Misskey更新時にダイアログを表示するように | - Misskey更新時にダイアログを表示するように | ||||||
| 
 | 
 | ||||||
| ### Bugfixes | ### Bugfixes | ||||||
|  | - ActivityPub: アカウント削除アクティビティが配送されないことがある問題を修正 | ||||||
| 
 | 
 | ||||||
| ## 12.87.0 (2021/08/12) | ## 12.87.0 (2021/08/12) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ import { getJobInfo } from './get-job-info'; | ||||||
| import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues'; | import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues'; | ||||||
| import { ThinUser } from './types'; | import { ThinUser } from './types'; | ||||||
| import { IActivity } from '@/remote/activitypub/type'; | import { IActivity } from '@/remote/activitypub/type'; | ||||||
|  | import { getUserKeypair } from '@/misc/keypair-store'; | ||||||
| 
 | 
 | ||||||
| function renderError(e: Error): any { | function renderError(e: Error): any { | ||||||
| 	return { | 	return { | ||||||
|  | @ -59,12 +60,17 @@ objectStorageQueue | ||||||
| 	.on('error', (job: any, err: Error) => objectStorageLogger.error(`error ${err}`, { job, e: renderError(err) })) | 	.on('error', (job: any, err: Error) => objectStorageLogger.error(`error ${err}`, { job, e: renderError(err) })) | ||||||
| 	.on('stalled', (job) => objectStorageLogger.warn(`stalled id=${job.id}`)); | 	.on('stalled', (job) => objectStorageLogger.warn(`stalled id=${job.id}`)); | ||||||
| 
 | 
 | ||||||
| export function deliver(user: ThinUser, content: unknown, to: string | null) { | export async function deliver(user: ThinUser, content: unknown, to: string | null) { | ||||||
| 	if (content == null) return null; | 	if (content == null) return null; | ||||||
| 	if (to == null) return null; | 	if (to == null) return null; | ||||||
| 
 | 
 | ||||||
|  | 	const keypair = await getUserKeypair(user.id); | ||||||
|  | 
 | ||||||
| 	const data = { | 	const data = { | ||||||
| 		user, | 		user: { | ||||||
|  | 			...user, | ||||||
|  | 			privateKey: keypair.privateKey, | ||||||
|  | 		}, | ||||||
| 		content, | 		content, | ||||||
| 		to | 		to | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | @ -5,7 +5,9 @@ import * as httpSignature from 'http-signature'; | ||||||
| 
 | 
 | ||||||
| export type DeliverJobData = { | export type DeliverJobData = { | ||||||
| 	/** Actor */ | 	/** Actor */ | ||||||
| 	user: ThinUser; | 	user: ThinUser & { | ||||||
|  | 		privateKey: string; | ||||||
|  | 	}; | ||||||
| 	/** Activity */ | 	/** Activity */ | ||||||
| 	content: unknown; | 	content: unknown; | ||||||
| 	/** inbox URL to deliver */ | 	/** inbox URL to deliver */ | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ import got from 'got'; | ||||||
| import * as Got from 'got'; | import * as Got from 'got'; | ||||||
| import { getUserKeypair } from '@/misc/keypair-store'; | import { getUserKeypair } from '@/misc/keypair-store'; | ||||||
| 
 | 
 | ||||||
| export default async (user: { id: User['id'] }, url: string, object: any) => { | export default async (user: { id: User['id']; privateKey: string; }, url: string, object: any) => { | ||||||
| 	const timeout = 10 * 1000; | 	const timeout = 10 * 1000; | ||||||
| 
 | 
 | ||||||
| 	const { protocol, hostname, port, pathname, search } = new URL(url); | 	const { protocol, hostname, port, pathname, search } = new URL(url); | ||||||
|  | @ -22,8 +22,6 @@ export default async (user: { id: User['id'] }, url: string, object: any) => { | ||||||
| 	sha256.update(data); | 	sha256.update(data); | ||||||
| 	const hash = sha256.digest('base64'); | 	const hash = sha256.digest('base64'); | ||||||
| 
 | 
 | ||||||
| 	const keypair = await getUserKeypair(user.id); |  | ||||||
| 
 |  | ||||||
| 	await new Promise<void>((resolve, reject) => { | 	await new Promise<void>((resolve, reject) => { | ||||||
| 		const req = https.request({ | 		const req = https.request({ | ||||||
| 			agent: getAgentByUrl(new URL(`https://example.net`)), | 			agent: getAgentByUrl(new URL(`https://example.net`)), | ||||||
|  | @ -48,7 +46,7 @@ export default async (user: { id: User['id'] }, url: string, object: any) => { | ||||||
| 
 | 
 | ||||||
| 		sign(req, { | 		sign(req, { | ||||||
| 			authorizationHeaderName: 'Signature', | 			authorizationHeaderName: 'Signature', | ||||||
| 			key: keypair.privateKey, | 			key: user.privateKey, | ||||||
| 			keyId: `${config.url}/users/${user.id}#main-key`, | 			keyId: `${config.url}/users/${user.id}#main-key`, | ||||||
| 			headers: ['(request-target)', 'date', 'host', 'digest'] | 			headers: ['(request-target)', 'date', 'host', 'digest'] | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue