preferences.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {% from 'simple/macros.html' import 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. <fieldset>
  26. <legend>{{ _('Default categories') }}</legend>
  27. {% set display_tooltip = false %}
  28. {% include 'simple/categories.html' %}
  29. </fieldset>
  30. <fieldset>
  31. <legend>{{ _('Search language') }}</legend>
  32. <p class="value">{{- '' -}}
  33. <select name='language'>{{- '' -}}
  34. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
  35. {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%}
  36. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
  37. {%- endfor -%}
  38. </select>{{- '' -}}
  39. </p>
  40. <div class="description">{{ _('What language do you prefer for search?') }}</div>
  41. </fieldset>
  42. <fieldset>
  43. <legend>{{ _('Autocomplete') }}</legend>
  44. <p class="value">
  45. <select name="autocomplete">
  46. <option value=""> - </option>
  47. {% for backend in autocomplete_backends %}
  48. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  49. {% endfor %}
  50. </select>
  51. </p>
  52. <div class="description">{{ _('Find stuff as you type') }}</div>
  53. </fieldset>
  54. <fieldset>
  55. <legend>{{ _('SafeSearch') }}</legend>
  56. <p class="value">
  57. <select name='safesearch'>
  58. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  59. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  60. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  61. </select>
  62. </p>
  63. <div class="description">{{ _('Filter content') }}</p>
  64. </fieldset>
  65. {{ plugin_preferences('general') }}
  66. {{ tab_footer() }}
  67. {{ tab_header('maintab', 'engines', _('Engines')) }}
  68. <p>{{ _('Currently used search engines') }}</p>
  69. {{ tabs_open() }}
  70. {% for categ in all_categories %}
  71. {{ tab_header('enginetab', 'category' + categ, _(categ)) }}
  72. <div class="scrollx">
  73. <table class="striped">
  74. <tr>
  75. <th class="engine_checkbox">{{ _("Allow") }}</th>
  76. <th class="name">{{ _("Engine name") }}</th>
  77. <th class="shortcut">{{ _("Shortcut") }}</th>
  78. <th>{{ _("Supports selected language") }}</th>
  79. <th>{{ _("SafeSearch") }}</th>
  80. <th>{{ _("Time range") }}</th>
  81. <th>{{ _("Avg. time") }}</th>
  82. <th>{{ _("Max time") }}</th>
  83. </tr>
  84. {% for search_engine in engines_by_category[categ] %}
  85. {% if not search_engine.private %}
  86. {% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %}
  87. <tr>
  88. <td class="engine_checkbox">{{ checkbox_onoff(engine_id, (search_engine.name, categ) in disabled_engines) }}</td>
  89. <th class="name">{{ search_engine.name }}</th>
  90. <td class="shortcut">{{ shortcuts[search_engine.name] }}</td>
  91. <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>
  92. <td>{{ checkbox(engine_id + '_safesearch', search_engine.safesearch==True, true, true) }}</td>
  93. <td>{{ checkbox(engine_id + '_time_range_support', search_engine.time_range_support==True, true, true) }}</td>
  94. <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>
  95. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  96. </tr>
  97. {% endif %}
  98. {% endfor %}
  99. </table>
  100. <div>
  101. {{ tab_footer() }}
  102. {% endfor %}
  103. {{ tabs_close() }}
  104. {{ tab_footer() }}
  105. {{ tab_header('maintab', 'ui', _('User interface')) }}
  106. <fieldset>
  107. <legend>{{ _('Interface language') }}</legend>
  108. <p class="value">
  109. <select name='locale'>
  110. {% for locale_id,locale_name in locales.items() | sort %}
  111. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  112. {% endfor %}
  113. </select>
  114. </p>
  115. <div class="description">{{ _('Change the language of the layout') }}</div>
  116. </fieldset>
  117. <fieldset>
  118. <legend>{{ _('Themes') }}</legend>
  119. <p class="value">
  120. <select name="theme">
  121. {%- for name in themes -%}
  122. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  123. {%- endfor -%}
  124. </select>
  125. </p>
  126. <div class="description">{{ _('Change searx layout') }}</div>
  127. </fieldset>
  128. <fieldset>
  129. <legend>{{ _('Results on new tabs') }}</legend>
  130. <p class="value">
  131. <select name='results_on_new_tab'>
  132. <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
  133. <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
  134. </select>
  135. </p>
  136. <div class="description">{{_('Open result links on new browser tabs') }}</div>
  137. </fieldset>
  138. {{ plugin_preferences('ui') }}
  139. {{ tab_footer() }}
  140. {{ tab_header('maintab', 'privacy', _('Privacy')) }}
  141. <fieldset>
  142. <legend>{{ _('Method') }}</legend>
  143. <p class="value">
  144. <select name='method'>
  145. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  146. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  147. </select>
  148. </p>
  149. <div class="description">{{ _('Search language') }}</div>
  150. </fieldset>
  151. <fieldset>
  152. <legend>{{ _('Image proxy') }}</legend>
  153. <p class="value">
  154. <select name='image_proxy'>
  155. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  156. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option>
  157. </select>
  158. </p>
  159. <div class="description">{{ _('Proxying image results through searx') }}</div>
  160. </fieldset>
  161. {{ plugin_preferences('privacy') }}
  162. {{ tab_footer() }}
  163. {{ tabs_close() }}
  164. <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
  165. <br />
  166. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  167. </p>
  168. <input type="submit" value="{{ _('save') }}" />
  169. <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div>
  170. <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
  171. </form>
  172. {% endblock %}