preferences.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle, custom_select_class %}
  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">
  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. {% if 'categories' not in locked_preferences %}
  25. <div class="row form-group">
  26. {% if rtl %}
  27. <div class="col-sm-11 col-md-10">
  28. {% include 'oscar/categories.html' %}
  29. </div>
  30. <label class="col-sm-3 col-md-2" for="categories">{{ _('Default categories') }}</label>
  31. {% else %}
  32. <label class="col-sm-3 col-md-2" for="categories">{{ _('Default categories') }}</label>
  33. <div class="col-sm-11 col-md-10 search-categories">
  34. {% include 'oscar/categories.html' %}
  35. </div>
  36. {% endif %}
  37. </div>
  38. {% endif %}
  39. {% if 'language' not in locked_preferences %}
  40. {% set language_label = _('Search language') %}
  41. {% set language_info = _('What language do you prefer for search?') %}
  42. {{ preferences_item_header(language_info, language_label, rtl, 'language') }}
  43. {% include 'oscar/languages.html' %}
  44. {{ preferences_item_footer(language_info, language_label, rtl) }}
  45. {% endif %}
  46. {% if 'locale' not in locked_preferences %}
  47. {% set locale_label = _('Interface language') %}
  48. {% set locale_info = _('Change the language of the layout') %}
  49. {{ preferences_item_header(locale_info, locale_label, rtl, 'locale') }}
  50. <select class="form-control {{ custom_select_class(rtl)}}" name="locale" id="locale">
  51. {% for locale_id,locale_name in locales.items() | sort %}
  52. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  53. {% endfor %}
  54. </select>
  55. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  56. {% endif %}
  57. {% if 'autocomplete' not in locked_preferences %}
  58. {% set autocomplete_label = _('Autocomplete') %}
  59. {% set autocomplete_info = _('Find stuff as you type') %}
  60. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl, 'autocomplete') }}
  61. <select class="form-control {{ custom_select_class(rtl) }}" name="autocomplete" id="autocomplete">
  62. <option value=""> - </option>
  63. {% for backend in autocomplete_backends %}
  64. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  65. {% endfor %}
  66. </select>
  67. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  68. {% endif %}
  69. {% if 'image_proxy' not in locked_preferences %}
  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, 'image_proxy') }}
  73. <select class="form-control {{ custom_select_class(rtl) }}" name="image_proxy" id="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. {% endif %}
  79. {% if 'method' not in locked_preferences %}
  80. {% set method_label = _('Method') %}
  81. {% 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>') %}
  82. {{ preferences_item_header(method_info, method_label, rtl, 'method') }}
  83. <select class="form-control {{ custom_select_class(rtl) }}" name="method" id="method">
  84. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  85. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  86. </select>
  87. {{ preferences_item_footer(method_info, method_label, rtl) }}
  88. {% endif %}
  89. {% if 'safesearch' not in locked_preferences %}
  90. {% set safesearch_label = _('SafeSearch') %}
  91. {% set safesearch_info = _('Filter content') %}
  92. {{ preferences_item_header(safesearch_info, safesearch_label, rtl, 'safesearch') }}
  93. <select class="form-control {{ custom_select_class(rtl) }}" name="safesearch" id="safesearch">
  94. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  95. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  96. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  97. </select>
  98. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  99. {% endif %}
  100. {% if 'theme' not in locked_preferences %}
  101. {% set theme_label = _('Themes') %}
  102. {% set theme_info = _('Change searx layout') %}
  103. {{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }}
  104. <select class="form-control {{ custom_select_class(rtl) }}" name="theme" id="theme">
  105. {% for name in themes %}
  106. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  107. {% endfor %}
  108. </select>
  109. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  110. {% endif %}
  111. {% if 'oscar-style' not in locked_preferences %}
  112. {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl, 'oscar_style') }}
  113. <select class="form-control {{ custom_select_class(rtl) }}" name="oscar-style" id="oscar_style">
  114. <option value="logicodev" >Logicodev</option>
  115. <option value="pointhi" {% if preferences.get_value('oscar-style') == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
  116. <option value="logicodev-dark" {% if preferences.get_value('oscar-style') == 'logicodev-dark' %}selected="selected"{% endif %}>Logicodev dark</option>
  117. </select>
  118. {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }}
  119. {% endif %}
  120. {% if 'results_on_new_tab' not in locked_preferences %}
  121. {% set label = _('Results on new tabs') %}
  122. {% set info = _('Open result links on new browser tabs') %}
  123. {{ preferences_item_header(info, label, rtl, 'results_on_new_tab') }}
  124. <select class="form-control {{ custom_select_class(rtl) }}" name="results_on_new_tab" id="results_on_new_tab">
  125. <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
  126. <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  127. </select>
  128. {{ preferences_item_footer(info, label, rtl) }}
  129. {% endif %}
  130. {% set label = _('Show advanced settings') %}
  131. {% set info = _('Show advanced settings panel in the home page by default') %}
  132. {{ preferences_item_header(info, label, rtl, 'advanced_search') }}
  133. <select class="form-control {{ custom_select_class(rtl) }}" name="advanced_search" id="advanced_search">
  134. <option value="1" {% if preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('On') }}</option>
  135. <option value="0" {% if not preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('Off')}}</option>
  136. </select>
  137. {{ preferences_item_footer(info, label, rtl) }}
  138. {% if 'doi_resolver' not in locked_preferences %}
  139. {% set label = _('Open Access DOI resolver') %}
  140. {% set info = _('Redirect to open-access versions of publications when available (plugin required)') %}
  141. {{ preferences_item_header(info, label, rtl, 'doi_resolver') }}
  142. <select class="form-control {{ custom_select_class(rtl) }}" name="doi_resolver" id="doi_resolver">
  143. {% for doi_resolver_name,doi_resolver_url in doi_resolvers.items() %}
  144. <option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}>
  145. {{ doi_resolver_name }} - {{ doi_resolver_url }}
  146. </option>
  147. {% endfor %}
  148. </select>
  149. {{ preferences_item_footer(info, label, rtl) }}
  150. {% endif %}
  151. {% set label = _('Engine tokens') %}
  152. {% set info = _('Access tokens for private engines') %}
  153. {{ preferences_item_header(info, label, rtl, 'tokens') }}
  154. <input class="form-control" id="tokens" name="tokens" value='{{ preferences.tokens.get_value() }}'/>
  155. {{ preferences_item_footer(info, label, rtl) }}
  156. </div>
  157. </fieldset>
  158. </div>
  159. <div class="tab-pane active_if_nojs" id="tab_engine">
  160. <!-- Nav tabs -->
  161. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist">
  162. {% for categ in all_categories %}
  163. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  164. {% endfor %}
  165. </ul>
  166. <noscript>
  167. <h3>{{ _('Engines') }}</h3>
  168. </noscript>
  169. <!-- Tab panes -->
  170. <div class="tab-content">
  171. <div class="hide_if_nojs">
  172. <p class="text-{% if rtl %}left{% else %}right{% endif %}">
  173. <button type="button" class="btn btn-default btn-success" id="allow-all-engines">{{ _("Allow all") }}</button>
  174. <button type="button" class="btn btn-default btn-danger" id="disable-all-engines">{{ _("Disable all") }}</button>
  175. </p>
  176. </div>
  177. {% for categ in all_categories %}
  178. <noscript><label>{{ _(categ) }}</label>
  179. </noscript>
  180. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  181. <div class="container-fluid">
  182. <fieldset>
  183. <div class="table-responsive">
  184. <table class="table table-hover table-condensed table-striped">
  185. <tr>
  186. {% if not rtl %}
  187. <th scope="col">{{ _("Allow") }}</th>
  188. <th scope="col">{{ _("Engine name") }}</th>
  189. <th scope="col">{{ _("Shortcut") }}</th>
  190. <th scope="col">{{ _("Selected language") }}</th>
  191. <th scope="col">{{ _("SafeSearch") }}</th>
  192. <th scope="col">{{ _("Time range") }}</th>
  193. <th scope="col">{{ _("Avg. time") }}</th>
  194. <th scope="col">{{ _("Max time") }}</th>
  195. {% else %}
  196. <th scope="col" class="text-right">{{ _("Max time") }}</th>
  197. <th scope="col" class="text-right">{{ _("Avg. time") }}</th>
  198. <th scope="col" class="text-right">{{ _("Time range") }}</th>
  199. <th scope="col" class="text-right">{{ _("SafeSearch") }}</th>
  200. <th scope="col" class="text-right">{{ _("Selected language") }}</th>
  201. <th scope="col" class="text-right">{{ _("Shortcut") }}</th>
  202. <th scope="col" class="text-right">{{ _("Engine name") }}</th>
  203. <th scope="col" class="text-right">{{ _("Allow") }}</th>
  204. {% endif %}
  205. </tr>
  206. {% for search_engine in engines_by_category[categ] %}
  207. {% if not search_engine.private %}
  208. <tr>
  209. {% if not rtl %}
  210. <td class="onoff-checkbox">
  211. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
  212. </td>
  213. <th scope="row">{% if not search_engine.https_support %}{{ icon('exclamation-sign', 'No HTTPS') }}{% endif %} {{ search_engine.name }}</td></th>
  214. <td class="name">{{ shortcuts[search_engine.name] }}
  215. <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td>
  216. <td>{{ support_toggle(search_engine.safesearch==True) }}</td>
  217. <td>{{ support_toggle(search_engine.time_range_support==True) }}</td>
  218. <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{% if stats[search_engine.name]['warn_time'] %}{{ icon('exclamation-sign')}} {% endif %}{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td>
  219. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{% if stats[search_engine.name]['warn_timeout'] %}{{ icon('exclamation-sign') }} {% endif %}{{ search_engine.timeout }}</td>
  220. {% else %}
  221. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}{% if stats[search_engine.name]['warn_time'] %} {{ icon('exclamation-sign')}}{% endif %}</td>
  222. <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 }}{% if stats[search_engine.name]['warn_time'] %} {{ icon('exclamation-sign')}}{% endif %}</td>
  223. <td>{{ support_toggle(search_engine.time_range_support==True) }}</td>
  224. <td>{{ support_toggle(search_engine.safesearch==True) }}</td>
  225. <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td>
  226. <td>{{ shortcuts[search_engine.name] }}</td>
  227. <th scope="row">{{ search_engine.name }}</th>
  228. <td class="onoff-checkbox">
  229. {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
  230. </td>
  231. {% endif %}
  232. </tr>
  233. {% endif %}
  234. {% endfor %}
  235. </table>
  236. </div>
  237. </fieldset>
  238. </div>
  239. </div>
  240. {% endfor %}
  241. </div>
  242. </div>
  243. <div class="tab-pane active_if_nojs" id="tab_plugins">
  244. <noscript>
  245. <h3>{{ _('Plugins') }}</h3>
  246. </noscript>
  247. <fieldset>
  248. <div class="container-fluid">
  249. {% for plugin in plugins %}
  250. {% if plugin.preference_section != 'onions' %}
  251. <div class="panel panel-default">
  252. <div class="panel-heading">
  253. <h3 class="panel-title">{{ _(plugin.name) }}</h3>
  254. </div>
  255. <div class="panel-body">
  256. <div class="col-xs-6 col-sm-4 col-md-6"><label for="{{'plugin_' + plugin.id}}">{{ _(plugin.description) }}</label></div>
  257. <div class="col-xs-6 col-sm-4 col-md-6">
  258. <div class="onoff-checkbox">
  259. {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. {% endif %}
  265. {% endfor %}
  266. </div>
  267. </fieldset>
  268. </div>
  269. {% if answerers %}
  270. <div class="tab-pane active_if_nojs" id="tab_answerers">
  271. <noscript>
  272. <h3>{{ _('Answerers') }}</h3>
  273. </noscript>
  274. <p class="text-muted">
  275. {{ _('This is the list of searx\'s instant answering modules.') }}
  276. </p>
  277. <table class="table table-striped">
  278. <tr>
  279. <th{% if rtl %} class="text-right"{% endif %}>{{ _('Name') }}</th>
  280. <th{% if rtl %} class="text-right"{% endif %}>{{ _('Keywords') }}</th>
  281. <th{% if rtl %} class="text-right"{% endif %}>{{ _('Description') }}</th>
  282. <th{% if rtl %} class="text-right"{% endif %}>{{ _('Examples') }}</th>
  283. </tr>
  284. {% for answerer in answerers %}
  285. <tr>
  286. <td>{{ answerer.info.name }}</td>
  287. <td>{{ answerer.keywords|join(', ') }}</td>
  288. <td>{{ answerer.info.description }}</td>
  289. <td>{{ answerer.info.examples|join(', ') }}</td>
  290. </tr>
  291. {% endfor %}
  292. </table>
  293. </div>
  294. {% endif %}
  295. <div class="tab-pane active_if_nojs" id="tab_cookies">
  296. <noscript>
  297. <h3>{{ _('Cookies') }}</h3>
  298. </noscript>
  299. <p class="text-muted">
  300. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  301. {{ _('With that list, you can assess searx transparency.') }}<br />
  302. </p>
  303. {% if cookies %}
  304. <table class="table table-striped">
  305. <tr>
  306. <th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Cookie name') }}</th>
  307. <th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Value') }}</th>
  308. </tr>
  309. {% for cookie in cookies %}
  310. <tr>
  311. <td class="text-muted">{{ cookie }}</td>
  312. <td class="text-muted">{{ cookies[cookie] }}</td>
  313. </tr>
  314. {% endfor %}
  315. </table>
  316. {% else %}
  317. {% include 'oscar/messages/no_cookies.html' %}
  318. {% endif %}
  319. </div>
  320. </div>
  321. <p class="text-muted">
  322. {{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
  323. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  324. </p>
  325. <p>
  326. {{ _('Search URL of the currently saved preferences') }}
  327. <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:
  328. </p>
  329. <div class="tab-pane">
  330. <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ base_url }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}">
  331. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  332. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  333. <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
  334. </div>
  335. </form>
  336. </div>
  337. {% endblock %}