diff --git a/.gitignore b/.gitignore index 40261de..573958e 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,5 @@ cython_debug/ instance/ images/ + +config.json diff --git a/README.md b/README.md index 6850cac..5f8c37f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,15 @@ and you can also run the app using [./scripts/run.sh](./scripts/run.sh) to match the run.sh as the first run. running with gunicorn (run.sh) is for production use, for master key generation (first run), please -run it in dev mode: +run it in dev mode after making the config: + +make the config: + +```sh +cp src/imag/config.sample.json src/imag/config.json && nano config.json +``` + +run it: ```sh python3 src/main.py @@ -37,7 +45,7 @@ python3 src/main.py (make sure to save the key!) and only then with gunicorn -if you already ran it in production and don't know where the key is, run the following command : +if you already ran it in production and don't know where the key is, run the following command: ```sh rm -rf src/instance @@ -49,9 +57,10 @@ and then run it in debug this comes from an email the original creator got from a user: -1. clone the repository : `git clone https://git.everypizza.im/n/imag` -2. make sure you have virtualenv installed ( either through python-virtualenv / python3-virtualenv / py3-virtualenv packages, or by pip - `python3 -m pip install --user --break-system-packages --upgrade virtualenv` -3. ensure you have sqlite3 and memcached installed : `apt install sqlite3 memcached` -4. create a new virtual environment : `python3 -m virtualenv venv && source venv/bin/activate` -5. install the dependencies in the environment : `pip install -r requirements.txt` -6. run the app by either running `scripts/run.sh` or by manually starting memcached and running `src/main.py` with gunicorn ( i assume you're reverse proxying it anyway ) +1. clone the repository: `git clone https://git.everypizza.im/n/imag` +2. make sure you have virtualenv installed (either through python-virtualenv / python3-virtualenv / py3-virtualenv packages, or by pip - `python3 -m pip install --user --break-system-packages --upgrade virtualenv`) +3. ensure you have sqlite3 and memcached installed: `apt install sqlite3 memcached` +4. create a new virtual environment: `python3 -m virtualenv venv && source venv/bin/activate` +5. install the dependencies in the environment: `pip install -r requirements.txt` +6. configure the instance: `cp src/imag/config.sample.json src/imag/config.json && nano config.json` +6. run the app by either running `scripts/run.sh` or by manually starting memcached and running `src/main.py` with gunicorn (i assume you're reverse proxying it anyway) diff --git a/src/imag/__init__.py b/src/imag/__init__.py index 1f2051b..c73c508 100644 --- a/src/imag/__init__.py +++ b/src/imag/__init__.py @@ -4,8 +4,8 @@ import secrets import typing as t -from os import makedirs - +from os import makedirs, path +import json import flask from werkzeug.middleware.proxy_fix import ProxyFix @@ -13,6 +13,11 @@ from . import const, models from .api import api from .views import views +configLocation = path.dirname(path.abspath(__file__)) +with open(configLocation + '/config.json', 'r') as f: + config = json.load(f) +message = config["message"] + __version__: str = "3.1.2-nyx" @@ -54,6 +59,7 @@ def create_app(db: str = "sqlite:///imag.db") -> t.Tuple[flask.Flask, t.Optional "desc_len": const.DESC_LEN, "key_len": const.KEY_LEN, "imagv": __version__, + "imagmessage": message } @app.after_request diff --git a/src/imag/config.sample.json b/src/imag/config.sample.json new file mode 100644 index 0000000..6c0ec09 --- /dev/null +++ b/src/imag/config.sample.json @@ -0,0 +1,3 @@ +{ + "message": "meow" +} diff --git a/src/imag/static/index.css b/src/imag/static/index.css index 03cff6e..61a82cc 100644 --- a/src/imag/static/index.css +++ b/src/imag/static/index.css @@ -114,3 +114,7 @@ hr.thin{ width:50%; } +hr.tiny { + width:25%; +} + diff --git a/src/imag/templates/index.j2 b/src/imag/templates/index.j2 index 32dfb64..0448305 100644 --- a/src/imag/templates/index.j2 +++ b/src/imag/templates/index.j2 @@ -60,6 +60,14 @@ @quotes-python:everypizza.im +
+
+ + Board message: {{ imagmessage }} + +
+
+ {% with messages = get_flashed_messages(with_categories=True) %} {% if messages %}