preferences.html 26 KB

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