diff options
-rw-r--r-- | app.json | 28 | ||||
-rw-r--r-- | runtime.txt | 2 | ||||
-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 |
7 files changed, 52 insertions, 31 deletions
@@ -1,16 +1,20 @@ { "name": "Newspipe", "description": "A news aggregator that can be deployed on Heroku.", - "keywords": ["aggregator", "news", "RSS"], + "keywords": [ + "aggregator", + "news", + "RSS" + ], "website": "https://github.com/newspipe/", "repository": "https://github.com/newspipe/newspipe", "logo": "https://raw.githubusercontent.com/newspipe/newspipe/master/src/web/static/img/newspipe.png", "scripts": { - "postdeploy": "python src/manager.py db_create" + "postdeploy": "python src/manager.py db_create; cd submodules/bootstrap/; git clone https://github.com/twbs/bootstrap.git" }, "env": { "PLATFORM_URL": { - "description": "Address of your instance (for example: https://your-application-name.herokuapp.com/)", + "description": "Address of your instance (for example: https://YOUR-APPLICATION-NAME.herokuapp.com/)", "required": true, "value": "" }, @@ -42,7 +46,7 @@ "TOKEN_VALIDITY_PERIOD": { "description": "Validity period (in seconds) of the account confirmation link sent by email.", "required": true, - "value": 3600 + "value": "3600" }, "HEROKU": "1", "CDN_ADDRESS": "https://cdn.cedricbonhomme.org/", @@ -54,25 +58,11 @@ }, "FEED_REFRESH_INTERVAL": { "description": "Feeds refresh interval (in minutes) for the crawler.", - "value": 120 + "value": "120" } }, "addons": [ "heroku-postgresql:hobby-dev", "scheduler:standard" - ], - "buildpacks": [ - { - "url": "heroku/python", - "index": 1 - }, - { - "url": "https://github.com/heroku/heroku-buildpack-nodejs", - "index": 2 - }, - { - "url": "https://github.com/ejholmes/heroku-buildpack-bower", - "index": 3 - } ] } diff --git a/runtime.txt b/runtime.txt index c0354eef..c91e43be 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.5.2 +python-3.6.1 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()) |