1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Stronger model typings

This commit is contained in:
Chocobozzz 2019-08-15 11:53:26 +02:00
parent 13176a07a9
commit 453e83ea5d
No known key found for this signature in database
GPG key ID: 583A612D890159BE
176 changed files with 2118 additions and 1133 deletions

View file

@ -3,6 +3,7 @@ import { getServerActor } from '../../../../helpers/utils'
import { ActorModel } from '../../../../models/activitypub/actor'
import { sha256 } from '../../../../helpers/core-utils'
import { HTTP_SIGNATURE } from '../../../../initializers/constants'
import { MActor } from '../../../../typings/models'
type Payload = { body: any, signatureActorId?: number }
@ -19,7 +20,8 @@ async function computeBody (payload: Payload) {
}
async function buildSignedRequestOptions (payload: Payload) {
let actor: ActorModel | null
let actor: MActor | null
if (payload.signatureActorId) {
actor = await ActorModel.load(payload.signatureActorId)
if (!actor) throw new Error('Unknown signature actor id.')