publicKeyに配列が入ってもいいようにする
https://github.com/misskey-dev/misskey/pull/13950
This commit is contained in:
		| @@ -184,15 +184,24 @@ export class ApPersonService implements OnModuleInit { | |||||||
| 			throw new Error('invalid Actor: id has different host'); | 			throw new Error('invalid Actor: id has different host'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (x.publicKey) { | 		if (x.publicKey && typeof x.publicKey.id !== 'string') { | ||||||
| 			if (typeof x.publicKey.id !== 'string') { |  | ||||||
| 				throw new Error('invalid Actor: publicKey.id is not a string'); |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			const publicKeyIdHost = this.punyHost(x.publicKey.id); | 			const publicKeyIdHost = this.punyHost(x.publicKey.id); | ||||||
| 			if (publicKeyIdHost !== expectHost) { | 			if (publicKeyIdHost !== expectHost) { | ||||||
| 				throw new Error('invalid Actor: publicKey.id has different host'); | 				throw new Error('invalid Actor: publicKey.id has different host'); | ||||||
| 			} | 			} | ||||||
|  | 		} else if (x.publicKey && Array.isArray(x.publicKey)) { | ||||||
|  | 			for (const publicKey of x.publicKey) { | ||||||
|  | 				if (typeof publicKey.id !== 'string') { | ||||||
|  | 					throw new Error('invalid Actor: publicKey.id is not a string'); | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				const publicKeyIdHost = this.punyHost(publicKey.id); | ||||||
|  | 				if (publicKeyIdHost !== expectHost) { | ||||||
|  | 					throw new Error('invalid Actor: publicKey.id has different host'); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} else if (x.publicKey) { | ||||||
|  | 			throw new Error('invalid Actor: publicKey is not an object or an array'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (x.additionalPublicKeys) { | 		if (x.additionalPublicKeys) { | ||||||
| @@ -408,7 +417,7 @@ export class ApPersonService implements OnModuleInit { | |||||||
| 				if (person.publicKey) { | 				if (person.publicKey) { | ||||||
| 					const publicKeys = new Map<string, IKey>([ | 					const publicKeys = new Map<string, IKey>([ | ||||||
| 						...(person.additionalPublicKeys ? person.additionalPublicKeys.map(key => [key.id, key] as const) : []), | 						...(person.additionalPublicKeys ? person.additionalPublicKeys.map(key => [key.id, key] as const) : []), | ||||||
| 						[person.publicKey.id, person.publicKey], | 						...(Array.isArray(person.publicKey) ? person.publicKey.map(key => [key.id, key] as const) : [[person.publicKey.id, person.publicKey]] as const), | ||||||
| 					]); | 					]); | ||||||
|  |  | ||||||
| 					await transactionalEntityManager.save(Array.from(publicKeys.values(), key => new MiUserPublickey({ | 					await transactionalEntityManager.save(Array.from(publicKeys.values(), key => new MiUserPublickey({ | ||||||
|   | |||||||
| @@ -169,7 +169,7 @@ export interface IActor extends IObject { | |||||||
| 	discoverable?: boolean; | 	discoverable?: boolean; | ||||||
| 	inbox: string; | 	inbox: string; | ||||||
| 	sharedInbox?: string;	// 後方互換性のため | 	sharedInbox?: string;	// 後方互換性のため | ||||||
| 	publicKey?: IKey; | 	publicKey?: IKey | IKey[]; | ||||||
| 	additionalPublicKeys?: IKey[]; | 	additionalPublicKeys?: IKey[]; | ||||||
| 	followers?: string | ICollection | IOrderedCollection; | 	followers?: string | ICollection | IOrderedCollection; | ||||||
| 	following?: string | ICollection | IOrderedCollection; | 	following?: string | ICollection | IOrderedCollection; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 tamaina
					tamaina