aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newspipe/bootstrap.py2
-rw-r--r--newspipe/conf.py30
-rw-r--r--newspipe/notifications/emails.py8
-rwxr-xr-xnewspipe/runserver.py3
-rw-r--r--newspipe/web/templates/about_more.html3
-rw-r--r--newspipe/web/templates/layout.html2
-rw-r--r--newspipe/web/views/home.py3
-rw-r--r--newspipe/web/views/views.py2
-rw-r--r--poetry.lock16
-rw-r--r--pyproject.toml1
10 files changed, 11 insertions, 59 deletions
diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py
index 8e5413e0..004bebf0 100644
--- a/newspipe/bootstrap.py
+++ b/newspipe/bootstrap.py
@@ -15,8 +15,6 @@ def set_logging(log_path=None, log_level=logging.INFO, modules=(),
if not modules:
modules = ('root', 'bootstrap', 'runserver',
'web', 'crawler.default_crawler', 'manager', 'plugins')
- if conf.ON_HEROKU:
- log_format = '%(levelname)s %(message)s'
if log_path:
if not os.path.exists(os.path.dirname(log_path)):
os.makedirs(os.path.dirname(log_path))
diff --git a/newspipe/conf.py b/newspipe/conf.py
index ced602ca..96445b24 100644
--- a/newspipe/conf.py
+++ b/newspipe/conf.py
@@ -4,6 +4,7 @@
This file contain the variables used by the application.
"""
+import configparser as confparser
import os
import logging
@@ -22,7 +23,6 @@ TIME_ZONE = {
"fr": "Europe/Paris"
}
-ON_HEROKU = int(os.environ.get('HEROKU', 0)) == 1
DEFAULTS = {"platform_url": "https://www.newspipe.org/",
"self_registration": "false",
"cdn_address": "",
@@ -47,27 +47,10 @@ DEFAULTS = {"platform_url": "https://www.newspipe.org/",
"feed_refresh_interval": "120"
}
-if not ON_HEROKU:
- import configparser as confparser
- # load the configuration
- config = confparser.SafeConfigParser(defaults=DEFAULTS)
- config.read(os.path.join(BASE_DIR, "conf/conf.cfg"))
-else:
- class Config(object):
- def get(self, _, name):
- return os.environ.get(name.upper(), DEFAULTS.get(name))
- def getint(self, _, name):
- return int(self.get(_, name))
-
- def getboolean(self, _, name):
- value = self.get(_, name)
- if value == 'true':
- return True
- elif value == 'false':
- return False
- return None
- config = Config()
+# load the configuration
+config = confparser.SafeConfigParser(defaults=DEFAULTS)
+config.read(os.path.join(BASE_DIR, "conf/conf.cfg"))
WEBSERVER_HOST = config.get('webserver', 'host')
@@ -88,10 +71,7 @@ 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:
- LOG_PATH = ''
+LOG_PATH = os.path.abspath(config.get('misc', 'log_path'))
LOG_LEVEL = {'debug': logging.DEBUG,
'info': logging.INFO,
'warn': logging.WARN,
diff --git a/newspipe/notifications/emails.py b/newspipe/notifications/emails.py
index 098c29bf..e1f2c272 100644
--- a/newspipe/notifications/emails.py
+++ b/newspipe/notifications/emails.py
@@ -46,13 +46,9 @@ def send_async_email(mfrom, mto, msg):
def send(*args, **kwargs):
"""
- This functions enables to send email through SendGrid
- or a SMTP server.
+ This functions enables to send email via different method.
"""
- if conf.ON_HEROKU:
- send_sendgrid(**kwargs)
- else:
- send_smtp(**kwargs)
+ send_smtp(**kwargs)
def send_smtp(to="", bcc="", subject="", plaintext="", html=""):
"""
diff --git a/newspipe/runserver.py b/newspipe/runserver.py
index 287a52f8..a1ebb54c 100755
--- a/newspipe/runserver.py
+++ b/newspipe/runserver.py
@@ -22,9 +22,6 @@ import calendar
from bootstrap import conf, application, populate_g
from flask_babel import Babel, format_datetime
-if conf.ON_HEROKU:
- from flask_sslify import SSLify
- SSLify(application, subdomains=True)
babel = Babel(application)
diff --git a/newspipe/web/templates/about_more.html b/newspipe/web/templates/about_more.html
index d4353a15..3b253b25 100644
--- a/newspipe/web/templates/about_more.html
+++ b/newspipe/web/templates/about_more.html
@@ -2,8 +2,7 @@
{% block content %}
<div class="container">
<ul class="list-group">
- <li class="list-group-item">{{ _('Newspipe version') }}: <a href="https://git.sr.ht/~cedric/Newspipe/refs/{{newspipe_version}}">{{newspipe_version}}</a></li>
- <li class="list-group-item">{{ _('Running on Heroku') }}: {{on_heroku}}</li>
+ <li class="list-group-item">{{ _('Newspipe version') }}: <a href="https://git.sr.ht/~cedric/newspipe/refs/{{newspipe_version}}">{{newspipe_version}}</a></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>
diff --git a/newspipe/web/templates/layout.html b/newspipe/web/templates/layout.html
index 29d4470f..eecfb472 100644
--- a/newspipe/web/templates/layout.html
+++ b/newspipe/web/templates/layout.html
@@ -47,7 +47,7 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_authenticated %}
- {% if conf.CRAWLING_METHOD == "default" and (not conf.ON_HEROKU or current_user.is_admin) %}
+ {% if conf.CRAWLING_METHOD == "default" and current_user.is_admin %}
<li><a href="/fetch"><span class="glyphicon glyphicon-import"></span> {{ _('Fetch') }}</a></li>
{% endif %}
<li class="dropdown">
diff --git a/newspipe/web/views/home.py b/newspipe/web/views/home.py
index 34ecb9fa..dc7a361a 100644
--- a/newspipe/web/views/home.py
+++ b/newspipe/web/views/home.py
@@ -162,8 +162,7 @@ def fetch(feed_id=None):
Triggers the download of news.
News are downloaded in a separated process.
"""
- if conf.CRAWLING_METHOD == "default" \
- and (not conf.ON_HEROKU or current_user.is_admin):
+ if conf.CRAWLING_METHOD == "default" and current_user.is_admin:
misc_utils.fetch(current_user.id, feed_id)
flash(gettext("Downloading articles..."), "info")
else:
diff --git a/newspipe/web/views/views.py b/newspipe/web/views/views.py
index 57f790b1..d587bd09 100644
--- a/newspipe/web/views/views.py
+++ b/newspipe/web/views/views.py
@@ -88,8 +88,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],
registration=[conf.SELF_REGISTRATION and 'Open' or 'Closed'][0],
python_version="{}.{}.{}".format(*sys.version_info[:3]),
nb_users=UserController().read().count())
-
diff --git a/poetry.lock b/poetry.lock
index 9c1388f8..83a8feba 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -262,17 +262,6 @@ SQLAlchemy = ">=0.8.0"
[[package]]
category = "main"
-description = "Force SSL on your Flask app."
-name = "flask-sslify"
-optional = false
-python-versions = "*"
-version = "0.1.5"
-
-[package.dependencies]
-Flask = "*"
-
-[[package]]
-category = "main"
description = "Simple integration of Flask and WTForms."
name = "flask-wtf"
optional = false
@@ -589,7 +578,7 @@ idna = ">=2.0"
multidict = ">=4.0"
[metadata]
-content-hash = "6714462ca1b9ea98f6ec5d7ef69d7ddbed1ae0687cbff95accbcda74074714a2"
+content-hash = "55d68271b42d43858eb45a17f1de68d89ed73cd5b72a497af0d64185b1c9ca1b"
python-versions = "^3.8"
[metadata.files]
@@ -687,9 +676,6 @@ flask-sqlalchemy = [
{file = "Flask-SQLAlchemy-2.4.1.tar.gz", hash = "sha256:6974785d913666587949f7c2946f7001e4fa2cb2d19f4e69ead02e4b8f50b33d"},
{file = "Flask_SQLAlchemy-2.4.1-py2.py3-none-any.whl", hash = "sha256:0078d8663330dc05a74bc72b3b6ddc441b9a744e2f56fe60af1a5bfc81334327"},
]
-flask-sslify = [
- {file = "Flask-SSLify-0.1.5.tar.gz", hash = "sha256:d33e1d3c09cd95154176aa8a7319418e52129fc482dd56d8a8ad7c24500d543e"},
-]
flask-wtf = [
{file = "Flask-WTF-0.14.3.tar.gz", hash = "sha256:d417e3a0008b5ba583da1763e4db0f55a1269d9dd91dcc3eb3c026d3c5dbd720"},
{file = "Flask_WTF-0.14.3-py2.py3-none-any.whl", hash = "sha256:57b3faf6fe5d6168bda0c36b0df1d05770f8e205e18332d0376ddb954d17aef2"},
diff --git a/pyproject.toml b/pyproject.toml
index fb57d65e..bfc12cea 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -26,7 +26,6 @@ Flask-RESTful = "^0.3.8"
Flask-Restless = "^0.17.0"
Flask-paginate = "^0.5.5"
Flask-Babel = "^1.0.0"
-Flask-SSLify = "^0.1.5"
Flask-Migrate = "^2.5.2"
Flask-Script = "^2.0.6"
WTForms = "^2.2.1"
bgstack15