aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newspipe/lib/utils.py9
-rw-r--r--newspipe/web/forms.py3
-rw-r--r--newspipe/web/views/admin.py3
-rw-r--r--newspipe/web/views/article.py3
-rw-r--r--newspipe/web/views/bookmark.py3
-rw-r--r--newspipe/web/views/category.py3
-rw-r--r--newspipe/web/views/feed.py3
-rw-r--r--newspipe/web/views/home.py3
-rw-r--r--newspipe/web/views/session_mgmt.py3
-rw-r--r--newspipe/web/views/user.py3
-rw-r--r--newspipe/web/views/views.py3
11 files changed, 28 insertions, 11 deletions
diff --git a/newspipe/lib/utils.py b/newspipe/lib/utils.py
index e839d99c..0ac0a28b 100644
--- a/newspipe/lib/utils.py
+++ b/newspipe/lib/utils.py
@@ -6,12 +6,19 @@ from hashlib import md5
import requests
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from newspipe.bootstrap import application
logger = logging.getLogger(__name__)
+def url_for(endpoint, **values):
+ """ Custom reverse-proxy support for url_for """
+ _uf = f_url_for(endpoint, **values)
+ if application.config and "PREFIX" in application.config:
+ _uf = str(application.config("PREFIX")) + _uf
+ return _uf
+
def default_handler(obj, role="admin"):
"""JSON handler for default query formatting"""
diff --git a/newspipe/web/forms.py b/newspipe/web/forms.py
index 0f6200f8..0853d252 100644
--- a/newspipe/web/forms.py
+++ b/newspipe/web/forms.py
@@ -26,7 +26,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
import logging
-from flask import redirect, url_for
+from flask import redirect, url_for as f_url_for
from flask_babel import lazy_gettext
from flask_wtf import FlaskForm
from werkzeug.exceptions import NotFound
@@ -46,6 +46,7 @@ from wtforms.fields.html5 import EmailField, URLField
from newspipe.bootstrap import application
from newspipe.controllers import UserController, LdapuserController
from newspipe.lib import misc_utils
+from newspipe.lib.utils import url_for
from newspipe.models import User
logger = logging.getLogger(__name__)
diff --git a/newspipe/web/views/admin.py b/newspipe/web/views/admin.py
index 6f412901..84395ff0 100644
--- a/newspipe/web/views/admin.py
+++ b/newspipe/web/views/admin.py
@@ -4,13 +4,14 @@ from flask import Blueprint
from flask import flash
from flask import redirect
from flask import render_template
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import format_timedelta
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
from newspipe.controllers import UserController
+from newspipe.lib.utils import url_for
from newspipe.web.forms import InformationMessageForm
from newspipe.web.forms import UserForm
from newspipe.web.views.common import admin_permission
diff --git a/newspipe/web/views/article.py b/newspipe/web/views/article.py
index 8d4054db..df9d068f 100644
--- a/newspipe/web/views/article.py
+++ b/newspipe/web/views/article.py
@@ -7,7 +7,7 @@ from flask import make_response
from flask import redirect
from flask import render_template
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
@@ -18,6 +18,7 @@ from newspipe.controllers import UserController
from newspipe.lib.data import export_json
from newspipe.lib.utils import clear_string
from newspipe.lib.utils import redirect_url
+from newspipe.lib.utils import url_for
from newspipe.web.lib.view_utils import etag_match
articles_bp = Blueprint("articles", __name__, url_prefix="/articles")
diff --git a/newspipe/web/views/bookmark.py b/newspipe/web/views/bookmark.py
index 59461755..c5410bf7 100644
--- a/newspipe/web/views/bookmark.py
+++ b/newspipe/web/views/bookmark.py
@@ -33,7 +33,7 @@ from flask import (
redirect,
render_template,
request,
- url_for,
+ url_for as f_url_for,
)
from flask_babel import gettext
from flask_login import current_user, login_required
@@ -44,6 +44,7 @@ from newspipe.bootstrap import db
from newspipe.controllers import BookmarkController
from newspipe.lib.data import export_bookmarks, import_pinboard_json
from newspipe.lib.utils import redirect_url
+from newspipe.lib.utils import url_for
from newspipe.web.forms import BookmarkForm
logger = logging.getLogger(__name__)
diff --git a/newspipe/web/views/category.py b/newspipe/web/views/category.py
index 962e5478..015a926d 100644
--- a/newspipe/web/views/category.py
+++ b/newspipe/web/views/category.py
@@ -2,7 +2,7 @@ from flask import Blueprint
from flask import flash
from flask import redirect
from flask import render_template
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
@@ -11,6 +11,7 @@ from newspipe.controllers import ArticleController
from newspipe.controllers import CategoryController
from newspipe.controllers import FeedController
from newspipe.lib.utils import redirect_url
+from newspipe.lib.utils import url_for
from newspipe.web.forms import CategoryForm
from newspipe.web.lib.view_utils import etag_match
diff --git a/newspipe/web/views/feed.py b/newspipe/web/views/feed.py
index 9499ba01..7da1139b 100644
--- a/newspipe/web/views/feed.py
+++ b/newspipe/web/views/feed.py
@@ -9,7 +9,7 @@ from flask import make_response
from flask import redirect
from flask import render_template
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
@@ -24,6 +24,7 @@ from newspipe.controllers import FeedController
from newspipe.controllers import UserController
from newspipe.lib import misc_utils
from newspipe.lib import utils
+from newspipe.lib.utils import url_for
from newspipe.lib.feed_utils import construct_feed_from
from newspipe.web.forms import AddFeedForm
from newspipe.web.lib.view_utils import etag_match
diff --git a/newspipe/web/views/home.py b/newspipe/web/views/home.py
index 8a3ee0a0..58320766 100644
--- a/newspipe/web/views/home.py
+++ b/newspipe/web/views/home.py
@@ -9,7 +9,7 @@ from flask import flash
from flask import redirect
from flask import render_template
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import get_locale
from flask_babel import gettext
from flask_login import current_user
@@ -21,6 +21,7 @@ from newspipe.controllers import CategoryController
from newspipe.controllers import FeedController
from newspipe.lib import misc_utils
from newspipe.lib.utils import redirect_url
+from newspipe.lib.utils import url_for
from newspipe.web.lib.view_utils import etag_match
from newspipe.web.views.common import jsonify
diff --git a/newspipe/web/views/session_mgmt.py b/newspipe/web/views/session_mgmt.py
index 5da74720..d1a3809d 100644
--- a/newspipe/web/views/session_mgmt.py
+++ b/newspipe/web/views/session_mgmt.py
@@ -7,7 +7,7 @@ from flask import redirect
from flask import render_template
from flask import request
from flask import session
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
@@ -24,6 +24,7 @@ from werkzeug.security import generate_password_hash
from newspipe.bootstrap import application
from newspipe.controllers import UserController
+from newspipe.lib.utils import url_for
from newspipe.notifications import notifications
from newspipe.web.forms import SigninForm
from newspipe.web.forms import SignupForm
diff --git a/newspipe/web/views/user.py b/newspipe/web/views/user.py
index 7bb6e6b1..13be22c6 100644
--- a/newspipe/web/views/user.py
+++ b/newspipe/web/views/user.py
@@ -3,7 +3,7 @@ from flask import flash
from flask import redirect
from flask import render_template
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from flask_login import current_user
from flask_login import login_required
@@ -20,6 +20,7 @@ from newspipe.controllers import UserController
from newspipe.lib import misc_utils
from newspipe.lib.data import import_json
from newspipe.lib.data import import_opml
+from newspipe.lib.utils import url_for
from newspipe.web.forms import ProfileForm
from newspipe.web.lib.user_utils import confirm_token
diff --git a/newspipe/web/views/views.py b/newspipe/web/views/views.py
index 52d4e175..cced7c77 100644
--- a/newspipe/web/views/views.py
+++ b/newspipe/web/views/views.py
@@ -9,7 +9,7 @@ from flask import flash
from flask import redirect
from flask import render_template
from flask import request
-from flask import url_for
+from flask import url_for as f_url_for
from flask_babel import gettext
from sqlalchemy import desc
@@ -17,6 +17,7 @@ from newspipe.bootstrap import application
from newspipe.bootstrap import talisman
from newspipe.controllers import FeedController
from newspipe.controllers import UserController
+from newspipe.lib.utils import url_for
from newspipe.web import __version__, __git_url__
from newspipe.web.lib.view_utils import etag_match
bgstack15