preferences.html 10 KB

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