From 53c247ae019b34a41676423473242e8082d4321a Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Sat, 25 Apr 2015 15:21:57 +0200 Subject: [PATCH] fixato github del tutto SPERO --- scripts/github.coffee | 11 +++++------ scripts/misc.coffee | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/github.coffee b/scripts/github.coffee index 9f334dd..21e6b55 100644 --- a/scripts/github.coffee +++ b/scripts/github.coffee @@ -2,20 +2,19 @@ # interazioni tra asjon e github module.exports = (robot) -> - robot.router.post '/hubot/githubhook/:room', (req, res) -> + robot.router.post '/hubot/githubhook/:room/:name', (req, res) -> res.send 200 if !process.env.GITHUB_API_SECRET console.log 'non sono configurato per GITHUB API WEBHOOKS!' return - else if process.env.GITHUB_API_SECRET isnt req.headers["X-Hub-Signature"] + else if "sha1="+process.env.GITHUB_API_SECRET isnt req.headers["x-hub-signature"] console.log 'MALFORMED GITHUB API SECRET: was', - req.headers["X-Hub-Signature"], 'but expected', process.env.GITHUB_API_SECRET + req.headers["x-hub-signature"], 'but expected', "sha1="+process.env.GITHUB_API_SECRET return - console.log req.body - robot.send req.params.room, JSON.stringify req.body + dest = name: req.params.name, room: req.params.room if req.body.ref is 'refs/head/master' s = 'Sono stato aggiornato!\n' cm = req.body.commits.map (c) -> [c.committer.username,c.message].join ' -> ' commits = cm.join '\n' - robot.send req.params.room, s+commits + robot.send dest, s+commits diff --git a/scripts/misc.coffee b/scripts/misc.coffee index 67b0e0b..0b12fd2 100644 --- a/scripts/misc.coffee +++ b/scripts/misc.coffee @@ -70,6 +70,7 @@ module.exports = (robot) -> .get() (err, r, body) -> res.send 'dovrei essere a ' + body robot.respond /con chi stai parlando/i, (res) -> + console.log res.message.user, res.message.room if res.message.user.name is res.message.room res.send 'sto parlando con te, '+res.message.user.name else