forked from zaclys/searxng
[fix] use base_url everywhere if it is defined in settings.yml
This commit is contained in:
parent
156980ef63
commit
da8b227044
|
@ -40,7 +40,7 @@ from datetime import datetime, timedelta
|
||||||
from time import time
|
from time import time
|
||||||
from html import escape
|
from html import escape
|
||||||
from io import StringIO
|
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 import highlight
|
||||||
from pygments.lexers import get_lexer_by_name
|
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'])
|
filename_with_theme = "themes/{}/{}".format(theme_name, values['filename'])
|
||||||
if filename_with_theme in static_files:
|
if filename_with_theme in static_files:
|
||||||
values['filename'] = filename_with_theme
|
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):
|
def proxify(url):
|
||||||
|
|
Loading…
Reference in New Issue