mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Refactoring
This commit is contained in:
parent
067371581d
commit
bb04ef0664
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user