mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-06 01:25:38 +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({
|
let result = await this.client.mutate({
|
||||||
mutation: gql`
|
mutation: gql`
|
||||||
mutation {
|
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
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { verifySignature } from '../security'
|
|
||||||
import { activityPub } from '../ActivityPub'
|
import { activityPub } from '../ActivityPub'
|
||||||
|
|
||||||
const debug = require('debug')('ea:inbox')
|
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(`Content-Type = ${req.get('Content-Type')}`)
|
||||||
debug(`body = ${JSON.stringify(req.body, null, 2)}`)
|
debug(`body = ${JSON.stringify(req.body, null, 2)}`)
|
||||||
debug(`Request headers = ${JSON.stringify(req.headers, 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) {
|
switch (req.body.type) {
|
||||||
case 'Create':
|
case 'Create':
|
||||||
if (req.body.send) {
|
if (req.body.send) {
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
import user from './user'
|
import user from './user'
|
||||||
import inbox from './inbox'
|
import inbox from './inbox'
|
||||||
import webfinger from './webfinger'
|
import webFinger from './webFinger'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import cors from 'cors'
|
import cors from 'cors'
|
||||||
|
import verify from './verify'
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.use('/.well-known/webfinger',
|
router.use('/.well-known/webFinger',
|
||||||
cors(),
|
cors(),
|
||||||
express.urlencoded({ extended: true }),
|
express.urlencoded({ extended: true }),
|
||||||
webfinger
|
webFinger
|
||||||
)
|
)
|
||||||
router.use('/activitypub/users',
|
router.use('/activitypub/users',
|
||||||
cors(),
|
cors(),
|
||||||
@ -21,6 +22,7 @@ router.use('/activitypub/inbox',
|
|||||||
cors(),
|
cors(),
|
||||||
express.json({ type: ['application/activity+json', 'application/ld+json', 'application/json'] }),
|
express.json({ type: ['application/activity+json', 'application/ld+json', 'application/json'] }),
|
||||||
express.urlencoded({ extended: true }),
|
express.urlencoded({ extended: true }),
|
||||||
|
verify,
|
||||||
inbox
|
inbox
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user