preferences.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. {% from 'simple/macros.html' import icon, tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %}
  2. {% extends "simple/base.html" %}
  3. {%- macro plugin_preferences(section) -%}
  4. {%- for plugin in plugins -%}
  5. {%- if plugin.preference_section == section -%}
  6. <fieldset>{{- '' -}}
  7. <legend>{{ _(plugin.name) }}</legend>{{- '' -}}
  8. <div class="value">
  9. {{- checkbox_onoff('plugin_' + plugin.id, plugin.id not in allowed_plugins) -}}
  10. </div>{{- '' -}}
  11. <div class="description">
  12. {{- _(plugin.description) -}}
  13. </div>{{- '' -}}
  14. </fieldset>
  15. {%- endif -%}
  16. {%- endfor -%}
  17. {%- endmacro -%}
  18. {% macro engine_about(search_engine) -%}
  19. {% if search_engine.about is defined %}
  20. {% set about = search_engine.about %}
  21. <div class="engine-tooltip" role="tooltip">{{- "" -}}
  22. <p><a href="{{about.website}}" rel="noreferrer">{{about.website}}</a></p>
  23. {%- 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 -%}
  24. {%- if search_engine.enable_http %}<p>{{ icon('exclamation-sign', 'No HTTPS') }}{{ _('No HTTPS')}}</p>{% endif -%}
  25. </div>
  26. {%- endif -%}
  27. {%- endmacro %}
  28. {% block head %} {% endblock %}
  29. {% block content %}
  30. <a href="{{ url_for('index') }}"><h1><span>searx</span></h1></a>
  31. <h2>{{ _('Preferences') }}</h2>
  32. <form id="search_form" method="post" action="{{ url_for('preferences') }}">
  33. {{ tabs_open() }}
  34. {{ tab_header('maintab', 'general', _('General')) }}
  35. {% if 'categories' not in locked_preferences %}
  36. <fieldset>
  37. <legend>{{ _('Default categories') }}</legend>
  38. {% set display_tooltip = false %}
  39. {% include 'simple/categories.html' %}
  40. </fieldset>
  41. {% endif %}
  42. {% if 'language' not in locked_preferences %}
  43. <fieldset>
  44. <legend>{{ _('Search language') }}</legend>
  45. <p class="value">{{- '' -}}
  46. <select name='language'>{{- '' -}}
  47. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
  48. {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%}
  49. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
  50. {%- endfor -%}
  51. </select>{{- '' -}}
  52. </p>
  53. <div class="description">{{ _('What language do you prefer for search?') }}</div>
  54. </fieldset>
  55. {% endif %}
  56. {% if 'autocomplete' not in locked_preferences %}
  57. <fieldset>
  58. <legend>{{ _('Autocomplete') }}</legend>
  59. <p class="value">
  60. <select name="autocomplete">
  61. <option value=""> - </option>
  62. {%- for backend in autocomplete_backends -%}
  63. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  64. {%- endfor -%}
  65. </select>
  66. </p>
  67. <div class="description">{{ _('Find stuff as you type') }}</div>
  68. </fieldset>
  69. {% endif %}
  70. {% if 'safesearch' not in locked_preferences %}
  71. <fieldset>
  72. <legend>{{ _('SafeSearch') }}</legend>
  73. <p class="value">
  74. <select name='safesearch'>
  75. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  76. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  77. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  78. </select>
  79. </p>
  80. <p class="description">{{ _('Filter content') }}</p>
  81. </fieldset>
  82. {% endif %}
  83. {{ plugin_preferences('general') }}
  84. {% if 'doi_resolver' not in locked_preferences %}
  85. <fieldset>
  86. <legend>{{ _('Open Access DOI resolver') }}</legend>
  87. <p class="value">
  88. <select id='doi_resolver' name='doi_resolver'>
  89. {%- for doi_resolver_name,doi_resolver_url in doi_resolvers.items() -%}
  90. <option value="{{ doi_resolver_name }}" {% if doi_resolver_url == current_doi_resolver %}selected="selected"{% endif %}>
  91. {{- doi_resolver_name }} - {{ doi_resolver_url -}}
  92. </option>
  93. {%- endfor -%}
  94. </select>
  95. </p>
  96. <div class="description"><!-- {{ _('Redirect to open-access versions of publications when available (plugin required)') }} --></div>
  97. </fieldset>
  98. {% endif %}
  99. {{ tab_footer() }}
  100. {{ tab_header('maintab', 'engines', _('Engines')) }}
  101. <p>{{ _('Currently used search engines') }}</p>
  102. {{ tabs_open() }}
  103. {% for categ in all_categories %}
  104. {{ tab_header('enginetab', 'category' + categ, _(categ)) }}
  105. <div class="scrollx">
  106. <table class="striped">
  107. <tr>
  108. <th class="engine_checkbox">{{ _("Allow") }}</th>
  109. <th class="name">{{ _("Engine name") }}</th>
  110. <th class="shortcut">{{ _("Shortcut") }}</th>
  111. <th>{{ _("Supports selected language") }}</th>
  112. <th>{{ _("SafeSearch") }}</th>
  113. <th>{{ _("Time range") }}</th>
  114. <th>{{ _("Avg. time") }}</th>
  115. <th>{{ _("Max time") }}</th>
  116. </tr>
  117. {% for search_engine in engines_by_category[categ] %}
  118. {% if not search_engine.private %}
  119. {% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
  120. <tr>
  121. <td class="engine_checkbox">{{ checkbox_onoff(engine_id, (search_engine.name, categ) in disabled_engines) }}</td>
  122. <th class="name">{% if search_engine.enable_http %}{{ icon('warning', 'No HTTPS') }}{% endif %} {{ search_engine.name }} {{ engine_about(search_engine) }}</th>
  123. <td class="shortcut">{{ shortcuts[search_engine.name] }}</td>
  124. <td>{{ checkbox(engine_id + '_supported_languages', current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages, true, true) }}</td>
  125. <td>{{ checkbox(engine_id + '_safesearch', search_engine.safesearch==True, true, true) }}</td>
  126. <td>{{ checkbox(engine_id + '_time_range_support', search_engine.time_range_support==True, true, true) }}</td>
  127. <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>
  128. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  129. </tr>
  130. {% endif %}
  131. {% endfor %}
  132. </table>
  133. </div>
  134. {{ tab_footer() }}
  135. {% endfor %}
  136. {{ tabs_close() }}
  137. {{ tab_footer() }}
  138. {{ tab_header('maintab', 'ui', _('User interface')) }}
  139. {% if 'locale' not in locked_preferences %}
  140. <fieldset>
  141. <legend>{{ _('Interface language') }}</legend>
  142. <p class="value">
  143. <select name='locale'>
  144. {% for locale_id,locale_name in locales.items() | sort %}
  145. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  146. {% endfor %}
  147. </select>
  148. </p>
  149. <div class="description">{{ _('Change the language of the layout') }}</div>
  150. </fieldset>
  151. {% endif %}
  152. {% if 'theme' not in locked_preferences %}
  153. <fieldset>
  154. <legend>{{ _('Themes') }}</legend>
  155. <p class="value">
  156. <select name="theme">
  157. {%- for name in themes -%}
  158. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  159. {%- endfor -%}
  160. </select>
  161. </p>
  162. <div class="description">{{ _('Change searx layout') }}</div>
  163. </fieldset>
  164. {% endif %}
  165. {% if 'results_on_new_tab' not in locked_preferences %}
  166. <fieldset>
  167. <legend>{{ _('Results on new tabs') }}</legend>
  168. <p class="value">
  169. <select name='results_on_new_tab'>
  170. <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
  171. <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  172. </select>
  173. </p>
  174. <div class="description">{{_('Open result links on new browser tabs') }}</div>
  175. </fieldset>
  176. {% endif %}
  177. {% if 'autofocus' not in locked_preferences %}
  178. <fieldset>
  179. <legend>{{ _('Autofocus search field') }}</legend>
  180. <p class="value">
  181. <select name='autofocus'>
  182. <option value="1" {% if autofocus %}selected="selected"{% endif %}>{{ _('On') }}</option>
  183. <option value="0" {% if not autofocus %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  184. </select>
  185. </p>
  186. <div class="description">{{_('Turn off if you use your keyboard to scroll') }}</div>
  187. </fieldset>
  188. {% endif %}
  189. {{ plugin_preferences('ui') }}
  190. {{ tab_footer() }}
  191. {{ tab_header('maintab', 'cookies', _('Cookies')) }}
  192. <p class="text-muted" style="margin:20px 0;">
  193. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  194. {{ _('With that list, you can assess searx transparency.') }}<br />
  195. </p>
  196. {% if cookies %}
  197. <table class="cookies">
  198. <tr>
  199. <th>{{ _('Cookie name') }}</th>
  200. <th>{{ _('Value') }}</th>
  201. </tr>
  202. {% for cookie in cookies %}
  203. <tr>
  204. <td>{{ cookie }}</td>
  205. <td>{{ cookies[cookie] }}</td>
  206. </tr>
  207. {% endfor %}
  208. </table>
  209. {% else %}
  210. {% include 'oscar/messages/no_cookies.html' %}
  211. {% endif %}
  212. <h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
  213. <div class="selectable_url">
  214. <pre>{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}</pre>
  215. </div>
  216. <p class="small_font">{{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }}</p>
  217. {{ tab_footer() }}
  218. {{ tab_header('maintab', 'privacy', _('Privacy')) }}
  219. {% if 'method' not in locked_preferences %}
  220. <fieldset>
  221. <legend>{{ _('Method') }}</legend>
  222. <p class="value">
  223. <select name='method'>
  224. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  225. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  226. </select>
  227. </p>
  228. <div class="description">{{ _('Search language') }}</div>
  229. </fieldset>
  230. {% endif %}
  231. {% if 'image_proxy' not in locked_preferences %}
  232. <fieldset>
  233. <legend>{{ _('Image proxy') }}</legend>
  234. <p class="value">
  235. <select name='image_proxy'>
  236. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  237. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>
  238. </select>
  239. </p>
  240. <div class="description">{{ _('Proxying image results through searx') }}</div>
  241. </fieldset>
  242. {% endif %}
  243. {{ plugin_preferences('privacy') }}
  244. {{ tab_footer() }}
  245. {{ tabs_close() }}
  246. <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
  247. <br />
  248. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  249. </p>
  250. <input type="submit" value="{{ _('save') }}" />
  251. <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div>
  252. <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
  253. </form>
  254. {% endblock %}