aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-04-06 07:49:12 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-04-06 07:49:12 +0200
commitde05845887181f949780f5627570713b4d3ca93b (patch)
tree939022f287c9a272af2aee9c280a12c6ef303f94
parentNow using Heroku Python runtime 3.6.1. (diff)
downloadnewspipe-de05845887181f949780f5627570713b4d3ca93b.tar.gz
newspipe-de05845887181f949780f5627570713b4d3ca93b.tar.bz2
newspipe-de05845887181f949780f5627570713b4d3ca93b.zip
Added a page which displays some information about the instance.
-rw-r--r--src/web/__init__.py8
-rw-r--r--src/web/templates/about_more.html10
-rw-r--r--src/web/views/views.py12
3 files changed, 28 insertions, 2 deletions
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_more.html b/src/web/templates/about_more.html
new file mode 100644
index 00000000..0b934aab
--- /dev/null
+++ b/src/web/templates/about_more.html
@@ -0,0 +1,10 @@
+{% 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">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..d599143f 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,9 @@ from flask import (request, render_template, flash,
from flask_babel import gettext
from sqlalchemy import desc
+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,9 +76,15 @@ 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('/about/more', methods=['GET'])
+@etag_match
+def about_more():
+ return render_template('about_more.html',
+ newspipe_version=__version__.split()[1],
+ python_version="{}.{}.{}".format(*sys.version_info[:3]),
+ nb_users=UserController().read().count())
@current_app.route('/.well-known/acme-challenge/MmwFRp_wOgBGHcIULSUGVFDjpryEw_uWz7UgD6rE4t4')
def letsencrypt():
bgstack15