app/assets/javascripts/faye-authentication.js in faye-authentication-1.11.0 vs app/assets/javascripts/faye-authentication.js in faye-authentication-1.12

- old
+ new

@@ -6,10 +6,11 @@ this._options = options || {}; this._options.retry_delay = this._options.retry_delay || 1000; this._waiting_signatures = []; this._timer = null; this.logger = Faye.logger; + this.ERROR_LIST = ['Expired signature', 'Required argument not signed', 'Invalid signature'] } FayeAuthentication.prototype.endpoint = function() { return (this._endpoint); }; @@ -32,18 +33,18 @@ $.each(messages, function(key, params) { var signature = $.grep(response.signatures || [], function(e) { return (e.channel == params.channel && e.clientId == params.clientId); })[0]; if (typeof signature === 'undefined') { - self.logger.error('No signature found in ajax reply for channel ' + params.channel + ' and clientId ' + params.clientId); + self.logger.error('[Faye] No signature found in ajax reply for channel ' + params.channel + ' and clientId ' + params.clientId); } else if (signature && !signature.signature) { - self.logger.error('Error when fetching signature for channel ' + params.channel + ' and clientId ' + params.clientId + ', error was : "' + signature.error + '"'); + self.logger.error('[Faye] Error when fetching signature for channel ' + params.channel + ' and clientId ' + params.clientId + ', error was : "' + signature.error + '"'); } FayeAuthentication.Promise.resolve(self._signatures[params.clientId][params.channel], signature ? signature.signature : null); }); }, 'json').fail(function(xhr, textStatus, e) { - self.logger.error('Failure when trying to fetch JWT signature for data "' + JSON.stringify(messages) + '", error was : ' + textStatus); + self.logger.error('[Faye] Failure when trying to fetch JWT signature for data "' + JSON.stringify(messages) + '", error was : ' + textStatus); $.each(messages, function(key, params) { FayeAuthentication.Promise.resolve(self._signatures[params.clientId][params.channel], null); }); }); }; @@ -94,20 +95,20 @@ if (message.channel == '/meta/subscribe' || message.channel.lastIndexOf('/meta/', 0) !== 0) { if(this._options.whitelist) { try { return (!this._options.whitelist(subscription_or_channel)); } catch (e) { - this.logger.error("Error caught when evaluating whitelist function : " + e.message); + this.logger.error("[Faye] Error caught when evaluating whitelist function : " + e.message); } } return (true); } return (false); }; FayeAuthentication.prototype.incoming = function(message, callback) { var outbox_message = this._outbox[message.id]; - if (outbox_message && message.error) { + if (outbox_message && message.error && this.ERROR_LIST.indexOf(message.error) != -1) { var channel = outbox_message.message.subscription || outbox_message.message.channel; this._signatures[outbox_message.clientId][channel] = null; outbox_message.message.retried = true; delete outbox_message.message.id; delete this._outbox[message.id];