mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-22 09:19: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() {
|
||||
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(`<span>- ${$(el).html()}</span><br>`);
|
||||
});
|
||||
|
||||
// couple of hacky regexes to make sure we clean up everything
|
||||
item.content = $('body').html().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(),
|
||||
'attributedTo': `https://${domain}/u/${name}`,
|
||||
'content': text,
|
||||
'to': 'https://www.w3.org/ns/activitystreams#Public'
|
||||
'cc': 'https://www.w3.org/ns/activitystreams#Public'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue