diff options
author | Adam Tauber <asciimoo@gmail.com> | 2020-10-08 14:19:00 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2020-10-08 14:19:09 +0200 |
commit | da8b227044f45127f705f6ea94a72d368eea73bb (patch) | |
tree | c03e38fd8119644d4a3dbc6a12ef1c5fc6b94fd3 /searx/webapp.py | |
parent | 156980ef638b755c96ea61731d5fa9ee4649ffe8 (diff) | |
download | searxng-da8b227044f45127f705f6ea94a72d368eea73bb.tar.gz searxng-da8b227044f45127f705f6ea94a72d368eea73bb.zip |
[fix] use base_url everywhere if it is defined in settings.yml
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-x | searx/webapp.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 15baf2bdc..5e6a05b19 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -40,7 +40,7 @@ from datetime import datetime, timedelta from time import time from html import escape from io import StringIO -from urllib.parse import urlencode, urlparse, urljoin +from urllib.parse import urlencode, urlparse, urljoin, urlsplit from pygments import highlight from pygments.lexers import get_lexer_by_name @@ -300,7 +300,12 @@ def url_for_theme(endpoint, override_theme=None, **values): filename_with_theme = "themes/{}/{}".format(theme_name, values['filename']) if filename_with_theme in static_files: values['filename'] = filename_with_theme - return url_for(endpoint, **values) + url = url_for(endpoint, **values) + if settings['server']['base_url']: + if url.startswith('/'): + url = url[1:] + url = urljoin(settings['server']['base_url'], url) + return url def proxify(url): |