1
0

4 Commits

Author SHA1 Message Date
George Mandis
ffdaf0b72b 2.0.2 2023-06-03 15:28:41 -04:00
George Mandis
5ebc0d4952 Fixing a bug where failing to fetch a feed could make Bubo hang 2023-06-03 15:28:29 -04:00
George Mandis
04696e9df6 Updating packages 2023-06-03 15:28:10 -04:00
George Mandis
0fa785b41d Update README.md 2022-12-04 20:16:50 -05:00
7 changed files with 389 additions and 414 deletions

View File

@@ -2,7 +2,7 @@
# 🦉 Bubo Reader
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.
Bubo Reader is a hyper-minimalist feed reader (RSS, Atom, JSON) 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).

4
netlify.toml Normal file
View File

@@ -0,0 +1,4 @@
[build]
command = "npm run build:bubo"
publish = "./public/"

706
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "bubo-reader",
"version": "2.0.1",
"version": "2.0.2",
"description": "A simple but effective feed reader (RSS, JSON)",
"homepage": "https://github.com/georgemandis/bubo-rss",
"main": "src/index.js",
@@ -10,9 +10,7 @@
"clean": "rm -rf dist",
"build": "tsc",
"bubo": "node dist/index.js",
"build:bubo": "tsc && node dist/index.js",
"start": "npm run build:bubo; node server.js",
"test": "echo \"Error: no test specified\" && exit 1"
"build:bubo": "tsc && node dist/index.js"
},
"author": {
"name": "George Mandis",
@@ -29,21 +27,19 @@
},
"license": "MIT",
"dependencies": {
"chalk": "^5.1.2",
"node-fetch": "^3.3.0",
"nunjucks": "^3.2.3",
"rss-parser": "^3.12.0",
"express": "^4.17.1"
"chalk": "^5.2.0",
"node-fetch": "^3.3.1",
"nunjucks": "^3.2.4",
"rss-parser": "^3.13.0"
},
"engines": { "node": "16.x" },
"devDependencies": {
"@types/node": "^16.18.4",
"@types/nunjucks": "^3.2.1",
"@types/node": "^16.18.34",
"@types/nunjucks": "^3.2.2",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"eslint": "^8.29.0",
"tslib": "^2.4.1",
"typescript": "^4.9.3"
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"eslint": "^8.42.0",
"tslib": "^2.5.3",
"typescript": "^4.9.5"
}
}

View File

@@ -1,24 +0,0 @@
// Bubo RSS (on Glitch!)
// init project
import express from "express";
import { URL } from 'url';
const __dirname = new URL('.', import.meta.url).pathname;
const app = express();
// we've started you off with Express,
// but feel free to use whatever libs or frameworks you'd like through `package.json`.
// http://expressjs.com/en/starter/static-files.html
app.use(express.static("public"));
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function(request, response) {
response.sendFile(__dirname + "/public/index.html");
});
// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
console.log("Your app is listening on port " + listener.address().port);
});

View File

@@ -66,7 +66,11 @@ let completed = 0;
* and we want to build the static output.
*/
const finishBuild: () => void = async () => {
console.log("\nDone fetching everything!");
completed++;
// if this isn't the last feed, just return early
if (completed !== feedListLength) return;
process.stdout.write("\nDone fetching everything!\n");
// generate the static HTML output from our template renderer
const output = render({
@@ -77,10 +81,10 @@ const finishBuild: () => void = async () => {
// write the output to public/index.html
await writeFile("./public/index.html", output);
console.log(
process.stdout.write(
`\nFinished writing to output:\n- ${feedListLength} feeds in ${benchmark(
initTime
)}\n- ${errors.length} errors`
)}\n- ${errors.length} errors\n`
);
};
@@ -103,7 +107,6 @@ const processFeed =
}) =>
async (response: Response): Promise<void> => {
const body = await parseFeed(response);
completed++;
//skip to the next one if this didn't work out
if (!body) return;
@@ -124,20 +127,19 @@ const processFeed =
});
contentFromAllFeeds[group].push(contents as object);
console.log(
`${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}`
process.stdout.write(
`${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}\n`
);
} catch (err) {
console.log(
process.stdout.write(
`${error("Error processing:")} ${feed} - ${benchmark(
startTime
)}\n${err}`
)}\n${err}\n`
);
errors.push(`Error processing: ${feed}\n\t${err}`);
}
// if this is the last feed, go ahead and build the output
completed === feedListLength && finishBuild();
finishBuild();
};
// go through each group of feeds and process
@@ -150,15 +152,16 @@ const processFeeds = () => {
for (const feed of feeds) {
const startTime = Date.now();
setTimeout(() => {
console.log(`Fetching: ${feed}...`);
process.stdout.write(`Fetching: ${feed}...\n`);
fetch(feed)
.then(processFeed({ group, feed, startTime }))
.catch(err => {
console.log(
error(`Error fetching ${feed} ${benchmark(startTime)}`)
process.stdout.write(
error(`Error fetching ${feed} ${benchmark(startTime)}\n`)
);
errors.push(`Error fetching ${feed} ${err.toString()}`);
errors.push(`Error fetching ${feed} ${err.toString()}\n`);
finishBuild();
});
}, (idx % (feedListLength / MAX_CONNECTIONS)) * DELAY_MS);
idx++;