diff options
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index be7feee82..2e3c2c119 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -38,7 +38,8 @@ from searx.engines import ( categories, engines, get_engines_stats, engine_shortcuts ) from searx.utils import ( - UnicodeWriter, highlight_content, html_to_text, get_themes + UnicodeWriter, highlight_content, html_to_text, get_themes, + get_static_files ) from searx.version import VERSION_STRING from searx.languages import language_codes @@ -55,6 +56,8 @@ static_path, templates_path, themes =\ default_theme = settings['server'].get('default_theme', 'default') +static_files = get_static_files(searx_dir) + app = Flask( __name__, static_folder=static_path, @@ -123,9 +126,11 @@ def get_current_theme_name(override=None): def url_for_theme(endpoint, override_theme=None, **values): - if endpoint == 'static' and values.get('filename', None): + if endpoint == 'static' and values.get('filename'): theme_name = get_current_theme_name(override=override_theme) - values['filename'] = "{}/{}".format(theme_name, values['filename']) + 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) |