logging cleanup

This commit is contained in:
Will Murphy 2019-09-28 10:23:24 -05:00
parent b469abc863
commit 7092a92b9c
4 changed files with 5 additions and 5 deletions

View file

@ -21,7 +21,7 @@ async function verifySignature (req, res, next) {
// support for apps not using signature extension to ActivityPub
const actor = await pub.object.resolveObject(pub.utils.actorFromActivity(req.body))
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 next()
@ -29,8 +29,8 @@ async function verifySignature (req, res, next) {
const sigHead = httpSignature.parse(req)
const signer = await pub.object.resolveObject(sigHead.keyId, req.app.get('db'))
const valid = httpSignature.verifySignature(sigHead, signer.publicKey.publicKeyPem)
console.log('signature validation', valid)
if (!valid) {
console.log('signature validation failure', sigHead.keyId)
return res.status(400).send('Invalid http signature')
}
next()

View file

@ -24,7 +24,6 @@ function deliver (actor, activity, addresses) {
delete activity.bcc
}
const requests = addresses.map(addr => {
console.log(`delivering to ${addr}`)
return request({
method: 'POST',
url: addr,
@ -42,7 +41,7 @@ function deliver (actor, activity, addresses) {
simple: false,
body: pubUtils.toJSONLD(activity)
})
.then(result => console.log(addr, result.statusCode))
.then(result => console.log('delivery:', addr, result.statusCode))
.catch(err => console.log(err))
})
return Promise.all(requests)

View file

@ -6,7 +6,6 @@ const store = require('../store')
router.post('/', net.validators.activity, net.security.verifySignature, function (req, res) {
req.body._meta = { _target: pub.utils.usernameToIRI(req.user) }
console.log(req.body)
const toDo = {
saveActivity: true,
saveObject: false

View file

@ -9,6 +9,7 @@ router.get('/:name', net.validators.jsonld, function (req, res) {
if (!name) {
return res.status(400).send('Bad request.')
}
console.log('User json ', name)
pub.actor.getOrCreateActor(name)
.then(group => {
return res.json(pub.utils.toJSONLD(group))
@ -24,6 +25,7 @@ router.get('/:name', function (req, res) {
if (!name) {
return res.status(400).send('Bad request.')
}
console.log('User html ', name)
pub.actor.getOrCreateActor(name)
.then(group => {
const groupAcct = `${group.preferredUsername}@${req.app.get('domain')}`