Compare commits
15 Commits
github-act
...
v2.0.0
Author | SHA1 | Date | |
---|---|---|---|
|
78250bd9a2 | ||
|
5c0a4a2523 | ||
|
0456e0ef0e | ||
|
4a3bb0b1b7 | ||
|
b451adf35b | ||
|
5c84d7402e | ||
|
c4aa99d086 | ||
|
38bfbbdc75 | ||
|
c94e07f727 | ||
|
cc489f3e86 | ||
|
e7ea24d487 | ||
|
70f275ac3f | ||
|
967b941862 | ||
|
09cc28e69c | ||
|
2aafb532f8 |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: georgemandis
|
github: georgemandis
|
||||||
patreon: georgemandis
|
patreon: #
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
|
|||||||
liberapay: # Replace with a single Liberapay username
|
liberapay: # Replace with a single Liberapay username
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
otechie: # Replace with a single Otechie username
|
otechie: # Replace with a single Otechie username
|
||||||
custom: https://george.mand.is/sponsor
|
custom: #
|
||||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 George Mandis
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
62
README.md
62
README.md
@@ -1,16 +1,35 @@
|
|||||||
# 🦉 Bubo Reader
|
# 🦉 Bubo Reader
|
||||||
|
|
||||||
Bubo Reader is a somewhat irrationally minimalist <acronym title="Really Simple Syndication">RSS</acronym> and <acronym title="JavaScript Object Notation">JSON</acronym> feed reader you can deploy on [Netlify](https://netlify.com) in a few steps or [Glitch](https://glitch.com) in even fewer steps! The goal of the project is to generate a webpage that shows a list of links from a collection of feeds organized by category and website. That's it.
|
Bubo Reader is a hyper-minimalist <acronym title="Really Simple Syndication">RSS</acronym> and <acronym title="JavaScript Object Notation">JSON</acronym> feed reader you can deploy on your own server, [Netlify](https://netlify.com) in a few steps or [Glitch](https://glitch.com) in even fewer steps! The goal of the project is to generate a webpage that shows a list of links from a collection of feeds organized by category and website. That's it.
|
||||||
|
|
||||||
It is named after this [silly robot owl](https://www.youtube.com/watch?v=MYSeCfo9-NI) from Clash of the Titans (1981).
|
It is named after this [silly robot owl](https://www.youtube.com/watch?v=MYSeCfo9-NI) from Clash of the Titans (1981).
|
||||||
|
|
||||||
You can read more about how this project came about in my blog post '[Introducing Bubo RSS: An Absurdly Minimalist RSS Feed Reader](https://george.mand.is/2019/11/introducing-bubo-rss-an-absurdly-minimalist-rss-feed-reader/)'
|
You can read more about how this project came about in my blog post '[Introducing Bubo RSS: An Absurdly Minimalist RSS Feed Reader](https://george.mand.is/2019/11/introducing-bubo-rss-an-absurdly-minimalist-rss-feed-reader/)'
|
||||||
|
|
||||||
## Getting Started
|
## Anatomy of Bubo Reader
|
||||||
|
|
||||||
How to deploy Bubo Reader in a few easy steps with Netlify or Glitch:
|
- `src/index.html` - a [Nunjucks](https://mozilla.github.io/nunjucks/) template that lets you change how the feeds are displayed
|
||||||
|
- `output/style.css` - a CSS file to stylize your feed output
|
||||||
|
- `src/feeds.json` - a JSON file containing the URLs for various site's feeds separated into categories
|
||||||
|
- `src/index.js` - the script that loads the feeds and does the actual parsing and rendering
|
||||||
|
|
||||||
### Deploying to Glitch
|
## Demos
|
||||||
|
|
||||||
|
You can view live demos here:
|
||||||
|
|
||||||
|
- [https://bubo-rss-demo.netlify.com/](https://bubo-rss-demo.netlify.com/)
|
||||||
|
- [http://bubo-rss.glitch.me/](http://bubo-rss.glitch.me/)
|
||||||
|
|
||||||
|
Not the most exciting-looking demos, I'll admit, but they work!
|
||||||
|
|
||||||
|
**Getting Started**
|
||||||
|
|
||||||
|
- [Deploying to Glitch](#glitch)
|
||||||
|
- [Deploying to Netlify](#netlify)
|
||||||
|
- [Keeping feeds updated](#updated)
|
||||||
|
|
||||||
|
<a id="glitch"></a>
|
||||||
|
## Deploying to Glitch
|
||||||
|
|
||||||
The quickest way is to remix the project on Glitch:
|
The quickest way is to remix the project on Glitch:
|
||||||
[https://glitch.com/edit/#!/bubo-rss](https://glitch.com/edit/#!/bubo-rss)
|
[https://glitch.com/edit/#!/bubo-rss](https://glitch.com/edit/#!/bubo-rss)
|
||||||
@@ -22,14 +41,16 @@ There is also a special `glitch` branch you can clone if you prefer:
|
|||||||
|
|
||||||
The only difference between this branch and `master` is that it spins up a server using [Express](https://expressjs.com/) to serve your `./output/index.html` file on Glitch. Everything else is the same.
|
The only difference between this branch and `master` is that it spins up a server using [Express](https://expressjs.com/) to serve your `./output/index.html` file on Glitch. Everything else is the same.
|
||||||
|
|
||||||
### Deploying to Netlify
|
<a id="netlify"></a>
|
||||||
|
## Deploying to Netlify
|
||||||
|
|
||||||
- [Fork the repository](https://github.com/georgemandis/bubo-rss/fork)
|
- [Fork the repository](https://github.com/georgemandis/bubo-rss/fork)
|
||||||
- From your forked repository go to and edcit `src/feeds.json` to manage your feeds and categories
|
- From your forked repository go to and edit `src/feeds.json` to manage your feeds and categories
|
||||||
- [Create a new site](https://app.netlify.com/start) on Netlify from GitHub
|
- [Create a new site](https://app.netlify.com/start) on Netlify from GitHub
|
||||||
|
|
||||||
The deploy settings should automatically import from the `netlify.toml` file. All you'll need to do is confirm and you're ready to go!
|
The deploy settings should automatically import from the `netlify.toml` file. All you'll need to do is confirm and you're ready to go!
|
||||||
|
|
||||||
|
<a id="updated"></a>
|
||||||
### Keeping Feeds Updated
|
### Keeping Feeds Updated
|
||||||
|
|
||||||
#### Using Netlify Webhooks
|
#### Using Netlify Webhooks
|
||||||
@@ -44,30 +65,19 @@ If you already have a server running Linux and some command-line experience it m
|
|||||||
|
|
||||||
#### Using GitHub Actions
|
#### Using GitHub Actions
|
||||||
|
|
||||||
This approach is a little different and requires some modifications to the repository. Netlify started billing for [build minutes](https://www.netlify.com/pricing/faq/) very shortly after I published this project. Running `npm build` and downloading all of the RSS feeds took up a substantial number of this minutes, particulary if you had some kind of process pinging the webhook and trigger a build every 15 minutes or so.
|
This approach is a little different and requires some modifications to the repository. Netlify started billing for [build minutes](https://www.netlify.com/pricing/faq/) very shortly after I published this project. Running `npm build` and downloading all of the RSS feeds took up a substantial number of these, particularly if you had a process pinging the webhook and triggering a build every 15 minutes or so.
|
||||||
|
|
||||||
How is the The GitHub Action-based approach different? The same build process runs, but this time it's on GitHub's servers via the Action. It then **commits** the newly created file generated at `./output/index.html` back into the repository. Netlify still gets pinged when the repository is updated, but skips the `npm run build` step on their end, which significantly reduces the number of build minutes required.
|
How is the The GitHub Action-based approach different? The same build process runs, but this time it's on GitHub's servers via the Action. It then **commits** the newly created file generated at `./output/index.html` back into the repository. Netlify still gets pinged when the repository is updated, but skips the `npm run build` step on their end. This significantly reduces the number of build minutes required.
|
||||||
|
|
||||||
**Short Answer**: use the [`github-action-publishing`](https://github.com/georgemandis/bubo-rss/tree/github-action-publishing) branch for now if you'd prefer to use GitHub Actions to run your builds.
|
**TLDR**: use the [`github-action-publishing`](https://github.com/georgemandis/bubo-rss/tree/github-action-publishing) branch for now if you'd prefer to use GitHub Actions.
|
||||||
|
|
||||||
The GitHub Action is setup to build and commit directly to the `master` branch, which is not the best practice. I'd suggest creating a separate branch to checkout and commit changes to in the Action. You could then specify that same branch as the one to checkout and publish on Netlify.
|
**Note:** The GitHub Action is setup to build and commit directly to the `master` branch, which is not the best practice. I'd suggest creating a separate branch to checkout and commit changes to in the action. You could then specify that same branch as the one to checkout and publish on Netlify.
|
||||||
|
|
||||||
## Anatomy of Bubo Reader
|
|
||||||
|
|
||||||
- `src/index.html` - a [Nunjucks](https://mozilla.github.io/nunjucks/) template that lets you change how the feeds are displayed
|
|
||||||
- `output/style.css` - a CSS file to stylize your feed output
|
|
||||||
- `src/feeds.json` - a JSON file containing the URLs for various site's feeds separated into categories
|
|
||||||
- `src/index.js` - the script that loads the feeds and does the actual parsinga and rendering
|
|
||||||
|
|
||||||
## Demos
|
|
||||||
|
|
||||||
You can view live demos here:
|
|
||||||
|
|
||||||
- [https://bubo-rss-demo.netlify.com/](https://bubo-rss-demo.netlify.com/)
|
|
||||||
- [http://bubo-rss.glitch.me/](http://bubo-rss.glitch.me/)
|
|
||||||
|
|
||||||
Not the most exciting-looking demos, I'll admit, but they work!
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
If you found this useful please consider sponsoring me or this project. If you'd rather run this on your own server please consider using one of these affiliate links to setup a micro instance on [Linode](https://www.linode.com/?r=8729957ab02b50a695dcea12a5ca55570979d8b9), [Digital Ocean](https://m.do.co/c/31f58d367777) or [Vultr](https://www.vultr.com/?ref=8403978).
|
If you found this useful please consider sponsoring me or this project. If you'd rather run this on your own server please consider using one of these affiliate links to setup a micro instance on [Linode](https://www.linode.com/?r=8729957ab02b50a695dcea12a5ca55570979d8b9), [Digital Ocean](https://m.do.co/c/31f58d367777) or [Vultr](https://www.vultr.com/?ref=8403978).
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||
|
Here are some websites using Bubo Reader:
|
||||||
|
- [Kevin Fiol](https://kevinfiol.com/reader/) ([repo](https://github.com/kevinfiol/reader))
|
||||||
|
1958
package-lock.json
generated
1958
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "bubo-reader",
|
"name": "bubo-reader",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "A somewhat dumb but effective feed reader (RSS, JSON & Twitter)",
|
"description": "A simple but effective feed reader (RSS, JSON)",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node src/index.js > output/index.html",
|
"build": "node src/index.js > output/index.html",
|
||||||
|
@@ -14,8 +14,9 @@
|
|||||||
],
|
],
|
||||||
"My GitHub Projects": [
|
"My GitHub Projects": [
|
||||||
"https://github.com/georgemandis.atom",
|
"https://github.com/georgemandis.atom",
|
||||||
"https://github.com/snaptortoise/konami-js/releases.atom",
|
"https://github.com/georgemandis/bubo-rss/releases.atom",
|
||||||
"https://github.com/snaptortoise/konami-js/commits/master.atom",
|
"https://github.com/georgemandis/konami-js/releases.atom",
|
||||||
|
"https://github.com/georgemandis/konami-js/commits/main.atom",
|
||||||
"https://github.com/javascriptforartists/cheer-me-up-and-sing-me-a-song/commits/master.atom",
|
"https://github.com/javascriptforartists/cheer-me-up-and-sing-me-a-song/commits/master.atom",
|
||||||
"https://github.com/georgemandis/circuit-playground-midi-multi-tool/commits/master.atom",
|
"https://github.com/georgemandis/circuit-playground-midi-multi-tool/commits/master.atom",
|
||||||
"https://github.com/georgemandis/remote-working-list/commits/master.atom",
|
"https://github.com/georgemandis/remote-working-list/commits/master.atom",
|
||||||
|
58
src/index.js
58
src/index.js
@@ -1,9 +1,13 @@
|
|||||||
/**
|
/*
|
||||||
* 🦉 Bubo RSS Reader
|
* 🦉 Bubo RSS Reader
|
||||||
* ====
|
* ====
|
||||||
* Dead, dead simple feed reader that renders an HTML
|
* Dead simple feed reader that renders an HTML
|
||||||
* page with links to content from feeds organized by site
|
* page with links to content from feeds organized by site
|
||||||
*
|
*
|
||||||
|
* Code: https://github.com/georgemandis/bubo-rss
|
||||||
|
* Copyright (c) 2019 George Mandis (https://george.mand.is)
|
||||||
|
* Version: 1.0.1 (11/14/2021)
|
||||||
|
* Licensed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
@@ -15,6 +19,9 @@ const env = nunjucks.configure({ autoescape: true });
|
|||||||
|
|
||||||
const feeds = require("./feeds.json");
|
const feeds = require("./feeds.json");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global filters for my Nunjucks templates
|
||||||
|
*/
|
||||||
env.addFilter("formatDate", function (dateString) {
|
env.addFilter("formatDate", function (dateString) {
|
||||||
const formattedDate = new Date(dateString).toLocaleDateString()
|
const formattedDate = new Date(dateString).toLocaleDateString()
|
||||||
return formattedDate !== 'Invalid Date' ? formattedDate : dateString;
|
return formattedDate !== 'Invalid Date' ? formattedDate : dateString;
|
||||||
@@ -22,7 +29,7 @@ env.addFilter("formatDate", function(dateString) {
|
|||||||
|
|
||||||
env.addGlobal('now', (new Date()).toUTCString());
|
env.addGlobal('now', (new Date()).toUTCString());
|
||||||
|
|
||||||
// parse XML or JSON feeds
|
// parse RSS/XML or JSON feeds
|
||||||
function parseFeed(response) {
|
function parseFeed(response) {
|
||||||
const contentType = response.headers.get("content-type")
|
const contentType = response.headers.get("content-type")
|
||||||
? response.headers.get("content-type").split(";")[0]
|
? response.headers.get("content-type").split(";")[0]
|
||||||
@@ -44,18 +51,49 @@ function parseFeed(response) {
|
|||||||
|
|
||||||
const jsonFeed = [contentType]
|
const jsonFeed = [contentType]
|
||||||
.map(item =>
|
.map(item =>
|
||||||
["application/json"].includes(item) ? response.json() : false
|
["application/json", "application/feed+json"].includes(item) ? response.json() : false
|
||||||
)
|
)
|
||||||
.filter(_ => _)[0];
|
.filter(_ => _)[0];
|
||||||
|
|
||||||
return rssFeed || jsonFeed || false;
|
return rssFeed || jsonFeed || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
There's a little inconcistency with how feeds report certain things like
|
||||||
|
title, links and timestamps. These helpers try to normalize that bit and
|
||||||
|
provide an order-of-operations list of properties to look for.
|
||||||
|
|
||||||
|
Note: these are tightly-coupled to the template and a personal preference.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const getLink = (obj) => {
|
||||||
|
const link_values = ["link", "url", "guid", "home_page_url"];
|
||||||
|
const keys = Object.keys(obj);
|
||||||
|
const link_property = link_values.find(link_value => keys.includes(link_value));
|
||||||
|
return obj[link_property];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fallback to URL for the title if not present (coupled to my template)
|
||||||
|
const getTitle = (obj) => {
|
||||||
|
const title_values = ["title", "url", "link"]; // fallback to url/link as title if omitted
|
||||||
|
const keys = Object.keys(obj);
|
||||||
|
const title_property = title_values.find(title_value => keys.includes(title_value));
|
||||||
|
return obj[title_property];
|
||||||
|
}
|
||||||
|
|
||||||
|
// More dependable way to get timestamps
|
||||||
|
const getTimestamp = (obj) => {
|
||||||
|
const timestamp = new Date(obj.pubDate || obj.isoDate || obj.date || obj.date_published).getTime();
|
||||||
|
return isNaN(timestamp) ? (obj.pubDate || obj.isoDate || obj.date || obj.date_published) : timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch the feeds and build the object for our template
|
||||||
(async () => {
|
(async () => {
|
||||||
const contentFromAllFeeds = {};
|
const contentFromAllFeeds = {};
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
for (group in feeds) {
|
for (const group in feeds) {
|
||||||
contentFromAllFeeds[group] = [];
|
contentFromAllFeeds[group] = [];
|
||||||
|
|
||||||
for (let index = 0; index < feeds[group].length; index++) {
|
for (let index = 0; index < feeds[group].length; index++) {
|
||||||
@@ -66,13 +104,15 @@ function parseFeed(response) {
|
|||||||
typeof body === "string" ? await parser.parseString(body) : body;
|
typeof body === "string" ? await parser.parseString(body) : body;
|
||||||
|
|
||||||
contents.feed = feeds[group][index];
|
contents.feed = feeds[group][index];
|
||||||
contents.title = contents.title ? contents.title : contents.link;
|
contents.title = getTitle(contents);
|
||||||
|
contents.link = getLink(contents);
|
||||||
contentFromAllFeeds[group].push(contents);
|
contentFromAllFeeds[group].push(contents);
|
||||||
|
|
||||||
// try to normalize date attribute naming
|
// try to normalize date attribute naming
|
||||||
contents.items.forEach(item => {
|
contents?.items?.forEach(item => {
|
||||||
const timestamp = new Date(item.pubDate || item.isoDate || item.date).getTime();
|
item.timestamp = getTimestamp(item);
|
||||||
item.timestamp = isNaN(timestamp) ? (item.pubDate || item.isoDate || item.date) : timestamp;
|
item.title = getTitle(item);
|
||||||
|
item.link = getLink(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user