Refactoring

This commit is contained in:
Armin 2019-02-28 03:43:44 +01:00
parent 067371581d
commit bb04ef0664
3 changed files with 6 additions and 7 deletions

View File

@ -339,7 +339,7 @@ export default class NitroDataSource {
let result = await this.client.mutate({
mutation: gql`
mutation {
CreatePost(content: "${postObject.content}", title: "${title}", id: "${postId}", activityId: "${activityId}") {
CreatePost(content: "${postObject.content}", contentExcerpt: "${trunc(postObject.content, 120)}", title: "${title}", id: "${postId}", activityId: "${activityId}") {
id
}
}

View File

@ -1,5 +1,4 @@
import express from 'express'
import { verifySignature } from '../security'
import { activityPub } from '../ActivityPub'
const debug = require('debug')('ea:inbox')
@ -12,8 +11,6 @@ router.post('/', async function (req, res, next) {
debug(`Content-Type = ${req.get('Content-Type')}`)
debug(`body = ${JSON.stringify(req.body, null, 2)}`)
debug(`Request headers = ${JSON.stringify(req.headers, null, 2)}`)
// TODO stop if signature validation fails
debug(`verify = ${await verifySignature(`${req.protocol}://${req.hostname}:${req.port}${req.originalUrl}`, req.headers)}`)
switch (req.body.type) {
case 'Create':
if (req.body.send) {

View File

@ -1,15 +1,16 @@
import user from './user'
import inbox from './inbox'
import webfinger from './webfinger'
import webFinger from './webFinger'
import express from 'express'
import cors from 'cors'
import verify from './verify'
const router = express.Router()
router.use('/.well-known/webfinger',
router.use('/.well-known/webFinger',
cors(),
express.urlencoded({ extended: true }),
webfinger
webFinger
)
router.use('/activitypub/users',
cors(),
@ -21,6 +22,7 @@ router.use('/activitypub/inbox',
cors(),
express.json({ type: ['application/activity+json', 'application/ld+json', 'application/json'] }),
express.urlencoded({ extended: true }),
verify,
inbox
)