preferences.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle %}
  2. {% extends "oscar/base.html" %}
  3. {% block title %}{{ _('preferences') }} - {% endblock %}
  4. {% block site_alert_warning_nojs %}
  5. <noscript>
  6. {% include 'oscar/messages/js_disabled.html' %}
  7. </noscript>
  8. {% endblock %}
  9. {% block content %}
  10. <div>
  11. <h1>{{ _('Preferences') }}</h1>
  12. <form method="post" action="{{ url_for('preferences') }}" id="search_form">
  13. <!-- Nav tabs -->
  14. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  15. <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
  16. <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
  17. <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li>
  18. <li><a href="#tab_cookies" role="tab" data-toggle="tab">{{ _('Cookies') }}</a></li>
  19. </ul>
  20. <!-- Tab panes -->
  21. <noscript>
  22. <h3>{{ _('General') }}</h3>
  23. </noscript>
  24. <div class="tab-content">
  25. <div class="tab-pane active" id="tab_general">
  26. <fieldset>
  27. <div class="container-fluid">
  28. <div class="row form-group">
  29. {% if rtl %}
  30. <div class="col-sm-11 col-md-10">
  31. {% include 'oscar/categories.html' %}
  32. </div>
  33. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  34. {% else %}
  35. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  36. <div class="col-sm-11 col-md-10">
  37. {% include 'oscar/categories.html' %}
  38. </div>
  39. {% endif %}
  40. </div>
  41. {% set language_label = _('Search language') %}
  42. {% set language_info = _('What language do you prefer for search?') %}
  43. {{ preferences_item_header(language_info, language_label, rtl) }}
  44. <select class="form-control" name='language'>
  45. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
  46. {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
  47. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
  48. {% endfor %}
  49. </select>
  50. {{ preferences_item_footer(language_info, language_label, rtl) }}
  51. {% set locale_label = _('Interface language') %}
  52. {% set locale_info = _('Change the language of the layout') %}
  53. {{ preferences_item_header(locale_info, locale_label, rtl) }}
  54. <select class="form-control" name='locale'>
  55. {% for locale_id,locale_name in locales.items() | sort %}
  56. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  57. {% endfor %}
  58. </select>
  59. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  60. {% set autocomplete_label = _('Autocomplete') %}
  61. {% set autocomplete_info = _('Find stuff as you type') %}
  62. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
  63. <select class="form-control" name="autocomplete">
  64. <option value=""> - </option>
  65. {% for backend in autocomplete_backends %}
  66. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  67. {% endfor %}
  68. </select>
  69. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  70. {% set image_proxy_label = _('Image proxy') %}
  71. {% set image_proxy_info = _('Proxying image results through searx') %}
  72. {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
  73. <select class="form-control" name='image_proxy'>
  74. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  75. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
  76. </select>
  77. {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
  78. {% set method_label = _('Method') %}
  79. {% 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>') %}
  80. {{ preferences_item_header(method_info, method_label, rtl) }}
  81. <select class="form-control" name='method'>
  82. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  83. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  84. </select>
  85. {{ preferences_item_footer(method_info, method_label, rtl) }}
  86. {% set safesearch_label = _('SafeSearch') %}
  87. {% set safesearch_info = _('Filter content') %}
  88. {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
  89. <select class="form-control" name='safesearch'>
  90. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  91. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  92. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  93. </select>
  94. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  95. {% set theme_label = _('Themes') %}
  96. {% set theme_info = _('Change searx layout') %}
  97. {{ preferences_item_header(theme_info, theme_label, rtl) }}
  98. <select class="form-control" name="theme">
  99. {% for name in themes %}
  100. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  101. {% endfor %}
  102. </select>
  103. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  104. </div>
  105. </fieldset>
  106. </div>
  107. <div class="tab-pane active_if_nojs" id="tab_engine">
  108. <!-- Nav tabs -->
  109. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  110. {% for categ in all_categories %}
  111. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  112. {% endfor %}
  113. </ul>
  114. <noscript>
  115. <h3>{{ _('Engines') }}</h3>
  116. </noscript>
  117. <!-- Tab panes -->
  118. <div class="tab-content">
  119. {% for categ in all_categories %}
  120. <noscript><label>{{ _(categ) }}</label>
  121. </noscript>
  122. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  123. <div class="container-fluid">
  124. <fieldset>
  125. <div class="table-responsive">
  126. <table class="table table-hover table-condensed table-striped">
  127. <tr>
  128. {% if not rtl %}
  129. <th>{{ _("Allow") }}</th>
  130. <th>{{ _("Engine name") }}</th>
  131. <th>{{ _("Shortcut") }}</th>
  132. <th>{{ _("SafeSearch") }}</th>
  133. <th>{{ _("Avg. time") }}</th>
  134. <th>{{ _("Max time") }}</th>
  135. {% else %}
  136. <th>{{ _("Max time") }}</th>
  137. <th>{{ _("Avg. time") }}</th>
  138. <th>{{ _("SafeSearch") }}</th>
  139. <th>{{ _("Shortcut") }}</th>
  140. <th>{{ _("Engine name") }}</th>
  141. <th>{{ _("Allow") }}</th>
  142. {% endif %}
  143. </tr>
  144. {% for search_engine in engines_by_category[categ] %}
  145. {% if not search_engine.private %}
  146. <tr>
  147. {% if not rtl %}
  148. <td>{{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in blocked_engines) }}</td>
  149. <th>{{ search_engine.name }}</th>
  150. <td>{{ shortcuts[search_engine.name] }}</td>
  151. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  152. <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td>
  153. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  154. {% else %}
  155. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  156. <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td>
  157. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  158. <td>{{ shortcuts[search_engine.name] }}</td>
  159. <th>{{ search_engine.name }}</th>
  160. <td>{{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in blocked_engines) }}</td>
  161. {% endif %}
  162. </tr>
  163. {% endif %}
  164. {% endfor %}
  165. </table>
  166. </div>
  167. </fieldset>
  168. </div>
  169. </div>
  170. {% endfor %}
  171. </div>
  172. </div>
  173. <div class="tab-pane active_if_nojs" id="tab_plugins">
  174. <noscript>
  175. <h3>{{ _('Plugins') }}</h3>
  176. </noscript>
  177. <fieldset>
  178. <div class="container-fluid">
  179. {% for plugin in plugins %}
  180. <div class="panel panel-default">
  181. <div class="panel-heading">
  182. <h3 class="panel-title">{{ plugin.name }}</h3>
  183. </div>
  184. <div class="panel-body">
  185. <div class="col-xs-6 col-sm-4 col-md-6">{{ plugin.description }}</div>
  186. <div class="col-xs-6 col-sm-4 col-md-6">
  187. {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
  188. </div>
  189. </div>
  190. </div>
  191. {% endfor %}
  192. </div>
  193. </fieldset>
  194. </div>
  195. <div class="tab-pane active_if_nojs" id="tab_cookies">
  196. <noscript>
  197. <h3>{{ _('Cookies') }}</h3>
  198. </noscript>
  199. <p class="text-muted" style="margin:20px 0;">
  200. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  201. {{ _('With that list, you can assess searx transparency.') }}<br />
  202. </p>
  203. {% if cookies %}
  204. <table class="table table-striped">
  205. <tr>
  206. <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
  207. <th class="text-muted">{{ _('Value') }}</th>
  208. </tr>
  209. {% for cookie in cookies %}
  210. <tr>
  211. <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
  212. <td class="text-muted">{{ cookies[cookie] }}</td>
  213. </tr>
  214. {% endfor %}
  215. </table>
  216. {% else %}
  217. {% include 'oscar/messages/no_cookies.html' %}
  218. {% endif %}
  219. </div>
  220. </div>
  221. <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.') }}
  222. <br />
  223. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  224. </p>
  225. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  226. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  227. <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
  228. </form>
  229. </div>
  230. {% endblock %}