diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.py | 10 | ||||
-rw-r--r-- | src/web/__init__.py | 8 | ||||
-rw-r--r-- | src/web/templates/about.html | 1 | ||||
-rw-r--r-- | src/web/templates/about_more.html | 12 | ||||
-rw-r--r-- | src/web/views/views.py | 22 |
5 files changed, 42 insertions, 11 deletions
diff --git a/src/conf.py b/src/conf.py index 70fde9c4..756c1557 100644 --- a/src/conf.py +++ b/src/conf.py @@ -80,7 +80,10 @@ PLATFORM_URL = config.get('misc', 'platform_url') ADMIN_EMAIL = config.get('misc', 'admin_email') SELF_REGISTRATION = config.getboolean('misc', 'self_registration') SECURITY_PASSWORD_SALT = config.get('misc', 'security_password_salt') -TOKEN_VALIDITY_PERIOD = config.getint('misc', 'token_validity_period') +try: + TOKEN_VALIDITY_PERIOD = config.getint('misc', 'token_validity_period') +except: + TOKEN_VALIDITY_PERIOD = int(config.get('misc', 'token_validity_period')) if not ON_HEROKU: LOG_PATH = os.path.abspath(config.get('misc', 'log_path')) else: @@ -99,7 +102,10 @@ DEFAULT_MAX_ERROR = config.getint('crawler', 'default_max_error') ERROR_THRESHOLD = int(DEFAULT_MAX_ERROR / 2) CRAWLER_TIMEOUT = config.get('crawler', 'timeout') CRAWLER_RESOLV = config.getboolean('crawler', 'resolv') -FEED_REFRESH_INTERVAL = config.getint('crawler', 'feed_refresh_interval') +try: + FEED_REFRESH_INTERVAL = config.getint('crawler', 'feed_refresh_interval') +except: + FEED_REFRESH_INTERVAL = int(config.get('crawler', 'feed_refresh_interval')) NOTIFICATION_EMAIL = config.get('notification', 'notification_email') NOTIFICATION_HOST = config.get('notification', 'host') diff --git a/src/web/__init__.py b/src/web/__init__.py index e69de29b..cca2a501 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -0,0 +1,8 @@ +__author__ = "Cedric Bonhomme" +__version__ = "$Revision: 7.1.3 $" +__date__ = "$Date: 2016/11/14 $" +__revision__ = "$Date: 2016/11/14 $" +__copyright__ = "Copyright (c) Cedric Bonhomme" +__license__ = "GPLv3" + +__all__ = [__version__] diff --git a/src/web/templates/about.html b/src/web/templates/about.html index c2d0ae4d..70ae0a5f 100644 --- a/src/web/templates/about.html +++ b/src/web/templates/about.html @@ -12,6 +12,7 @@ redistribute the <a href="https://github.com/newspipe/newspipe">source code</a> according to the <a href="https://www.gnu.org/licenses/agpl-3.0.html">Affero GPL</a> license.') }}</p> <p>{{ _('Found a bug? Report it <a href="https://github.com/newspipe/newspipe/issues">here</a>.') }}</p> + <p><a href="{{ url_for('about_more') }}">More information</a> about this instance.</p> </div> <div class="well"> <h1>{{ _('Help') }}</h1> diff --git a/src/web/templates/about_more.html b/src/web/templates/about_more.html new file mode 100644 index 00000000..dd7088a5 --- /dev/null +++ b/src/web/templates/about_more.html @@ -0,0 +1,12 @@ +{% extends "layout.html" %} +{% block content %} +<div class="container"> + <ul class="list-group"> + <li class="list-group-item">Newspipe version: <a href="https://github.com/newspipe/newspipe/releases/tag/{{newspipe_version}}">{{newspipe_version}}</a></li> + <li class="list-group-item">Running on Heroku: {{on_heroku}}</li> + <li class="list-group-item">Registration: {{registration}}</li> + <li class="list-group-item">Python version: {{python_version}}</li> + <li class="list-group-item">Number of users: {{nb_users}}</li> + </ul> +</div><!-- /.container --> +{% endblock %} diff --git a/src/web/views/views.py b/src/web/views/views.py index b8d9514f..03d6501d 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -1,3 +1,4 @@ +import sys import logging import operator from datetime import datetime, timedelta @@ -6,8 +7,10 @@ from flask import (request, render_template, flash, from flask_babel import gettext from sqlalchemy import desc +import conf +from web import __version__ from conf import API_ROOT, ADMIN_EMAIL -from web.controllers import FeedController +from web.controllers import FeedController, UserController from web.lib.view_utils import etag_match logger = logging.getLogger(__name__) @@ -74,13 +77,14 @@ def popular(): @current_app.route('/about', methods=['GET']) @etag_match def about(): - print(ADMIN_EMAIL) return render_template('about.html', contact=ADMIN_EMAIL) - -@current_app.route('/.well-known/acme-challenge/MmwFRp_wOgBGHcIULSUGVFDjpryEw_uWz7UgD6rE4t4') -def letsencrypt(): - """ - To validate the TLS certificate. - """ - return 'MmwFRp_wOgBGHcIULSUGVFDjpryEw_uWz7UgD6rE4t4.bUlx3NWj4YZ59CkBunuvzS0GnW5Kh9i4yehDEP4AEdU' +@current_app.route('/about/more', methods=['GET']) +@etag_match +def about_more(): + return render_template('about_more.html', + newspipe_version=__version__.split()[1], + on_heroku=[conf.ON_HEROKU and 'Yes' or 'No'][0], + registration=[conf.SELF_REGISTRATION and 'Open' or 'Closed'][0], + python_version="{}.{}.{}".format(*sys.version_info[:3]), + nb_users=UserController().read().count()) |