preferences.html 16 KB

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