| Total Complexity | 2 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 93.75% |
| Changes | 0 | ||
| 1 | 1 | from collections import OrderedDict |
|
| 2 | |||
| 3 | 1 | from flask import Blueprint, current_app |
|
|
|
|||
| 4 | |||
| 5 | 1 | from .. import __version__ |
|
| 6 | |||
| 7 | 1 | from ._utils import route |
|
| 8 | |||
| 9 | |||
| 10 | 1 | blueprint = Blueprint('root', __name__) |
|
| 11 | |||
| 12 | |||
| 13 | 1 | @blueprint.route("/api/") |
|
| 14 | def get(): |
||
| 15 | """Generate memes from templates.""" |
||
| 16 | 1 | data = OrderedDict() |
|
| 17 | 1 | data['templates'] = route('templates.get', _external=True) |
|
| 18 | 1 | data['fonts'] = route('fonts.get', _external=True) |
|
| 19 | 1 | data['aliases'] = route('aliases.get', _external=True) |
|
| 20 | 1 | data['search'] = route('search.get', _external=True) |
|
| 21 | 1 | data['version'] = __version__ |
|
| 22 | 1 | data['changes'] = current_app.config['CHANGES_URL'] |
|
| 23 | 1 | return data |
|
| 24 | |||
| 25 | |||
| 26 | 1 | @blueprint.route("/CHECK") |
|
| 27 | def handle_checks(): |
||
| 28 | """Return CHECK_OK for zero-downtime deployment. |
||
| 29 | |||
| 30 | See: https://labnotes.org/zero-downtime-deploy-with-dokku |
||
| 31 | |||
| 32 | """ |
||
| 33 | return "CHECK_OK" |
||
| 34 |