Sfoglia il codice sorgente

New Tab in preferences in Oscar to view Cookies

This tab only purpose is to allow to see what searx is storing on the user's computer.

At a later time, we could implement a way to delete those cookies.
Cqoicebordel 10 anni fa
parent
commit
6ee35145ca
1 ha cambiato i file con 159 aggiunte e 133 eliminazioni
  1. 159
    133
      searx/templates/oscar/preferences.html

+ 159
- 133
searx/templates/oscar/preferences.html Vedi File

@@ -12,159 +12,185 @@
12 12
     <h1>{{ _('Preferences') }}</h1>
13 13
     <form method="post" action="{{ url_for('preferences') }}" id="search_form">
14 14
 
15
-    <!-- Nav tabs -->
16
-    <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
17
-      <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
18
-      <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
19
-    </ul>
15
+        <!-- Nav tabs -->
16
+        <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
17
+          <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
18
+          <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
19
+          <li><a href="#tab_cookies" role="tab" data-toggle="tab">{{ _('Cookies') }}</a></li>
20
+        </ul>
20 21
 
21
-    <!-- Tab panes -->
22
-    <noscript>
23
-        <h3>{{ _('General') }}</h3>
24
-    </noscript>
25
-    <div class="tab-content">
26
-        <div class="tab-pane active" id="tab_general">
27
-            <fieldset>
28
-            <div class="container-fluid">
29
-                <div class="row form-group">
30
-                    {% if rtl %}
31
-                    <div class="col-sm-11 col-md-10">
32
-                        {% include 'oscar/categories.html' %}
33
-                    </div>
34
-                    <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
35
-                    {% else %}
36
-                    <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
37
-                    <div class="col-sm-11 col-md-10">
38
-                        {% include 'oscar/categories.html' %}
22
+        <!-- Tab panes -->
23
+        <noscript>
24
+            <h3>{{ _('General') }}</h3>
25
+        </noscript>
26
+        <div class="tab-content">
27
+            <div class="tab-pane active" id="tab_general">
28
+                <fieldset>
29
+                <div class="container-fluid">
30
+                    <div class="row form-group">
31
+                        {% if rtl %}
32
+                        <div class="col-sm-11 col-md-10">
33
+                            {% include 'oscar/categories.html' %}
34
+                        </div>
35
+                        <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
36
+                        {% else %}
37
+                        <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
38
+                        <div class="col-sm-11 col-md-10">
39
+                            {% include 'oscar/categories.html' %}
40
+                        </div>
41
+                        {% endif %}
39 42
                     </div>
