preferences.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. {% if answerers %}<li><a href="#tab_answerers" role="tab" data-toggle="tab">{{ _('Answerers') }}</a></li>{% endif %}
  14. <li><a href="#tab_cookies" role="tab" data-toggle="tab">{{ _('Cookies') }}</a></li>
  15. </ul>
  16. <!-- Tab panes -->
  17. <noscript>
  18. <h3>{{ _('General') }}</h3>
  19. </noscript>
  20. <div class="tab-content">
  21. <div class="tab-pane active" id="tab_general">
  22. <fieldset>
  23. <div class="container-fluid">
  24. <div class="row form-group">
  25. {% if rtl %}
  26. <div class="col-sm-11 col-md-10">
  27. {% include 'oscar/categories.html' %}
  28. </div>
  29. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  30. {% else %}
  31. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  32. <div class="col-sm-11 col-md-10 search-categories">
  33. {% include 'oscar/categories.html' %}
  34. </div>
  35. {% endif %}
  36. </div>
  37. {% set language_label = _('Search language') %}
  38. {% set language_info = _('What language do you prefer for search?') %}
  39. {{ preferences_item_header(language_info, language_label, rtl) }}
  40. {% include 'oscar/languages.html' %}
  41. {{ preferences_item_footer(language_info, language_label, rtl) }}
  42. {% set locale_label = _('Interface language') %}
  43. {% set locale_info = _('Change the language of the layout') %}
  44. {{ preferences_item_header(locale_info, locale_label, rtl) }}
  45. <select class="form-control" name='locale'>
  46. {% for locale_id,locale_name in locales.items() | sort %}
  47. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  48. {% endfor %}
  49. </select>
  50. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  51. {% set autocomplete_label = _('Autocomplete') %}
  52. {% set autocomplete_info = _('Find stuff as you type') %}
  53. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
  54. <select class="form-control" name="autocomplete">
  55. <option value=""> - </option>
  56. {% for backend in autocomplete_backends %}
  57. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  58. {% endfor %}
  59. </select>
  60. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  61. {% set image_proxy_label = _('Image proxy') %}
  62. {% set image_proxy_info = _('Proxying image results through searx') %}
  63. {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
  64. <select class="form-control" name='image_proxy'>
  65. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  66. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
  67. </select>
  68. {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
  69. {% set method_label = _('Method') %}
  70. {% 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>') %}
  71. {{ preferences_item_header(method_info, method_label, rtl) }}
  72. <select class="form-control" name='method'>
  73. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  74. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  75. </select>
  76. {{ preferences_item_footer(method_info, method_label, rtl) }}
  77. {% set safesearch_label = _('SafeSearch') %}
  78. {% set safesearch_info = _('Filter content') %}
  79. {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
  80. <select class="form-control" name='safesearch'>
  81. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  82. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  83. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  84. </select>
  85. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  86. {% set theme_label = _('Themes') %}
  87. {% set theme_info = _('Change searx layout') %}
  88. {{ preferences_item_header(theme_info, theme_label, rtl) }}
  89. <select class="form-control" name="theme">
  90. {% for name in themes %}
  91. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  92. {% endfor %}
  93. </select>
  94. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  95. {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl) }}
  96. <select class="form-control" name='oscar-style'>
  97. <option value="logicodev" >Logicodev</option>
  98. <option value="pointhi" {% if cookies['oscar-style'] == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
  99. </select>
  100. {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }}
  101. {% set label = _('Results on new tabs') %}
  102. {% set info = _('Open result links on new browser tabs') %}
  103. {{ preferences_item_header(info, label, rtl) }}
  104. <select class="form-control" name='results_on_new_tab'>
  105. <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
  106. <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  107. </select>
  108. {{ preferences_item_footer(info, label, rtl) }}
  109. </div>
  110. </fieldset>
  111. </div>
  112. <div class="tab-pane active_if_nojs" id="tab_engine">
  113. <!-- Nav tabs -->
  114. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  115. {% for categ in all_categories %}
  116. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  117. {% endfor %}
  118. </ul>
  119. <noscript>
  120. <h3>{{ _('Engines') }}</h3>
  121. </noscript>
  122. <!-- Tab panes -->
  123. <div class="tab-content">
  124. {% for categ in all_categories %}
  125. <noscript><label>{{ _(categ) }}</label>
  126. </noscript>
  127. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  128. <div class="container-fluid">
  129. <fieldset>
  130. <div class="table-responsive">
  131. <table class="table table-hover table-condensed table-striped">
  132. <tr>
  133. {% if not rtl %}
  134. <th>{{ _("Allow") }}</th>
  135. <th>{{ _("Engine name") }}</th>
  136. <th>{{ _("Shortcut") }}</th>
  137. <th>{{ _("Supports selected language") }}</th>
  138. <th>{{ _("SafeSearch") }}</th>
  139. <th>{{ _("Time range") }}</th>
  140. <th>{{ _("Avg. time") }}</th>
  141. <th>{{ _("Max time") }}</th>
  142. {% else %}
  143. <th>{{ _("Max time") }}</th>
  144. <th>{{ _("Avg. time") }}</th>
  145. <th>{{ _("SafeSearch") }}</th>
  146. <th>{{ _("Supports selected language") }}</th>
  147. <th>{{ _("Shortcut") }}</th>
  148. <th>{{ _("Engine name") }}</th>
  149. <th>{{ _("Allow") }}</th>
  150. {% endif %}
  151. </tr>
  152. {% for search_engine in engines_by_category[categ] %}
  153. {% if not search_engine.private %}
  154. <tr>
  155. {% if not rtl %}
  156. <td class="onoff-checkbox">
  157. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
  158. </td>
  159. <th>{{ search_engine.name }}</th>
  160. <td class="name">{{ shortcuts[search_engine.name] }}</td>
  161. <td><input type="checkbox" {{ "checked" if current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages else ""}} readonly="readonly" disabled="disabled"></td>
  162. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  163. <td><input type="checkbox" {{ "checked" if search_engine.time_range_support==True else ""}} readonly="readonly" disabled="disabled"></td>
  164. <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>
  165. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  166. {% else %}
  167. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</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><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  170. <td><input type="checkbox" {{ "checked" if current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages 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. {% if answerers %}
  213. <div class="tab-pane active_if_nojs" id="tab_answerers">
  214. <noscript>
  215. <h3>{{ _('Answerers') }}</h3>
  216. </noscript>
  217. <p class="text-muted" style="margin:20px 0;">
  218. {{ _('This is the list of searx\'s instant answering modules.') }}
  219. </p>
  220. <table class="table table-striped">
  221. <tr>
  222. <th class="text-muted">{{ _('Name') }}</th>
  223. <th class="text-muted">{{ _('Keywords') }}</th>
  224. <th class="text-muted">{{ _('Description') }}</th>
  225. <th class="text-muted">{{ _('Examples') }}</th>
  226. </tr>
  227. {% for answerer in answerers %}
  228. <tr>
  229. <td class="text-muted">{{ answerer.info.name }}</td>
  230. <td class="text-muted">{{ answerer.keywords|join(', ') }}</td>
  231. <td class="text-muted">{{ answerer.info.description }}</td>
  232. <td class="text-muted">{{ answerer.info.examples|join(', ') }}</td>
  233. </tr>
  234. {% endfor %}
  235. </table>
  236. </div>
  237. {% endif %}
  238. <div class="tab-pane active_if_nojs" id="tab_cookies">
  239. <noscript>
  240. <h3>{{ _('Cookies') }}</h3>
  241. </noscript>
  242. <p class="text-muted" style="margin:20px 0;">
  243. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  244. {{ _('With that list, you can assess searx transparency.') }}<br />
  245. </p>
  246. {% if cookies %}
  247. <table class="table table-striped">
  248. <tr>
  249. <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
  250. <th class="text-muted">{{ _('Value') }}</th>
  251. </tr>
  252. {% for cookie in cookies %}
  253. <tr>
  254. <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
  255. <td class="text-muted">{{ cookies[cookie] }}</td>
  256. </tr>
  257. {% endfor %}
  258. </table>
  259. {% else %}
  260. {% include 'oscar/messages/no_cookies.html' %}
  261. {% endif %}
  262. </div>
  263. </div>
  264. <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.') }}
  265. <br />
  266. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  267. </p>
  268. <p style="margin:20px 0;">{{ _('Search URL of the currently saved preferences') }} <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:<br/>
  269. <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?{{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}">
  270. </p>
  271. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  272. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  273. <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
  274. </form>
  275. </div>
  276. {% endblock %}