summaryrefslogtreecommitdiffstats
path: root/ogcp/__init__.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove id from client's bubblesJavier Hernandez2023-12-211-0/+1
| | | | | | | | Remove id from client's bubbles in the following commands: Power (Poweroff, Poweron, Reboot); Setup (Set boot mode, Set ogLive); Client (Start session) To make the string replacement, a custom jinja filter has been created
* init: missing import loggingOpenGnSys Support Team2023-12-041-0/+1
| | | | | | | | Otherwise: NameError: name 'logging' is not defined is reported.
* init: filter out GET /scopes/status requestsOpenGnSys Support Team2023-12-011-0/+6
| | | | | | | | | ogcp.js calls this endpoint very often, which send a request to the ogserver through the REST API. This call is needed because javascript code cannot directly talk to the ogserver since it does not know what the API_KEY is. Add a filter to skip log GET /scopes/status requests. Thanks to DaniGM for helping with this.
* Store configuration file path on a global variableJavier Sánchez Parra2022-09-271-1/+3
| | | | | Otherwise, users may change the file path on one place of the code and forget to change the other places.
* Add language configuration and Spanish translationJavier Sánchez Parra2022-01-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commits configures and sets up flask-babel and adds Spanish po file. Flask-babel is already a dependency so this commits no needs to add it. Users can edit ogcp.json to choose between English or Spanish. After changing the language in the configuration file, users must restart ogcp service. Instructions to generate translation files, inspired by https://flask-babel.tkte.ch/: 1. Download ogcp source code. git clone git://git.soleta.eu/ogCP /path/to/ogcp 2. Create a python virtual environment. python3 -m venv /path/to/new/venv 3. Activate the virtual environment. source /path/to/new/venv/bin/activate 4. Install dependencies to the virtual environment. cd /path/to/ogcp pip3 install -r requirements.txt 5. Extract ogcp strings. cd /path/to/ogcp/ogcp pybabel extract -F babel.cfg -k _l -o messages.pot . NOTE: "-k _l" is needed to extract strings which use lazy translations. 6. Create or update translation files. a. Create translation file. This example creates a french translation file. pybabel init -i messages.pot -d translations -l fr b. Update translation files. You need to do this when ogcp strings change and want to update current supported languages. pybabel update -i messages.pot -d translations 7. Edit the translations .po file as needed. Example route: /path/to/ogcp/ogcp/translations/fr/LC_MESSAGES/messages.po. 8. Compile translations. pybabel compile -d translations 9. Launch ogcp and check the translations. cd /path/to/ogcp pip3 install -r requirements.txt 10. Commit and push .po files with translation changes.
* ogcp is AGPLv3+OpenGnSys Support Team2021-05-201-0/+7
| | | | Update license header in files.
* config: rename config file to ogcp.jsonJose M. Guisado2020-11-061-1/+1
| | | | Do not use the same name as ogserver config file.
* config: use from_json to read ogserver configJose M. Guisado2020-11-061-1/+3
| | | | | | | | | | | | | | | This patch introduces the usage of Flask.Config class so the config can be read at startup (__init__) only once. Config keys must be uppercase so that from_json method does take it into account. dormousehole.readthedocs.io/en/stable/api.html#flask.Config.from_json Prior to this patch each request required opening and closing the ogserver.json file via load_config in views.py. In the future the decorated load_config function inside views.py may be removed to avoid creating multiple instances of the OGServer class.
* Add WoL actionRoberto Hueso Gómez2020-09-041-0/+8
| | | | | | This action can be applied on one or multiple scopes. This implementation use Flask-WTF as a way to build and valdiate forms. As a side effect, this adds CSRF protection to all forms.
* Add basic backend structureRoberto Hueso Gómez2020-08-311-0/+6
This adds views functions and ogServer config loading.