mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-22 17:29:19 +02:00
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')
This commit is contained in:
parent
6e7c8b9705
commit
18d64cd7be
|
@ -18,6 +18,7 @@ doFeed();
|
||||||
|
|
||||||
function doFeed() {
|
function doFeed() {
|
||||||
let feed = feeds[count];
|
let feed = feeds[count];
|
||||||
|
console.log(count, feed.feed);
|
||||||
if (feed === undefined) {
|
if (feed === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -71,10 +72,12 @@ function doFeed() {
|
||||||
// update the DB with new contents
|
// update the DB with new contents
|
||||||
let content = JSON.stringify(feedData);
|
let content = JSON.stringify(feedData);
|
||||||
db.prepare('insert or replace into feeds(feed, username, content) values(?, ?, ?)').run(feed.feed, acct, content);
|
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 {
|
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();}
|
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(`<span>- ${$(el).html()}</span><br>`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// couple of hacky regexes to make sure we clean up everything
|
// couple of hacky regexes to make sure we clean up everything
|
||||||
item.content = $('body').html().replace(/^(\n|\r)/,'').replace(/>\r+</,' ').replace(/ +/g, '');
|
item.content = $('body').html().replace(/^(\n|\r)/,'').replace(/>\r+</,' ').replace(/ +/g, '');
|
||||||
item.content = item.content.replace(/^(\n|\r)/,'').replace(/>\r+</,' ').replace(/ +/g, '');
|
item.content = item.content.replace(/^(\n|\r)/,'').replace(/>\r+</,' ').replace(/ +/g, '');
|
||||||
|
@ -193,7 +190,7 @@ function createMessage(text, name, domain, item) {
|
||||||
'published': d.toISOString(),
|
'published': d.toISOString(),
|
||||||
'attributedTo': `https://${domain}/u/${name}`,
|
'attributedTo': `https://${domain}/u/${name}`,
|
||||||
'content': text,
|
'content': text,
|
||||||
'to': 'https://www.w3.org/ns/activitystreams#Public'
|
'cc': 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue