in ,

dariusk / rss-to-activitypub, Hacker News

dariusk / rss-to-activitypub, Hacker News


                    

        

This is a server that lets users convert any RSS feed to an ActivityPub actor that can be followed by users on ActivityPub-compliant social networks like Mastodon. For a demo of this in action, seehttps://bots.tinysubversions.com/convert/

This is based on myExpress ActivityPub Server, a simple Node / Express server that supports a subset of ActivityPub.

Requirements

This requires Node.js v 10. 10 .0 or above.

You also needbeanstalkdrunning. This is a simple and fast queueing system we use to manage polling RSS feeds.Here are installation instructions. On a production server you’ll want toinstall it as a background process.

Installation

Clone the repository, thencdinto its root directory. Install dependencies:

npm i

Then copyconfig.json.templatetoconfig.json:

cp config.json.template config.json

Update your newconfig.jsonfile:

{   "DOMAIN":"mydomain.com",   "PORT_HTTP":"3000",   "PORT_HTTPS":"8443",   "PRIVKEY_PATH":"/ path / to / your / ssl / privkey.pem",   "CERT_PATH":"/ path / to / your / ssl / cert.pem"}
  • DOMAIN: your domain! this should be a discoverable domain of some kind like “example.com” or “rss.example.com”
  • PORT_HTTP: the http port that Express runs on
  • PORT_HTTPS: the https port that Express runs on
  • PRIVKEY_PATH: point this to your private key you got from Certbot or similar
  • CERT_PATH: point this to your cert you got from Certbot or similar

Run the server!

node index.js

Go tohttps://whateveryourdomainis.com: 3000 / convertor whatever port you selected for HTTP, and enter an RSS feed and a username. If all goes well it will create a new ActivityPub user with instructions on how to view the user.

There is also a file calledqueueFeeds.jsthat needs to be run on a cron job or similar scheduler. I like to run mine once a minute. It queries every RSS feed in the database to see if there has been a change to the feed. If there is a new post, it sends out the new post to everyone subscribed to its corresponding ActivityPub Actor.

Local testing

You can use a service likengrokto test things out before you deploy on a real server. All you need to do is install ngrok and runngrok http 3000(or whatever port you’re using if you changed it). Then go to yourconfig.jsonand update theDOMAINfield to whateverabcdef.ngrok.iodomain that ngrok gives you and restart your server.

Then make sure to manually runupdateFeed.jswhen the feed changes. I recommend having your own test RSS feed that you can update whenever you want.

Database

This server uses a SQLite database stored in the filebot-node.dbto keep track of all the data. To connect directly to the database for debugging, from the root directory of the project, run:

There are two tables in the database:accountsandfeeds.

accounts

This table keeps track of all the data needed for the accounts. Columns:

  • nameTEXT PRIMARY KEY: the account name, in the formthename@example.com
  • privkeyTEXT: the RSA private key for the account
  • pubkeyTEXT: the RSA public key for the account
  • webfingerTEXT: the entire contents of the webfinger JSON served for this account
  • actorTEXT: the entire contents of the actor JSON served for this account
  • apikeyTEXT: the API key associated with this account
  • followersTEXT: a JSON-formatted array of the URL for the Actor JSON of all followers, in the form["https://remote.server/users/somePerson", "https://another.remote.server/ourUsers/anotherPerson"]
  • messagesTEXT: not yet used but will eventually store all messages so we can render them on a “profile” page

feeds

This table keeps track of all the data needed for the feeds. Columns:

  • feedTEXT PRIMARY KEY: the URI of the RSS feed
  • usernameTEXT: the username associated with the RSS feed
  • contentTEXT: the most recent copy fetched of the RSS feed’s contents

License

Copyright (c) 2018 Darius Kazemi. Licensed under the MIT license. ********

  

Brave Browser
Read More
Payeer

What do you think?

Leave a Reply

Your email address will not be published.

GIPHY App Key not set. Please check settings

This solar farm has to switch off every second day due to negative prices, Hacker News

This solar farm has to switch off every second day due to negative prices, Hacker News

Washington Post: Trump asked for Barr to host news conference clearing him on Ukraine – CNN, CNN

Washington Post: Trump asked for Barr to host news conference clearing him on Ukraine – CNN, CNN