preferences.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 search-categories">
  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. {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl) }}
  105. <select class="form-control" name='oscar-style'>
  106. <option value="logicodev" >Logicodev</option>
  107. <option value="pointhi" {% if cookies['oscar-style'] == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
  108. </select>
  109. {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }}
  110. {% set label = _('Results on new tabs') %}
  111. {% set info = _('Open result links on new browser tabs') %}
  112. {{ preferences_item_header(info, label, rtl) }}
  113. <select class="form-control" name='results_on_new_tab'>
  114. <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
  115. <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  116. </select>
  117. {{ preferences_item_footer(info, label, rtl) }}
  118. </div>
  119. </fieldset>
  120. </div>
  121. <div class="tab-pane active_if_nojs" id="tab_engine">
  122. <!-- Nav tabs -->
  123. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  124. {% for categ in all_categories %}
  125. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  126. {% endfor %}
  127. </ul>
  128. <noscript>
  129. <h3>{{ _('Engines') }}</h3>
  130. </noscript>
  131. <!-- Tab panes -->
  132. <div class="tab-content">
  133. {% for categ in all_categories %}
  134. <noscript><label>{{ _(categ) }}</label>
  135. </noscript>
  136. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  137. <div class="container-fluid">
  138. <fieldset>
  139. <div class="table-responsive">
  140. <table class="table table-hover table-condensed table-striped">
  141. <tr>
  142. {% if not rtl %}
  143. <th>{{ _("Allow") }}</th>
  144. <th>{{ _("Engine name") }}</th>
  145. <th>{{ _("Shortcut") }}</th>
  146. <th>{{ _("SafeSearch") }}</th>
  147. <th>{{ _("Avg. time") }}</th>
  148. <th>{{ _("Max time") }}</th>
  149. {% else %}
  150. <th>{{ _("Max time") }}</th>
  151. <th>{{ _("Avg. time") }}</th>
  152. <th>{{ _("SafeSearch") }}</th>
  153. <th>{{ _("Shortcut") }}</th>
  154. <th>{{ _("Engine name") }}</th>
  155. <th>{{ _("Allow") }}</th>
  156. {% endif %}
  157. </tr>
  158. {% for search_engine in engines_by_category[categ] %}
  159. {% if not search_engine.private %}
  160. <tr>
  161. {% if not rtl %}
  162. <td class="onoff-checkbox">
  163. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
  164. </td>
  165. <th>{{ search_engine.name }}</th>
  166. <td>{{ shortcuts[search_engine.name] }}</td>
  167. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  168. <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>
  169. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  170. {% else %}
  171. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  172. <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>
  173. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  174. <td>{{ shortcuts[search_engine.name] }}</td>
  175. <th>{{ search_engine.name }}</th>
  176. <td class="onoff-checkbox">
  177. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
  178. </td>
  179. {% endif %}
  180. </tr>
  181. {% endif %}
  182. {% endfor %}
  183. </table>
  184. </div>
  185. </fieldset>
  186. </div>
  187. </div>
  188. {% endfor %}
  189. </div>
  190. </div>
  191. <div class="tab-pane active_if_nojs" id="tab_plugins">
  192. <noscript>
  193. <h3>{{ _('Plugins') }}</h3>
  194. </noscript>
  195. <fieldset>
  196. <div class="container-fluid">
  197. {% for plugin in plugins %}
  198. <div class="panel panel-default">
  199. <div class="panel-heading">
  200. <h3 class="panel-title">{{ _(plugin.name) }}</h3>
  201. </div>
  202. <div class="panel-body">
  203. <div class="col-xs-6 col-sm-4 col-md-6">{{ _(plugin.description) }}</div>
  204. <div class="col-xs-6 col-sm-4 col-md-6">
  205. <div class="onoff-checkbox">
  206. {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. {% endfor %}
  212. </div>
  213. </fieldset>
  214. </div>
  215. <div class="tab-pane active_if_nojs" id="tab_cookies">
  216. <noscript>
  217. <h3>{{ _('Cookies') }}</h3>
  218. </noscript>
  219. <p class="text-muted" style="margin:20px 0;">
  220. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  221. {{ _('With that list, you can assess searx transparency.') }}<br />
  222. </p>
  223. {% if cookies %}
  224. <table class="table table-striped">
  225. <tr>
  226. <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
  227. <th class="text-muted">{{ _('Value') }}</th>
  228. </tr>
  229. {% for cookie in cookies %}
  230. <tr>
  231. <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
  232. <td class="text-muted">{{ cookies[cookie] }}</td>
  233. </tr>
  234. {% endfor %}
  235. </table>
  236. {% else %}
  237. {% include 'oscar/messages/no_cookies.html' %}
  238. {% endif %}
  239. </div>
  240. </div>
  241. <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.') }}
  242. <br />
  243. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  244. </p>
  245. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  246. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  247. <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
  248. </form>
  249. </div>
  250. {% endblock %}