From de05845887181f949780f5627570713b4d3ca93b Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 6 Apr 2017 07:49:12 +0200 Subject: Added a page which displays some information about the instance. --- src/web/__init__.py | 8 ++++++++ src/web/templates/about_more.html | 10 ++++++++++ src/web/views/views.py | 12 ++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/web/templates/about_more.html (limited to 'src/web') 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 %} +
+ +
+{% 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(): -- cgit From 9540d3341b6492b0c903b042288d3271988be4dd Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 6 Apr 2017 07:51:11 +0200 Subject: Updated about page. --- src/web/templates/about.html | 1 + 1 file changed, 1 insertion(+) (limited to 'src/web') 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 source code according to the Affero GPL license.') }}

{{ _('Found a bug? Report it here.') }}

+

More information about this instance.

{{ _('Help') }}

-- cgit From 5673c95312d0661488c86b21dfb8653b6d249c43 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 6 Apr 2017 07:51:53 +0200 Subject: Removed now useless endpoint. --- src/web/views/views.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/web') diff --git a/src/web/views/views.py b/src/web/views/views.py index d599143f..4dffdf37 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -85,10 +85,3 @@ def about_more(): 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(): - """ - To validate the TLS certificate. - """ - return 'MmwFRp_wOgBGHcIULSUGVFDjpryEw_uWz7UgD6rE4t4.bUlx3NWj4YZ59CkBunuvzS0GnW5Kh9i4yehDEP4AEdU' -- cgit From bb71e242b67b8bf7baca1ca1c4f47624ffd77738 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 6 Apr 2017 07:57:09 +0200 Subject: Displays if the the instance is running on Heroku. --- src/web/templates/about_more.html | 1 + src/web/views/views.py | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/web') diff --git a/src/web/templates/about_more.html b/src/web/templates/about_more.html index 0b934aab..47c321ca 100644 --- a/src/web/templates/about_more.html +++ b/src/web/templates/about_more.html @@ -3,6 +3,7 @@
  • Newspipe version: {{newspipe_version}}
  • +
  • Running on Heroku: {{on_heroku}}
  • Python version: {{python_version}}
  • Number of users: {{nb_users}}
diff --git a/src/web/views/views.py b/src/web/views/views.py index 4dffdf37..0a785ceb 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -7,6 +7,7 @@ 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, UserController @@ -83,5 +84,6 @@ def about(): def about_more(): return render_template('about_more.html', newspipe_version=__version__.split()[1], + on_heroku=[conf.ON_HEROKU and 'Yes' or 'No'][0], python_version="{}.{}.{}".format(*sys.version_info[:3]), nb_users=UserController().read().count()) -- cgit From 7312031dbc8ab5e15c329ae97295cb4c0982fd5e Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 6 Apr 2017 08:01:52 +0200 Subject: Added registration status. --- src/web/templates/about_more.html | 1 + src/web/views/views.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/web') diff --git a/src/web/templates/about_more.html b/src/web/templates/about_more.html index 47c321ca..dd7088a5 100644 --- a/src/web/templates/about_more.html +++ b/src/web/templates/about_more.html @@ -4,6 +4,7 @@
  • Newspipe version: {{newspipe_version}}
  • Running on Heroku: {{on_heroku}}
  • +
  • Registration: {{registration}}
  • Python version: {{python_version}}
  • Number of users: {{nb_users}}
diff --git a/src/web/views/views.py b/src/web/views/views.py index 0a785ceb..03d6501d 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -83,7 +83,8 @@ def about(): @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], - python_version="{}.{}.{}".format(*sys.version_info[:3]), - nb_users=UserController().read().count()) + 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()) -- cgit