Browse Source

Merge branch 'master' into about-opensearch

Markus Heiser 4 years ago
parent
commit
2b1f73ad49
41 changed files with 99 additions and 42 deletions
  1. 6 0
      searx/settings.yml
  2. 0 0
      searx/static/themes/legacy/css/style.css
  3. 4 0
      searx/static/themes/legacy/less/style.less
  4. 1 1
      searx/static/themes/oscar/css/logicodev-dark.css
  5. 0 0
      searx/static/themes/oscar/css/logicodev-dark.min.css
  6. 1 1
      searx/static/themes/oscar/css/logicodev.css
  7. 0 0
      searx/static/themes/oscar/css/logicodev.min.css
  8. 9 0
      searx/static/themes/oscar/js/searx.js
  9. 0 1
      searx/static/themes/oscar/js/searx.min.js
  10. 9 0
      searx/static/themes/oscar/js/searx_src/autocompleter.js
  11. 1 1
      searx/static/themes/oscar/less/logicodev/results.less
  12. 7 4
      searx/static/themes/oscar/package.json
  13. 4 1
      searx/static/themes/simple/css/searx-rtl.css
  14. 0 0
      searx/static/themes/simple/css/searx-rtl.min.css
  15. 4 1
      searx/static/themes/simple/css/searx.css
  16. 0 0
      searx/static/themes/simple/css/searx.min.css
  17. 4 0
      searx/static/themes/simple/less/style.less
  18. 1 1
      searx/templates/courgette/base.html
  19. 3 1
      searx/templates/courgette/preferences.html
  20. 1 1
      searx/templates/courgette/result_templates/code.html
  21. 1 1
      searx/templates/courgette/result_templates/default.html
  22. 1 1
      searx/templates/courgette/result_templates/images.html
  23. 1 1
      searx/templates/courgette/result_templates/key-value.html
  24. 1 1
      searx/templates/courgette/result_templates/map.html
  25. 1 1
      searx/templates/courgette/result_templates/torrent.html
  26. 1 1
      searx/templates/courgette/result_templates/videos.html
  27. 1 1
      searx/templates/legacy/base.html
  28. 3 1
      searx/templates/legacy/preferences.html
  29. 1 1
      searx/templates/legacy/result_templates/code.html
  30. 1 1
      searx/templates/legacy/result_templates/default.html
  31. 1 1
      searx/templates/legacy/result_templates/images.html
  32. 1 1
      searx/templates/legacy/result_templates/key-value.html
  33. 1 1
      searx/templates/legacy/result_templates/map.html
  34. 1 1
      searx/templates/legacy/result_templates/torrent.html
  35. 1 1
      searx/templates/legacy/result_templates/videos.html
  36. 1 1
      searx/templates/oscar/base.html
  37. 5 1
      searx/templates/oscar/infobox.html
  38. 3 1
      searx/templates/oscar/results.html
  39. 1 1
      searx/templates/simple/base.html
  40. 1 1
      searx/templates/simple/macros.html
  41. 16 9
      searx/webapp.py

+ 6 - 0
searx/settings.yml

@@ -24,6 +24,12 @@ ui:
     default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section
     theme_args :
         oscar_style : logicodev # default style of oscar
+#   categories_order :
+#     - general
+#     - files
+#     - map
+#     - it
+#     - science
 
 # searx supports result proxification using an external service: https://github.com/asciimoo/morty
 # uncomment below section if you have running morty proxy

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/legacy/css/style.css


+ 4 - 0
searx/static/themes/legacy/less/style.less

@@ -741,3 +741,7 @@ color: @color-font-light;
     transition: opacity 1s ease;
     opacity: 0.8;
 }
+
+pre code {
+    white-space: pre-wrap;
+}

+ 1 - 1
searx/static/themes/oscar/css/logicodev-dark.css

@@ -172,7 +172,7 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
 .result-videos,
 .result-map {
   clear: both;
-  padding: 2px 4px;
+  padding: 0.5em 4px;
 }
 .result-default:hover,
 .result-code:hover,

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/oscar/css/logicodev-dark.min.css


+ 1 - 1
searx/static/themes/oscar/css/logicodev.css

@@ -145,7 +145,7 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
 .result-videos,
 .result-map {
   clear: both;
-  padding: 2px 4px;
+  padding: 0.5em 4px;
 }
 .result-default:hover,
 .result-code:hover,

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/oscar/css/logicodev.min.css


+ 9 - 0
searx/static/themes/oscar/js/searx.js

