Selaa lähdekoodia

[fix] static content paths

Adam Tauber 10 vuotta sitten
vanhempi
commit
798bef77f9

+ 1
- 1
searx/templates/courgette/result_templates/default.html Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 <div class="result {{ result.class }}">
2 2
 
3 3
   {% if "icon_"~result.engine~".ico" in favicons %}
4
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icons/icon_{{result.engine}}.ico" alt="{{result.engine}}" />
4
+    <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
5 5
   {% endif %}
6 6
 
7 7
   <div>

+ 1
- 1
searx/templates/default/result_templates/default.html Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 <div class="result {{ result.class }}">
2
-    <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icons/icon_{{result.engine}}.ico" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
2
+    <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3 3
     <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
4 4
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
5 5
     <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>

+ 1
- 1
searx/templates/oscar/result_templates/default.html Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
4 4
 
5 5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6 6
 <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>

+ 1
- 1
searx/tests/test_webapp.py Näytä tiedosto

@@ -49,7 +49,7 @@ class ViewsTestCase(SearxTestCase):
49 49
         )
50 50
         result = self.app.post('/', data={'q': 'test'})
51 51
         self.assertIn(
52
-            '<h3 class="result_title"><img width="14" height="14" class="favicon" src="static/themes/default/img/icons/icon_youtube.ico" alt="youtube" /><a href="http://second.test.xyz">Second <span class="highlight">Test</span></a></h3>',  # noqa
52
+            '<h3 class="result_title"><img width="14" height="14" class="favicon" src="/static/themes/default/img/icons/icon_youtube.ico" alt="youtube" /><a href="http://second.test.xyz">Second <span class="highlight">Test</span></a></h3>',  # noqa
53 53
             result.data
54 54
         )
55 55
         self.assertIn(

+ 2
- 2
searx/webapp.py Näytä tiedosto

@@ -73,7 +73,7 @@ babel = Babel(app)
73 73
 global_favicons = []
74 74
 for indice, theme in enumerate(themes):
75 75
     global_favicons.append([])
76
-    theme_img_path = searx_dir+"/static/"+theme+"/img/icons/"
76
+    theme_img_path = searx_dir+"/static/themes/"+theme+"/img/icons/"
77 77
     for (dirpath, dirnames, filenames) in os.walk(theme_img_path):
78 78
         global_favicons[indice].extend(filenames)
79 79
 
@@ -506,7 +506,7 @@ def opensearch():
506 506
 @app.route('/favicon.ico')
507 507
 def favicon():
508 508
     return send_from_directory(os.path.join(app.root_path,
509
-                                            'static',
509
+                                            'static/themes',
510 510
                                             get_current_theme_name(),
511 511
                                             'img'),
512 512
                                'favicon.png',