diff --git a/node/favicons.js b/node/favicons.js index 407c1c8c4..5bda021c4 100644 --- a/node/favicons.js +++ b/node/favicons.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 2.5.1 (function() { - var DEV, MONGODB_PORT, MONGODB_SERVER, app, log, mongo, server, url; + var DEV, DOCKER, MONGODB_PORT, MONGODB_SERVER, app, log, mongo, server, url; app = require('express')(); @@ -32,7 +32,7 @@ } if (DEV || DOCKER) { - url = "mongodb://" + MONGODB_SERVER + ":" + MONGODB_PORT + "/newsblur"; + url = `mongodb://${MONGODB_SERVER}:${MONGODB_PORT}/newsblur`; } else { url = `mongodb://${MONGODB_SERVER}:${MONGODB_PORT}/newsblur?replicaSet=nbset&readPreference=secondaryPreferred`; } diff --git a/node/unread_counts.js b/node/unread_counts.js index 5c4f9a7d3..c1d587e16 100644 --- a/node/unread_counts.js +++ b/node/unread_counts.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 2.5.1 (function() { - var DEV, DOCKER, REDIS_SERVER, SECURE, app, certificate, fs, io, log, options, privateKey, redis; + var DEV, DOCKER, REDIS_PORT, REDIS_SERVER, SECURE, app, certificate, fs, io, log, options, privateKey, redis; fs = require('fs'); @@ -13,11 +13,17 @@ DOCKER = process.env.NODE_ENV === 'docker'; REDIS_SERVER = process.env.NODE_ENV === 'development' ? 'localhost' : DOCKER ? 'redis' : 'db_redis_pubsub'; - + SECURE = !!process.env.NODE_SSL; REDIS_PORT = DOCKER ? 6579 : 6379; + // client = redis.createClient 6379, REDIS_SERVER + + // RedisStore = require 'socket.io/lib/stores/redis' + // rpub = redis.createClient 6379, REDIS_SERVER + // rsub = redis.createClient 6379, REDIS_SERVER + // rclient = redis.createClient 6379, REDIS_SERVER log.debug("Starting NewsBlur unread count server..."); if (!DEV && !process.env.NODE_ENV) { @@ -80,37 +86,31 @@ ref.quit(); } socket.subscribe = redis.createClient(REDIS_PORT, REDIS_SERVER); - socket.subscribe.on("error", (function(_this) { - return function(err) { - var _ref1; - log.info(_this.username, "Error: " + err + " (" + _this.feeds.length + " feeds)"); - return (_ref1 = socket.subscribe) != null ? _ref1.quit() : void 0; - }; - })(this)); - socket.subscribe.on("connect", (function(_this) { - return function() { - var feeds_story; - log.info(_this.username, ("Connected (" + _this.feeds.length + " feeds, " + ip + "),") + (" (" + io.engine.clientsCount + " connected) ") + (" " + (SECURE ? "(SSL)" : "(non-SSL)"))); - socket.subscribe.subscribe(_this.feeds); - feeds_story = _this.feeds.map(function(f) { - return "" + f + ":story"; - }); - socket.subscribe.subscribe(feeds_story); - return socket.subscribe.subscribe(_this.username); - }; - })(this)); - return socket.subscribe.on('message', (function(_this) { - return function(channel, message) { - log.info(_this.username, "Update on " + channel + ": " + message); - if (channel === _this.username) { - return socket.emit('user:update', channel, message); - } else if (channel.indexOf(':story') >= 0) { - return socket.emit('feed:story:new', channel, message); - } else { - return socket.emit('feed:update', channel, message); - } - }; - })(this)); + socket.subscribe.on("error", (err) => { + var ref1; + log.info(this.username, `Error: ${err} (${this.feeds.length} feeds)`); + return (ref1 = socket.subscribe) != null ? ref1.quit() : void 0; + }); + socket.subscribe.on("connect", () => { + var feeds_story; + log.info(this.username, `Connected (${this.feeds.length} feeds, ${ip}),` + ` (${io.engine.clientsCount} connected) ` + ` ${SECURE ? "(SSL)" : "(non-SSL)"}`); + socket.subscribe.subscribe(this.feeds); + feeds_story = this.feeds.map(function(f) { + return `${f}:story`; + }); + socket.subscribe.subscribe(feeds_story); + return socket.subscribe.subscribe(this.username); + }); + return socket.subscribe.on('message', (channel, message) => { + log.info(this.username, `Update on ${channel}: ${message}`); + if (channel === this.username) { + return socket.emit('user:update', channel, message); + } else if (channel.indexOf(':story') >= 0) { + return socket.emit('feed:story:new', channel, message); + } else { + return socket.emit('feed:update', channel, message); + } + }); }); return socket.on('disconnect', () => { var ref, ref1;