From 7092a92b9c3e6be6b2484a07a0bcdd70a4f413dd Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Sat, 28 Sep 2019 10:23:24 -0500 Subject: [PATCH] logging cleanup --- net/security.js | 4 ++-- pub/federation.js | 3 +-- routes/inbox.js | 1 - routes/user.js | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/security.js b/net/security.js index a112f61..64afa34 100644 --- a/net/security.js +++ b/net/security.js @@ -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() diff --git a/pub/federation.js b/pub/federation.js index 13441c4..00dd906 100644 --- a/pub/federation.js +++ b/pub/federation.js @@ -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) diff --git a/routes/inbox.js b/routes/inbox.js index 6fe8c89..f0c2e85 100644 --- a/routes/inbox.js +++ b/routes/inbox.js @@ -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 diff --git a/routes/user.js b/routes/user.js index 22bc350..ea4d6bb 100644 --- a/routes/user.js +++ b/routes/user.js @@ -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')}`