From 18d64cd7be801e46a281eb50c1425861382b2716 Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Thu, 21 Feb 2019 07:58:14 -0800 Subject: [PATCH] More stable updates; unlisted posts * change the way updateFeeds works so that it loops correctly through all feeds and doesn't hang * make posts unlisted by default in Mastodon ('cc' the public collection rather than 'to') --- updateFeeds.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/updateFeeds.js b/updateFeeds.js index 195e0de..c33737d 100644 --- a/updateFeeds.js +++ b/updateFeeds.js @@ -18,6 +18,7 @@ doFeed(); function doFeed() { let feed = feeds[count]; + console.log(count, feed.feed); if (feed === undefined) { return; } @@ -71,10 +72,12 @@ function doFeed() { // update the DB with new contents let content = JSON.stringify(feedData); db.prepare('insert or replace into feeds(feed, username, content) values(?, ?, ?)').run(feed.feed, acct, content); - doFeed(++count); + count = count + 1; + setTimeout(doFeed, 100); } else { - doFeed(++count); + count = count + 1; + setTimeout(doFeed, 100); } } }); @@ -125,12 +128,6 @@ function transformContent(item) { if($(el).html().replace(/\s| /g, '').length === 0) {$(el).remove();} }); - // convert li items to bullet points - $('li').each((i, el) => { - //console.log($(el).html()); - $(el).replaceWith(`- ${$(el).html()}
`); - }); - // couple of hacky regexes to make sure we clean up everything item.content = $('body').html().replace(/^(\n|\r)/,'').replace(/>\r+\r+