40
-                    {% endif %}
41
-                </div>
42
-                {% set language_label = _('Search language') %}
43
-                {% set language_info = _('What language do you prefer for search?') %}
44
-                {{ preferences_item_header(language_info, language_label, rtl) }}
45
-                    <select class="form-control" name='language'>
46
-                        <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
47
-                        {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
48
-                        <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
49
-                        {% endfor %}
50
-                    </select>
51
-                {{ preferences_item_footer(language_info, language_label, rtl) }}
43
+                    {% set language_label = _('Search language') %}
44
+                    {% set language_info = _('What language do you prefer for search?') %}
45
+                    {{ preferences_item_header(language_info, language_label, rtl) }}
46
+                        <select class="form-control" name='language'>
47
+                            <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
48
+                            {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
49
+                            <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
50
+                            {% endfor %}
51
+                        </select>
52
+                    {{ preferences_item_footer(language_info, language_label, rtl) }}
52 53
 
53
-                {% set locale_label = _('Interface language') %}
54
-                {% set locale_info = _('Change the language of the layout') %}
55
-                {{ preferences_item_header(locale_info, locale_label, rtl) }}
56
-                    <select class="form-control" name='locale'>
57
-                        {% for locale_id,locale_name in locales.items() | sort %}
58
-                        <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
59
-                        {% endfor %}
60
-                    </select>
61
-                {{ preferences_item_footer(locale_info, locale_label, rtl) }}
54
+                    {% set locale_label = _('Interface language') %}
55
+                    {% set locale_info = _('Change the language of the layout') %}
56
+                    {{ preferences_item_header(locale_info, locale_label, rtl) }}
57
+                        <select class="form-control" name='locale'>
58
+                            {% for locale_id,locale_name in locales.items() | sort %}
59
+                            <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
60
+                            {% endfor %}
61
+                        </select>
62
+                    {{ preferences_item_footer(locale_info, locale_label, rtl) }}
62 63
 
63
-                {% set autocomplete_label = _('Autocomplete') %}
64
-                {% set autocomplete_info = _('Find stuff as you type') %}
65
-                {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
66
-                    <select class="form-control" name="autocomplete">
67
-                        <option value=""> - </option>
68
-                        {% for backend in autocomplete_backends %}
69
-                        <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
70
-                        {% endfor %}
71
-                    </select>
72
-                {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
64
+                    {% set autocomplete_label = _('Autocomplete') %}
65
+                    {% set autocomplete_info = _('Find stuff as you type') %}
66
+                    {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
67
+                        <select class="form-control" name="autocomplete">
68
+                            <option value=""> - </option>
69
+                            {% for backend in autocomplete_backends %}
70
+                            <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
71
+                            {% endfor %}
72
+                        </select>
73
+                    {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
73 74
 
74
-                {% set image_proxy_label = _('Image proxy') %}
75
-                {% set image_proxy_info = _('Proxying image results through searx') %}
76
-                {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
77
-                    <select class="form-control" name='image_proxy'>
78
-                        <option value="1" {% if image_proxy  %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
79
-                        <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
80
-                    </select>
81
-                {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
75
+                    {% set image_proxy_label = _('Image proxy') %}
76
+                    {% set image_proxy_info = _('Proxying image results through searx') %}
77
+                    {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
78
+                        <select class="form-control" name='image_proxy'>
79
+                            <option value="1" {% if image_proxy  %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
80
+                            <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
81
+                        </select>
82
+                    {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
82 83
 
83
-                {% set method_label = _('Method') %}
84
-                {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %}
85
-                {{ preferences_item_header(method_info, method_label, rtl) }}
86
-                    <select class="form-control" name='method'>
87
-                        <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
88
-                        <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
89
-                    </select>
90
-                {{ preferences_item_footer(method_info, method_label, rtl) }}
84
+                    {% set method_label = _('Method') %}
85
+                    {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %}
86
+                    {{ preferences_item_header(method_info, method_label, rtl) }}
87
+                        <select class="form-control" name='method'>
88
+                            <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
89
+                            <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
90
+                        </select>
91
+                    {{ preferences_item_footer(method_info, method_label, rtl) }}
91 92
 
92
-                {% set safesearch_label = _('SafeSearch') %}
93
-                {% set safesearch_info = _('Filter content') %}
94
-                {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
95
-                    <select class="form-control" name='safesearch'>
96
-                        <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
97
-                        <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
98
-                        <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
99
-                    </select>
100
-                {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
93
+                    {% set safesearch_label = _('SafeSearch') %}
94
+                    {% set safesearch_info = _('Filter content') %}
95
+                    {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
96
+                        <select class="form-control" name='safesearch'>
97
+                            <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
98
+                            <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
99
+                            <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
100
+                        </select>
101
+                    {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
101 102
 
102
-                {% set theme_label = _('Themes') %}
103
-                {% set theme_info = _('Change searx layout') %}
104
-                {{ preferences_item_header(theme_info, theme_label, rtl) }}
105
-                    <select class="form-control" name="theme">
106
-                        {% for name in themes %}
107
-                        <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
108
-                        {% endfor %}
109
-                    </select>
110
-                {{ preferences_item_footer(theme_info, theme_label, rtl) }}
103
+                    {% set theme_label = _('Themes') %}
104
+                    {% set theme_info = _('Change searx layout') %}
105
+                    {{ preferences_item_header(theme_info, theme_label, rtl) }}
106
+                        <select class="form-control" name="theme">
107
+                            {% for name in themes %}
108
+                            <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
109
+                            {% endfor %}
110
+                        </select>
111
+                    {{ preferences_item_footer(theme_info, theme_label, rtl) }}
112
+                </div>
113
+                </fieldset>
111 114
             </div>
112
-            </fieldset>
113
-        </div>
114
-        <div class="tab-pane active_if_nojs" id="tab_engine">
115
+            <div class="tab-pane active_if_nojs" id="tab_engine">
115 116
 
116
-            <!-- Nav tabs -->
117
-            <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
118
-                {% for (categ,search_engines) in categs %}
119
-                <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
120
-                {% endfor %}
121
-            </ul>
122
-
123
-            <noscript>
124
-                <h3>{{ _('Engines') }}</h3>
125
-            </noscript>
117
+                <!-- Nav tabs -->
118
+                <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
119
+                    {% for (categ,search_engines) in categs %}
120
+                    <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
121
+                    {% endfor %}
122
+                </ul>
126 123
 
127
-            <!-- Tab panes -->
128
-            <div class="tab-content">
129
-                {% for (categ,search_engines) in categs %}
130
-                <noscript><label>{{ _(categ) }}</label>
124
+                <noscript>
125
+                    <h3>{{ _('Engines') }}</h3>
131 126
                 </noscript>
132
-                <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
133
-                    <div class="container-fluid">
134
-                    <fieldset>
135
-                    {% for search_engine in search_engines %}
136
-                        {% if not search_engine.private %}
137
-                            <div class="row">
138
-                                {% if not rtl %}
139
-                                <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
140
-                                {% endif %}
141
-                                <div class="col-xs-6 col-sm-4 col-md-4">
142
-                                    <div class="checkbox">
143
-                                    <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />
144
-                                    <label class="btn btn-success label_hide_if_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
145
-                                    <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
127
+
128
+                <!-- Tab panes -->
129
+                <div class="tab-content">
130
+                    {% for (categ,search_engines) in categs %}
131
+                    <noscript><label>{{ _(categ) }}</label>
132
+                    </noscript>
133
+                    <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
134
+                        <div class="container-fluid">
135
+                        <fieldset>
136
+                        {% for search_engine in search_engines %}
137
+                            {% if not search_engine.private %}
138
+                                <div class="row">
139
+                                    {% if not rtl %}
140
+                                    <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
141
+                                    {% endif %}
142
+                                    <div class="col-xs-6 col-sm-4 col-md-4">
143
+                                        <div class="checkbox">
144
+                                        <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />
145
+                                        <label class="btn btn-success label_hide_if_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
146
+                                        <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
147
+                                        </div>
146 148
                                     </div>
149
+                                    {% if rtl %}
150
+                                    <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div>
151
+                                    {% endif %}
147 152
                                 </div>
148
-                                {% if rtl %}
149
-                                <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div>
150
-                                {% endif %}
151
-                            </div>
152
-                        {% endif %}
153
+                            {% endif %}
154
+                        {% endfor %}
155
+                        </fieldset>
156
+                        </div>
157
+                    </div>
158
+                    {% endfor %}
159
+                </div>
160
+            </div>
161
+
162
+            <div class="tab-pane active_if_nojs" id="tab_cookies">
163
+                <noscript>
164
+                    <h3>{{ _('Cookies') }}</h3>
165
+                </noscript>
166
+                <p class="text-muted" style="margin:20px 0;">
167
+                    {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
168
+                    {{ _('With that list, you can assess searx transparency.') }}<br />
169
+                </p>
170
+                <div class="container-fluid">
171
+                    <fieldset>
172
+                        <div class="row">
173
+                            <div class="col-xs-6 col-sm-4 col-md-4 text-muted"><label>{{ _('Cookie name') }}</label></div>
174
+                            <div class="col-xs-6 col-sm-4 col-md-4 text-muted"><label>{{ _('Value') }}</label></div>
175
+                        </div>
176
+
177
+                    {% for cookie in cookies %}
178
+                        <div class="row">
179
+                            <div class="col-xs-6 col-sm-4 col-md-4 text-muted">{{ cookie }}</div>
180
+                            <div class="col-xs-6 col-sm-4 col-md-4 text-muted">{{ cookies[cookie] }}</div>
181
+                        </div>
153 182
                     {% endfor %}
154 183
                     </fieldset>
155
-                    </div>
156 184
                 </div>
157
-                {% endfor %}
158 185
             </div>
159 186
         </div>
160
-    </div>
161
-    <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
162
-    <br />
163
-    {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
164
-    </p>
187
+        <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
188
+        <br />
189
+        {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
190
+        </p>
165 191
 
166
-    <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
167
-	<a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
192
+        <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
193
+        <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
168 194
     </form>
169 195
 </div>
170 196
 {% endblock %}