worker-planet/README.md

61 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2021-04-25 21:25:37 +02:00
# Worker-planet
2024-04-19 20:46:14 +02:00
This project is meant to be an easy way to aggregate, on a single page, content from multiple sources.
2021-04-25 21:25:37 +02:00
It takes a list of existing RSS feeds, aggregates their contents and displays them in chronological order.
2024-04-19 20:46:14 +02:00
It was inspired by other software packages, such as [Planet](<https://en.wikipedia.org/wiki/Planet_(software)>) and [MoonMoon](https://moonmoon.org/), but runs on top of Cloudflare Workers instead of being deployed on your own server.
This ends up being especially useful for communities to follow the work being done and published by their members.
2024-04-19 20:46:14 +02:00
Below are some examples of existing "planets" that use different software:
2021-04-25 21:25:37 +02:00
- https://planet.debian.org/
- https://planet.kde.org/
- https://planet.gnome.org/
2024-04-19 20:46:14 +02:00
An example of a live planet using `worker-planet` software is:
- https://infosecplanet.ovalerio.net
_If you wish to add your deployment to this list, feel free to create a PR._
2021-04-25 21:43:06 +02:00
2021-04-25 21:25:37 +02:00
# How to deploy
2024-04-19 20:46:14 +02:00
1. Clone this repository.
2. Install the project dependencies: `npm install`.
3. Create a `wrangler.toml` file based on the existing `wrangler.toml.example`.
4. Create KV namespaces and add their IDs to the `kv_namespaces` setting on `wrangler.toml`.
5. Add your `account_id` and customize all the `vars` in `wrangler.toml`. `FEEDS` should be a string of comma-separated URLs, one for each of the RSS/ATOM sources that will be part of your planet.
6. Build the worker bundle: `npm run build`.
7. Deploy your new worker: `npm run deploy`.
2024-04-19 20:46:14 +02:00
**Note:** For the last step, you might need to set the `CLOUDFLARE_API_TOKEN` environment variable.
2021-04-25 21:43:06 +02:00
## Configuration variables
2024-04-19 20:46:14 +02:00
- **FEEDS** - list of sources used to fetch the planet's content (separate each URL with a comma)
- **TITLE** - Name of your planet (included in the generated HTML page and RSS feed)
2021-05-01 20:35:07 +02:00
- **DESCRIPTION** - Free text to be included on the page (currently not used on the included template)
- **MAX_SIZE** - Number of posts/entries that will be included on the page/feed
- **CACHE_MAX_AGE** - To avoid hitting the KV store each time the content is fetched, the static content is cached. You should adjust this value to the frequency you pick for your cron. Defined in seconds (default: 3600)
2021-04-25 21:43:06 +02:00
## Customize the generated HTML
Each community has its own identity, so you should be able to easily customize the look and feel
2024-04-19 20:46:14 +02:00
of the generated page. To do so, before publishing, you can edit one of the existing templates in the `templates` folder.
2021-04-25 21:43:06 +02:00
2024-04-19 20:46:14 +02:00
After that, you should "precompile" that file using the following command:
2021-04-25 21:43:06 +02:00
> \$ npm run template -- templates/default.handlebars -f templates/default.precompiled.js
If the template name you are using is different from `default`, you should change the following 2 lines in `index.js`:
```javascript
import template from './templates/default.precompiled'
```
```javascript
let template = Handlebars.templates['default']
```