Compare commits
19 Commits
package-up
...
glitch
Author | SHA1 | Date | |
---|---|---|---|
|
6aa4dc80b3 | ||
|
b9a7da4287 | ||
|
1b3f20379a | ||
|
89dbf2c17a | ||
|
b429c213b8 | ||
|
1a9c60a4d6 | ||
|
57571db322 | ||
|
6fca9e15be | ||
|
6dbd6bfe02 | ||
|
29e2188b2e | ||
|
415bfb6c73 | ||
|
a5ff96e449 | ||
|
1cd365e257 | ||
|
d124194296 | ||
|
713a4eedaa | ||
|
53843e949e | ||
|
949bea60b3 | ||
|
ceaad6c5b4 | ||
|
fbfda83125 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
public/index.html
|
public/index.html
|
||||||
dist/*
|
dist/*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# 🦉 Bubo Reader
|
# 🦉 Bubo Reader
|
||||||
|
|
||||||
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.
|
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).
|
||||||
|
|
||||||
|
@@ -12,6 +12,9 @@
|
|||||||
"https://george.mand.is/feed.xml",
|
"https://george.mand.is/feed.xml",
|
||||||
"https://joy.recurse.com/feed.atom"
|
"https://joy.recurse.com/feed.atom"
|
||||||
],
|
],
|
||||||
|
"Social": [
|
||||||
|
"https://social.mandis.dev/@georgemandis.rss"
|
||||||
|
],
|
||||||
"My GitHub Projects": [
|
"My GitHub Projects": [
|
||||||
"https://github.com/georgemandis.atom",
|
"https://github.com/georgemandis.atom",
|
||||||
"https://github.com/georgemandis/bubo-rss/releases.atom",
|
"https://github.com/georgemandis/bubo-rss/releases.atom",
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
[build]
|
|
||||||
command = "npm run build:bubo"
|
|
||||||
publish = "./public/"
|
|
||||||
|
|
708
package-lock.json
generated
708
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bubo-reader",
|
"name": "bubo-reader",
|
||||||
"version": "2.0.2",
|
"version": "2.0.1",
|
||||||
"description": "A simple but effective feed reader (RSS, JSON)",
|
"description": "A simple but effective feed reader (RSS, JSON)",
|
||||||
"homepage": "https://github.com/georgemandis/bubo-rss",
|
"homepage": "https://github.com/georgemandis/bubo-rss",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
@@ -10,7 +10,9 @@
|
|||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"bubo": "node dist/index.js",
|
"bubo": "node dist/index.js",
|
||||||
"build:bubo": "tsc && 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"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "George Mandis",
|
"name": "George Mandis",
|
||||||
@@ -27,19 +29,21 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^5.2.0",
|
"chalk": "^5.1.2",
|
||||||
"node-fetch": "^3.3.1",
|
"node-fetch": "^3.3.0",
|
||||||
"nunjucks": "^3.2.4",
|
"nunjucks": "^3.2.3",
|
||||||
"rss-parser": "^3.13.0"
|
"rss-parser": "^3.12.0",
|
||||||
|
"express": "^4.17.1"
|
||||||
},
|
},
|
||||||
|
"engines": { "node": "16.x" },
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.2.5",
|
"@types/node": "^16.18.4",
|
||||||
"@types/nunjucks": "^3.2.2",
|
"@types/nunjucks": "^3.2.1",
|
||||||
"@types/xml2js": "^0.4.11",
|
"@types/xml2js": "^0.4.11",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||||
"@typescript-eslint/parser": "^5.59.8",
|
"@typescript-eslint/parser": "^5.45.0",
|
||||||
"eslint": "^8.42.0",
|
"eslint": "^8.29.0",
|
||||||
"tslib": "^2.5.3",
|
"tslib": "^2.4.1",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^4.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
server.js
Normal file
24
server.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// 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);
|
||||||
|
});
|
35
src/index.ts
35
src/index.ts
@@ -66,11 +66,7 @@ let completed = 0;
|
|||||||
* and we want to build the static output.
|
* and we want to build the static output.
|
||||||
*/
|
*/
|
||||||
const finishBuild: () => void = async () => {
|
const finishBuild: () => void = async () => {
|
||||||
completed++;
|
console.log("\nDone fetching everything!");
|
||||||
// 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
|
// generate the static HTML output from our template renderer
|
||||||
const output = render({
|
const output = render({
|
||||||
@@ -81,10 +77,10 @@ const finishBuild: () => void = async () => {
|
|||||||
|
|
||||||
// write the output to public/index.html
|
// write the output to public/index.html
|
||||||
await writeFile("./public/index.html", output);
|
await writeFile("./public/index.html", output);
|
||||||
process.stdout.write(
|
console.log(
|
||||||
`\nFinished writing to output:\n- ${feedListLength} feeds in ${benchmark(
|
`\nFinished writing to output:\n- ${feedListLength} feeds in ${benchmark(
|
||||||
initTime
|
initTime
|
||||||
)}\n- ${errors.length} errors\n`
|
)}\n- ${errors.length} errors`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,7 +103,8 @@ const processFeed =
|
|||||||
}) =>
|
}) =>
|
||||||
async (response: Response): Promise<void> => {
|
async (response: Response): Promise<void> => {
|
||||||
const body = await parseFeed(response);
|
const body = await parseFeed(response);
|
||||||
//skip to the next one if this didn't work out
|
completed++;
|
||||||
|
// skip to the next one if this didn't work out
|
||||||
if (!body) return;
|
if (!body) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -127,19 +124,20 @@ const processFeed =
|
|||||||
});
|
});
|
||||||
|
|
||||||
contentFromAllFeeds[group].push(contents as object);
|
contentFromAllFeeds[group].push(contents as object);
|
||||||
process.stdout.write(
|
console.log(
|
||||||
`${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}\n`
|
`${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
process.stdout.write(
|
console.log(
|
||||||
`${error("Error processing:")} ${feed} - ${benchmark(
|
`${error("Error processing:")} ${feed} - ${benchmark(
|
||||||
startTime
|
startTime
|
||||||
)}\n${err}\n`
|
)}\n${err}`
|
||||||
);
|
);
|
||||||
errors.push(`Error processing: ${feed}\n\t${err}`);
|
errors.push(`Error processing: ${feed}\n\t${err}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
finishBuild();
|
// if this is the last feed, go ahead and build the output
|
||||||
|
completed === feedListLength && finishBuild();
|
||||||
};
|
};
|
||||||
|
|
||||||
// go through each group of feeds and process
|
// go through each group of feeds and process
|
||||||
@@ -152,16 +150,15 @@ const processFeeds = () => {
|
|||||||
for (const feed of feeds) {
|
for (const feed of feeds) {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
process.stdout.write(`Fetching: ${feed}...\n`);
|
console.log(`Fetching: ${feed}...`);
|
||||||
|
|
||||||
fetch(feed)
|
fetch(feed)
|
||||||
.then(processFeed({ group, feed, startTime }))
|
.then(processFeed({ group, feed, startTime }))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
process.stdout.write(
|
console.log(
|
||||||
error(`Error fetching ${feed} ${benchmark(startTime)}\n`)
|
error(`Error fetching ${feed} ${benchmark(startTime)}`)
|
||||||
);
|
);
|
||||||
errors.push(`Error fetching ${feed} ${err.toString()}\n`);
|
errors.push(`Error fetching ${feed} ${err.toString()}`);
|
||||||
finishBuild();
|
|
||||||
});
|
});
|
||||||
}, (idx % (feedListLength / MAX_CONNECTIONS)) * DELAY_MS);
|
}, (idx % (feedListLength / MAX_CONNECTIONS)) * DELAY_MS);
|
||||||
idx++;
|
idx++;
|
||||||
@@ -169,4 +166,4 @@ const processFeeds = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
processFeeds();
|
processFeeds();
|
||||||
|
Reference in New Issue
Block a user