Browse Source

[fix] proper src/href url handling

Adam Tauber 11 years ago
parent
commit
a4f89a7981

+ 3
- 3
searx/templates/about.html View File

2
 {% block content %}
2
 {% block content %}
3
 {% include 'github_ribbon.html' %}
3
 {% include 'github_ribbon.html' %}
4
 <div class="row">
4
 <div class="row">
5
-    <h1>About <a href="/">searx</a></h1>
5
+    <h1>About <a href="{{ url_for('index') }}">searx</a></h1>
6
 
6
 
7
-    <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="/preferences">search engines</a> while not storing information about its users.
7
+    <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users.
8
     </p>
8
     </p>
9
     <h2>Why use Searx?</h2>
9
     <h2>Why use Searx?</h2>
10
     <ul>
10
     <ul>
60
 <p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
60
 <p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
61
 
61
 
62
 <h3>How to debug engines?</h3>
62
 <h3>How to debug engines?</h3>
63
-<p><a href="/stats">Stats page</a> contains some useful data about the engines used.</p>
63
+<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p>
64
 
64
 
65
 </div>
65
 </div>
66
 {% endblock %}
66
 {% endblock %}

+ 3
- 3
searx/templates/base.html View File

6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
7
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8
     <title>{% block title %}{% endblock %}searx</title>
8
     <title>{% block title %}{% endblock %}searx</title>
9
-    <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" />
9
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
10
     <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
10
     <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
11
     {% block styles %}
11
     {% block styles %}
12
     {% endblock %}
12
     {% endblock %}
13
     {% block head %}
13
     {% block head %}
14
-    <link title="searx" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml"/>
14
+    <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
15
     {% endblock %}
15
     {% endblock %}
16
 </head>
16
 </head>
17
 <body>
17
 <body>
18
 <div id="container">
18
 <div id="container">
19
 {% block content %}
19
 {% block content %}
20
 {% endblock %}
20
 {% endblock %}
21
-<script src="/static/js/searx.js" ></script>
21
+<script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
22
 </div>
22
 </div>
23
 </body>
23
 </body>
24
 </html>
24
 </html>

+ 1
- 1
searx/templates/github_ribbon.html View File

1
 <a href="https://github.com/asciimoo/searx" class="github">
1
 <a href="https://github.com/asciimoo/searx" class="github">
2
-    <img style="position: absolute; top: 0; right: 0; border: 0;" src="/static/img/github_ribbon.png" alt="Fork me on GitHub"  class="github"/>
2
+    <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub"  class="github"/>
3
 </a>
3
 </a>

+ 2
- 2
searx/templates/index.html View File

4
     <div class="title"><h1>searx</h1></div>
4
     <div class="title"><h1>searx</h1></div>
5
     {% include 'search.html' %}
5
     {% include 'search.html' %}
6
     <p class="top_margin">
6
     <p class="top_margin">
7
-        <a href="/about" class="hmarg">{{ _('about') }}</a>
8
-        <a href="/preferences" class="hmarg">{{ _('preferences') }}</a>
7
+        <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a>
8
+        <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
9
     </p>
9
     </p>
10
 </div>
10
 </div>
11
 {% endblock %}
11
 {% endblock %}

+ 2
- 2
searx/templates/preferences.html View File

4
 <div class="row">
4
 <div class="row">
5
     <h2>{{ _('Preferences') }}</h2>
5
     <h2>{{ _('Preferences') }}</h2>
6
 
6
 
7
-    <form method="post" action="/preferences" id="search_form">
7
+    <form method="post" action="{{ url_for('preferences') }}" id="search_form">
8
     <fieldset>
8
     <fieldset>
9
         <legend>{{ _('Default categories') }}</legend>
9
         <legend>{{ _('Default categories') }}</legend>
10
         <p>
10
         <p>
66
 
66
 
67
     <input type="submit" value="{{ _('save') }}" />
67
     <input type="submit" value="{{ _('save') }}" />
68
     </form>
68
     </form>
69
-    <div class="right"><a href="/">{{ _('back') }}</a></div>
69
+    <div class="right"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
70
 </div>
70
 </div>
71
 {% endblock %}
71
 {% endblock %}

+ 6
- 6
searx/templates/results.html View File

1
 {% extends "base.html" %}
1
 {% extends "base.html" %}
2
 {% block title %}{{ q }} - {% endblock %}
2
 {% block title %}{{ q }} - {% endblock %}
3
 {% block content %}
3
 {% block content %}
4
-<div class="right"><a href="/preferences" id="preferences"><span>preferences</span></a></div>
4
+<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
5
 <div class="small search">
5
 <div class="small search">
6
     {% include 'search.html' %}
6
     {% include 'search.html' %}
7
 </div>
7
 </div>
10
         {% if suggestions %}
10
         {% if suggestions %}
11
         <div id="suggestions"><span>{{ _('Suggestions') }}</span>
11
         <div id="suggestions"><span>{{ _('Suggestions') }}</span>
12
             {% for suggestion in suggestions %}
12
             {% for suggestion in suggestions %}
13
-            <form method="post" action="/">
14
-                <input type="hidden" name="q" value="{{suggestion}}">
13
+            <form method="post" action="{{ url_for('index') }}">
14
+                <input type="hidden" name="q" value="{{ suggestion }}">
15
                 <input type="submit" value="{{ suggestion }}" />
15
                 <input type="submit" value="{{ suggestion }}" />
16
             </form>
16
             </form>
17
             {% endfor %}
17
             {% endfor %}
25
         <div id="apis">
25
         <div id="apis">
26
         {{ _('Download results') }}
26
         {{ _('Download results') }}
27
         {% for output_type in ('csv', 'json', 'rss') %}
27
         {% for output_type in ('csv', 'json', 'rss') %}
28
-        <form method="post" action="/">
28
+        <form method="post" action="{{ url_for('index') }}">
29
             <div class="left">
29
             <div class="left">
30
             <input type="hidden" name="q" value="{{ q }}" />
30
             <input type="hidden" name="q" value="{{ q }}" />
31
             <input type="hidden" name="format" value="{{ output_type }}" />
31
             <input type="hidden" name="format" value="{{ output_type }}" />
52
     {% if paging %}
52
     {% if paging %}
53
     <div id="pagination">
53
     <div id="pagination">
54
         {% if pageno > 1 %}
54
         {% if pageno > 1 %}
55
-            <form method="post" action="/">
55
+            <form method="post" action="{{ url_for('index') }}">
56
                 <div class="left">
56
                 <div class="left">
57
                 <input type="hidden" name="q" value="{{ q }}" />
57
                 <input type="hidden" name="q" value="{{ q }}" />
58
                 {% for category in selected_categories %}
58
                 {% for category in selected_categories %}
63
                 </div>
63
                 </div>
64
             </form>
64
             </form>
65
         {% endif %}
65
         {% endif %}
66
-        <form method="post" action="/">
66
+        <form method="post" action="{{ url_for('index') }}">
67
             <div class="left">
67
             <div class="left">
68
             {% for category in selected_categories %}
68
             {% for category in selected_categories %}
69
             <input type="hidden" name="category_{{ category }}" value="1"/>
69
             <input type="hidden" name="category_{{ category }}" value="1"/>

+ 1
- 1
searx/templates/search.html View File

1
-<form method="post" action="/" id="search_form">
1
+<form method="post" action="{{ url_for('index') }}" id="search_form">
2
   <div id="search_wrapper">
2
   <div id="search_wrapper">
3
     <input type="text" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
3
     <input type="text" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
4
     <input type="submit" value="search" id="search_submit" />
4
     <input type="submit" value="search" id="search_submit" />