From 86252714cc94974524e263887a95a295937d2418 Mon Sep 17 00:00:00 2001 From: foreverxml Date: Thu, 12 May 2022 22:39:07 -0600 Subject: [PATCH] README and examples --- README.md | 72 ++++++++++++++++++++++++++++++++- sites.example.json | 10 +++++ templates/error.example.html | 12 ++++++ templates/ringhome.example.html | 16 ++++++++ 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 sites.example.json create mode 100644 templates/error.example.html create mode 100644 templates/ringhome.example.html diff --git a/README.md b/README.md index 1345b73..61c0515 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,71 @@ -# flaskring +# Flaskring -A simple webring backend made with Flask \ No newline at end of file +A simple webring backend made with Flask. + +## How to set up +Install the following dependencies: +```plain +python3 +python3-pip +git +``` +Then, run the following commands: +```sh +# Install flask from PIP +pip install flask + +# Clone the repo +git clone https://codeberg.org/amongtech/flaskring +cd flaskring + +# Edit these files as needed +cp templates/error.example.html templates/error.html +cp templates/ringhome.example.html templates/ringhome.html +cp sites.example.json sites.json + +# Once done, run the run command +flask run +``` +## Configuration + +### Static assets + +To make static assets, run the command: +```sh +mkdir static +``` +and place all static assets in there. In your files, reference them with `static/file.exs`. + +### `ringhome.html` + +`ringhome.html` is the homepage for your webring. You may use any valid HTML, CSS, JS, anything, but if you want your links to show on the homepage you must include a snippet like so: (the following snippet uses an unordered list to show all URLS, you can use anything): +```html + +``` + +### `error.html` + +`error.html` is loaded whenever there is an error with the request. The only required template message (to show the error) is `{{ text }}`. + +### `sites.json` + +A typical `sites.json` config would look as follows: +```json +{ "sites": [ + { + "name": "Example", + "url": "example.com" + }, + { + "name": "Example 2", + "url": "two.example.com" + } +]} +``` +These names are loaded into the index page, and the urls must not have an HTTP/HTTPS protocol indicator before them as Flaskring adds them. + +## Contributions are welcome! diff --git a/sites.example.json b/sites.example.json new file mode 100644 index 0000000..c405d82 --- /dev/null +++ b/sites.example.json @@ -0,0 +1,10 @@ +{ "sites": [ + { + "name": "Example", + "url": "example.com" + }, + { + "name": "Example 2", + "url": "two.example.com" + } +]} diff --git a/templates/error.example.html b/templates/error.example.html new file mode 100644 index 0000000..e47d196 --- /dev/null +++ b/templates/error.example.html @@ -0,0 +1,12 @@ + + + + + + Error + + +

Flaskring Error

+

{{ text }}

+ + diff --git a/templates/ringhome.example.html b/templates/ringhome.example.html new file mode 100644 index 0000000..710c4c1 --- /dev/null +++ b/templates/ringhome.example.html @@ -0,0 +1,16 @@ + + + + + + Flaskring Webring + + +

Flaskring Webring

+ + +