From d0ddcaf1fe6e34fbf4d360071f457885c1337b70 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Wed, 31 Jul 2019 23:54:57 -0700 Subject: [PATCH] update feed url, handle no items more gracefully, start on dns check --- js/modules/loki_rss_api.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/js/modules/loki_rss_api.js b/js/modules/loki_rss_api.js index 18e807194..d50e326df 100644 --- a/js/modules/loki_rss_api.js +++ b/js/modules/loki_rss_api.js @@ -7,12 +7,35 @@ const nodeFetch = require('node-fetch'); const friendRequestStatusEnum = require('./loki_friend_request_status'); -const RSS_FEED = 'https://loki.network/feed/'; -const CONVO_ID = 'rss://loki.network/feed/'; +const RSS_FEED = 'https://loki.network/category/messenger-updates/feed/'; +const CONVO_ID = 'rss://loki.network/category/messenger-updates/feed/'; const PER_MIN = 60 * 1000; const PER_HR = 60 * PER_MIN; const RSS_POLL_EVERY = 1 * PER_HR; // once an hour +/* +const dnsUtil = require('dns'); +// how do we get our local version? +// how do we integrate with extensions.expired() +const VERSION_HOST = 'lastreleasedate.messenger.loki.network'; + +function getLastRelease(cb) { + // doesn't look to have a promise interface + dnsUtil.resolveTxt(VERSION_HOST, function handleResponse(err, records) { + if (err) { + console.error('getLastRelease error', err); + cb(); + return; + } + if (records.length) { + cb(); + } + // return first record... + cb(records[0]); + }); +} +*/ + function xml2json(xml) { try { let obj = {}; @@ -105,7 +128,10 @@ class LokiRssAPI extends EventEmitter { log.error('rsserror', feedObj, feedDOM, responseXML); return; } - + if (!feedObj.rss.channel.item) { + // no records + return; + } feedObj.rss.channel.item.reverse().forEach(item => { // log.debug('item', item)