@@ -78,7 +78,13 @@ if(searx.autocompleter) {
 }
 
 $(document).ready(function(){
+    var original_search_value = '';
     if(searx.autocompleter) {
+		$("#q").on('keydown', function(e) {
+			if(e.which == 13) {
+                original_search_value = $('#q').val();
+			}
+		});
         $('#q').typeahead(null, {
             name: 'search-results',
             displayKey: function(result) {
@@ -87,6 +93,9 @@ $(document).ready(function(){
             source: searx.searchResults.ttAdapter()
         });
         $('#q').bind('typeahead:selected', function(ev, suggestion) {
+            if(original_search_value) {
+                $('#q').val(original_search_value);
+            }
             $("#search_form").submit();
         });
     }

File diff suppressed because it is too large
+ 0 - 1
searx/static/themes/oscar/js/searx.min.js


+ 9 - 0
searx/static/themes/oscar/js/searx_src/autocompleter.js

@@ -25,7 +25,13 @@ if(searx.autocompleter) {
 }
 
 $(document).ready(function(){
+    var original_search_value = '';
     if(searx.autocompleter) {
+		$("#q").on('keydown', function(e) {
+			if(e.which == 13) {
+                original_search_value = $('#q').val();
+			}
+		});
         $('#q').typeahead(null, {
             name: 'search-results',
             displayKey: function(result) {
@@ -34,6 +40,9 @@ $(document).ready(function(){
             source: searx.searchResults.ttAdapter()
         });
         $('#q').bind('typeahead:selected', function(ev, suggestion) {
+            if(original_search_value) {
+                $('#q').val(original_search_value);
+            }
             $("#search_form").submit();
         });
     }

+ 1 - 1
searx/static/themes/oscar/less/logicodev/results.less

@@ -64,7 +64,7 @@
 // default formating of results
 .result-default, .result-code, .result-torrent, .result-videos, .result-map {
     clear: both;
-    padding: 2px 4px;
+    padding: 0.5em 4px;
     &:hover{
         background-color: @dim-gray;
     }

+ 7 - 4
searx/static/themes/oscar/package.json

@@ -1,15 +1,18 @@
 {
     "devDependencies": {
-        "grunt": "~0.4.5",
-        "grunt-contrib-uglify": "~0.6.0",
-        "grunt-contrib-watch": "~0.6.1",
+        "grunt": "^0.4.5",
         "grunt-contrib-concat": "~0.5.0",
         "grunt-contrib-jshint": "~0.10.0",
-        "grunt-contrib-less": "~0.11.0"
+        "grunt-contrib-less": "~0.11.0",
+        "grunt-contrib-uglify": "~0.6.0",
+        "grunt-contrib-watch": "~0.6.1"
     },
     "scripts": {
         "build": "npm install && grunt",
         "start": "grunt watch",
         "test": "grunt"
+    },
+    "dependencies": {
+        "grunt-cli": "^1.3.2"
     }
 }

+ 4 - 1
searx/static/themes/simple/css/searx-rtl.css

@@ -1,4 +1,4 @@
-/*! searx | 06-08-2019 | https://github.com/asciimoo/searx */
+/*! searx | 04-06-2020 |  */
 /*
 * searx, A privacy-respecting, hackable metasearch engine
 *
@@ -2171,6 +2171,9 @@ article.result-images[data-vim-selected]::before {
     overflow: inherit;
   }
 }
+pre code {
+  white-space: pre-wrap;
+}
 #search_submit {
   left: 1px;
   right: auto;

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/css/searx-rtl.min.css


+ 4 - 1
searx/static/themes/simple/css/searx.css

@@ -1,4 +1,4 @@
-/*! searx | 06-08-2019 | https://github.com/asciimoo/searx */
+/*! searx | 04-06-2020 |  */
 /*
 * searx, A privacy-respecting, hackable metasearch engine
 *
@@ -2171,3 +2171,6 @@ article.result-images[data-vim-selected]::before {
     overflow: inherit;
   }
 }
+pre code {
+  white-space: pre-wrap;
+}

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/css/searx.min.css


+ 4 - 0
searx/static/themes/simple/less/style.less

@@ -719,3 +719,7 @@ article.result-images[data-vim-selected]::before {
   }
 
 }
+
+pre code {
+    white-space: pre-wrap;
+}

+ 1 - 1
searx/templates/courgette/base.html

@@ -29,7 +29,7 @@
             searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
         </script>
     </head>
-    <body>
+    <body class="{{ endpoint }}_endpoint" >
         <div id="container">
             {% block content %}
             {% endblock %}

+ 3 - 1
searx/templates/courgette/preferences.html

@@ -98,6 +98,7 @@
         <table class="engine-table">
             <tr>
                 <th>{{ _('Engine name') }}</th>
+                <th>{{ _('Shortcut') }}</th>
                 <th>{{ _('Category') }}</th>
                 <th>{{ _('Allow') }} / {{ _('Block') }}</th>
             </tr>
@@ -106,7 +107,8 @@
 
                 {% if not search_engine.private %}
                 <tr>
-                    <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td>
+                    <td>{{ search_engine.name }}</td>
+                    <td>{{ shortcuts[search_engine.name] }}</td>
                     <td>{{ _(categ) }}</td>
                     <td class="engine_checkbox">
                         <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />

+ 1 - 1
searx/templates/courgette/result_templates/code.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
     <h3 class="result_title"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}
     <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>

+ 1 - 1
searx/templates/courgette/result_templates/default.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
 
     {% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />

+ 1 - 1
searx/templates/courgette/result_templates/images.html

@@ -1,4 +1,4 @@
-<div class="image_result">
+<div class="image_result{% for e in result.engines %} {{ e }}{% endfor %}">
     <p>
         <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
         <span class="url"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="small_font">{{ _('original context') }}</a></span>

+ 1 - 1
searx/templates/courgette/result_templates/key-value.html

@@ -1,4 +1,4 @@
-<div class="result">
+<div class="result{% for e in result.engines %} {{ e }}{% endfor %}">
 <table>
     {% for key, value in result.items() %}
     {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %}

+ 1 - 1
searx/templates/courgette/result_templates/map.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
 
     {% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />

+ 1 - 1
searx/templates/courgette/result_templates/torrent.html

@@ -1,4 +1,4 @@
-<div class="result torrent_result">
+<div class="result torrent_result{% for e in result.engines %} {{ e }}{% endfor %}">
     {% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
     {% endif %}

+ 1 - 1
searx/templates/courgette/result_templates/videos.html

@@ -1,4 +1,4 @@
-<div class="result">
+<div class="result{% for e in result.engines %} {{ e }}{% endfor %}">
 	{% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
 	{% endif %}

+ 1 - 1
searx/templates/legacy/base.html

@@ -20,7 +20,7 @@
         <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
         {% endblock %}
     </head>
-    <body>
+    <body class="{{ endpoint }}_endpoint" >
         <div id="container">
             {% block content %}
             {% endblock %}

+ 3 - 1
searx/templates/legacy/preferences.html

@@ -95,6 +95,7 @@
     <table>
         <tr>
             <th>{{ _('Engine name') }}</th>
+            <th>{{ _('Shortcut') }}</th>
             <th>{{ _('Category') }}</th>
             <th>{{ _('Allow') }} / {{ _('Block') }}</th>
         </tr>
@@ -103,7 +104,8 @@
 
             {% if not search_engine.private %}
             <tr>
-                <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td>
+                <td>{{ search_engine.name }}</td>
+                <td>{{ shortcuts[search_engine.name] }}</td>
                 <td>{{ _(categ) }}</td>
                 <td class="engine_checkbox">
                     <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />

+ 1 - 1
searx/templates/legacy/result_templates/code.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
     <h3 class="result_title"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
     <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a></p>
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}

+ 1 - 1
searx/templates/legacy/result_templates/default.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
     <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
     <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a>
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>

+ 1 - 1
searx/templates/legacy/result_templates/images.html

@@ -1,4 +1,4 @@
-<div class="image_result">
+<div class="image_result{% for e in result.engines %} {{ e }}{% endfor %}">
     <p>
         <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}" /></a>
         <span class="url"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="small_font">{{ _('original context') }}</a></span>

+ 1 - 1
searx/templates/legacy/result_templates/key-value.html

@@ -1,4 +1,4 @@
-<table class="result-table">
+<table class="result-table{% for e in result.engines %} {{ e }}{% endfor %}">
     {% for key, value in result.items() %}
     {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %}
         {% continue %}

+ 1 - 1
searx/templates/legacy/result_templates/map.html

@@ -1,4 +1,4 @@
-<div class="result {{ result.class }}">
+<div class="result {{ result.class }}{% for e in result.engines %} {{ e }}{% endfor %}">
 
     {% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />

+ 1 - 1
searx/templates/legacy/result_templates/torrent.html

@@ -1,4 +1,4 @@
-<div class="result torrent_result">
+<div class="result torrent_result{% for e in result.engines %} {{ e }}{% endfor %}">
   {% if "icon_"~result.engine~".ico" in favicons %}
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
   {% endif %}

+ 1 - 1
searx/templates/legacy/result_templates/videos.html

@@ -1,4 +1,4 @@
-<div class="result">
+<div class="result{% for e in result.engines %} {{ e }}{% endfor %}">
     <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %}
     <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>

+ 1 - 1
searx/templates/oscar/base.html

@@ -47,7 +47,7 @@
         </style>
     </noscript>
 </head>
-<body>
+<body class="{{ endpoint }}_endpoint" >
     {% include 'oscar/navbar.html' %}
 
     <div class="container">

+ 5 - 1
searx/templates/oscar/infobox.html

@@ -16,7 +16,11 @@
                 {%- if attribute.image -%}
                 <td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
                 {%- else -%}
-                <td><bdi>{{ attribute.value }}</bdi></td>
+                 {% if attribute.label == 'Instance of' %}
+                  <td><bdi><a href="https://wikidata.org/wiki/{{ attribute.value.id }}">{{ attribute.value.id }}</a></bdi></td>
+                 {% else %}
+                  <td><bdi>{{ attribute.value }}</bdi></td>
+                 {%- endif -%}
                 {%- endif -%}
             </tr>
             {% endfor -%}

+ 3 - 1
searx/templates/oscar/results.html

@@ -72,6 +72,8 @@
                     </form>
                     {% endfor %}
                     <div class="clearfix"></div>
+                    <br /><label><a href="{{ search_url() }}&amp;format=rss">{{ _('RSS subscription') }}</a></label>
+                    <div class="clearfix"></div>
                 </div>
             </div>
         </div><!-- /#sidebar_results -->
@@ -100,7 +102,7 @@
             {%- endif %}
 
             {% for result in results -%}
-            <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
+            <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}{% for e in result.engines %} {{ e }}{% endfor %}">
                 {%- set index = loop.index -%}
                 {%- if result.template -%}
                     {% include get_result_template('oscar', result['template']) %}

+ 1 - 1
searx/templates/simple/base.html

@@ -32,7 +32,7 @@
   {% endblock %}
   <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
 </head>
-<body>
+<body class="{{ endpoint }}_endpoint" >
   <main id="main_{{  self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}">
     {% if errors %}
         <div class="dialog-error" role="alert">

+ 1 - 1
searx/templates/simple/macros.html

@@ -26,7 +26,7 @@
 
 <!-- Draw result header -->
 {% macro result_header(result, favicons, image_proxify) -%}
-<article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}">
+<article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}{% for e in result.engines %} {{ e }}{% endfor %}">
   {%- if result.img_src %}{{ result_open_link(result.url) }}<img class="image" src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="image" />{{ result_close_link() }}{% endif -%}
   {%- if result.thumbnail %}{{ result_open_link(result.url) }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/>{{ result_close_link() }}{% endif -%}
   <h3>{{ result_link(result.url, result.title|safe) }}</h3>

+ 16 - 9
searx/webapp.py

@@ -355,17 +355,12 @@ def render(template_name, override_theme=None, **kwargs):
                              if (engine_name, category) not in disabled_engines)
 
     if 'categories' not in kwargs:
-        kwargs['categories'] = ['general']
-        kwargs['categories'].extend(x for x in
-                                    sorted(categories.keys())
-                                    if x != 'general'
-                                    and x in enabled_categories)
+        kwargs['categories'] = [x for x in
+                                _get_ordered_categories()
+                                if x in enabled_categories]
 
     if 'all_categories' not in kwargs:
-        kwargs['all_categories'] = ['general']
-        kwargs['all_categories'].extend(x for x in
-                                        sorted(categories.keys())
-                                        if x != 'general')
+        kwargs['all_categories'] = _get_ordered_categories()
 
     if 'selected_categories' not in kwargs:
         kwargs['selected_categories'] = []
@@ -430,6 +425,7 @@ def render(template_name, override_theme=None, **kwargs):
     kwargs['brand'] = brand
 
     kwargs['scripts'] = set()
+    kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint
     for plugin in request.user_plugins:
         for script in plugin.js_dependencies:
             kwargs['scripts'].add(script)
@@ -443,6 +439,17 @@ def render(template_name, override_theme=None, **kwargs):
         '{}/{}'.format(kwargs['theme'], template_name), **kwargs)
 
 
+def _get_ordered_categories():
+    ordered_categories = []
+    if 'categories_order' not in settings['ui']:
+        ordered_categories = ['general']
+        ordered_categories.extend(x for x in sorted(categories.keys()) if x != 'general')
+        return ordered_categories
+    ordered_categories = settings['ui']['categories_order']
+    ordered_categories.extend(x for x in sorted(categories.keys()) if x not in ordered_categories)
+    return ordered_categories
+
+
 @app.before_request
 def pre_request():
     request.start_time = time()

Some files were not shown because too many files changed in this diff