From 9d5775f6a29480e4f9a4e0ea7300fdbd970e8333 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 8 Dec 2015 12:31:38 +0100 Subject: [PATCH] Fix pusher authentication For some reason API sends us pusher auth keys without a proper pusher key, ie. instead of "{actual_pusher_key}:{signature}" it sends "key:{signature}". For now I'm just fixing it on the client, but this needs further investigation in the API. --- app/utils/pusher.coffee | 5 ++++- bower.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/utils/pusher.coffee b/app/utils/pusher.coffee index a9ae43dc..9e14a054 100644 --- a/app/utils/pusher.coffee +++ b/app/utils/pusher.coffee @@ -89,12 +89,15 @@ if ENV.pro names = Object.keys(channels.channels) channels.callbacks.push (auths) -> - _callback(false, auth: auths[name]) + auth = auths[name] + auth = auth.replace(/^key:/, config.key) + _callback(false, auth: auth) unless channels.fetching channels.fetching = true Ajax.post Pusher.channel_auth_endpoint, { socket_id: socketId, channels: names }, (data) -> channels.fetching = false + debugger callback(data.channels) for callback in channels.callbacks diff --git a/bower.json b/bower.json index ca6fd06e..c45afa30 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ "JavaScript-MD5": "~1.1.0", "moment": "~2.9.0", "jquery-timeago": "~1.4.1", - "pusher": "~2.2.3", + "pusher": "~2.2.4", "pretender": "0.1.0" } }