README and examples
This commit is contained in:
parent
659cb17db2
commit
86252714cc
72
README.md
72
README.md
|
@ -1,3 +1,71 @@
|
|||
# flaskring
|
||||
# Flaskring
|
||||
|
||||
A simple webring backend made with Flask
|
||||
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
|
||||
<ul>
|
||||
{% for site in sites %}
|
||||
<li><a href="https://{{ site.url }}">{{ site.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
```
|
||||
|
||||
### `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!
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{ "sites": [
|
||||
{
|
||||
"name": "Example",
|
||||
"url": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "Example 2",
|
||||
"url": "two.example.com"
|
||||
}
|
||||
]}
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Error</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Flaskring Error</h1>
|
||||
<h3>{{ text }}</h3>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Flaskring Webring</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Flaskring Webring</h1>
|
||||
<ul>
|
||||
{% for site in sites %}
|
||||
<li><a href="https://{{ site.url }}">{{ site.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue