logging cleanup
This commit is contained in:
parent
b469abc863
commit
7092a92b9c
4 changed files with 5 additions and 5 deletions
|
@ -21,7 +21,7 @@ async function verifySignature (req, res, next) {
|
||||||
// support for apps not using signature extension to ActivityPub
|
// support for apps not using signature extension to ActivityPub
|
||||||
const actor = await pub.object.resolveObject(pub.utils.actorFromActivity(req.body))
|
const actor = await pub.object.resolveObject(pub.utils.actorFromActivity(req.body))
|
||||||
if (actor.publicKey && req.app.get('env') !== 'development') {
|
if (actor.publicKey && req.app.get('env') !== 'development') {
|
||||||
console.log('Missing http signature', req)
|
console.log('Missing http signature')
|
||||||
return res.status(400).send('Missing http signature')
|
return res.status(400).send('Missing http signature')
|
||||||
}
|
}
|
||||||
return next()
|
return next()
|
||||||
|
@ -29,8 +29,8 @@ async function verifySignature (req, res, next) {
|
||||||
const sigHead = httpSignature.parse(req)
|
const sigHead = httpSignature.parse(req)
|
||||||
const signer = await pub.object.resolveObject(sigHead.keyId, req.app.get('db'))
|
const signer = await pub.object.resolveObject(sigHead.keyId, req.app.get('db'))
|
||||||
const valid = httpSignature.verifySignature(sigHead, signer.publicKey.publicKeyPem)
|
const valid = httpSignature.verifySignature(sigHead, signer.publicKey.publicKeyPem)
|
||||||
console.log('signature validation', valid)
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
console.log('signature validation failure', sigHead.keyId)
|
||||||
return res.status(400).send('Invalid http signature')
|
return res.status(400).send('Invalid http signature')
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
|
|
|
@ -24,7 +24,6 @@ function deliver (actor, activity, addresses) {
|
||||||
delete activity.bcc
|
delete activity.bcc
|
||||||
}
|
}
|
||||||
const requests = addresses.map(addr => {
|
const requests = addresses.map(addr => {
|
||||||
console.log(`delivering to ${addr}`)
|
|
||||||
return request({
|
return request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: addr,
|
url: addr,
|
||||||
|
@ -42,7 +41,7 @@ function deliver (actor, activity, addresses) {
|
||||||
simple: false,
|
simple: false,
|
||||||
body: pubUtils.toJSONLD(activity)
|
body: pubUtils.toJSONLD(activity)
|
||||||
})
|
})
|
||||||
.then(result => console.log(addr, result.statusCode))
|
.then(result => console.log('delivery:', addr, result.statusCode))
|
||||||
.catch(err => console.log(err))
|
.catch(err => console.log(err))
|
||||||
})
|
})
|
||||||
return Promise.all(requests)
|
return Promise.all(requests)
|
||||||
|
|
|
@ -6,7 +6,6 @@ const store = require('../store')
|
||||||
|
|
||||||
router.post('/', net.validators.activity, net.security.verifySignature, function (req, res) {
|
router.post('/', net.validators.activity, net.security.verifySignature, function (req, res) {
|
||||||
req.body._meta = { _target: pub.utils.usernameToIRI(req.user) }
|
req.body._meta = { _target: pub.utils.usernameToIRI(req.user) }
|
||||||
console.log(req.body)
|
|
||||||
const toDo = {
|
const toDo = {
|
||||||
saveActivity: true,
|
saveActivity: true,
|
||||||
saveObject: false
|
saveObject: false
|
||||||
|
|
|
@ -9,6 +9,7 @@ router.get('/:name', net.validators.jsonld, function (req, res) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return res.status(400).send('Bad request.')
|
return res.status(400).send('Bad request.')
|
||||||
}
|
}
|
||||||
|
console.log('User json ', name)
|
||||||
pub.actor.getOrCreateActor(name)
|
pub.actor.getOrCreateActor(name)
|
||||||
.then(group => {
|
.then(group => {
|
||||||
return res.json(pub.utils.toJSONLD(group))
|
return res.json(pub.utils.toJSONLD(group))
|
||||||
|
@ -24,6 +25,7 @@ router.get('/:name', function (req, res) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return res.status(400).send('Bad request.')
|
return res.status(400).send('Bad request.')
|
||||||
}
|
}
|
||||||
|
console.log('User html ', name)
|
||||||
pub.actor.getOrCreateActor(name)
|
pub.actor.getOrCreateActor(name)
|
||||||
.then(group => {
|
.then(group => {
|
||||||
const groupAcct = `${group.preferredUsername}@${req.app.get('domain')}`
|
const groupAcct = `${group.preferredUsername}@${req.app.get('domain')}`
|
||||||
|
|
Loading…
Reference in a new issue