这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/admin/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Sample response
"images",
],
"default_locale": "",
"default_theme": "simple",
"engines": [
{
"categories": [
Expand Down
10 changes: 5 additions & 5 deletions docs/admin/engines/nosql-engines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ All of the engines above are just commented out in the :origin:`settings.yml
dependencies before using them.

By default, the engines use the ``key-value`` template for displaying results /
see :origin:`simple <searx/templates/simple/result_templates/key-value.html>`
theme. If you are not satisfied with the original result layout, you can use
your own template, set ``result_template`` attribute to ``{template_name}`` and
place the templates at::
see :origin:`simple <searx/templates/result_templates/key-value.html>`.
If you are not satisfied with the original result layout, you can use your own
template, set ``result_template`` attribute to ``{template_name}`` and place
the templates at::

searx/templates/{theme_name}/result_templates/{template_name}
searx/templates/result_templates/{template_name}

Futhermore, if you do not wish to expose these engines on a public instance, you
can still add them and limit the access by setting ``tokens`` as described in
Expand Down
4 changes: 0 additions & 4 deletions docs/admin/engines/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ Global Settings
query_in_title: false
infinite_scroll: false
center_alignment: false
default_theme: simple
theme_args:
simple_style: auto

Expand All @@ -254,9 +253,6 @@ Global Settings
side of the screen. This setting only affects the *desktop layout*
(:origin:`min-width: @tablet <searx/static/themes/simple/src/less/definitions.less>`)

``default_theme`` :
Name of the theme you want to use by default on your SearXNG instance.

``theme_args.simple_style``:
Style of simple theme: ``auto``, ``light``, ``dark``

Expand Down
6 changes: 3 additions & 3 deletions docs/admin/engines/sql-engines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ engines, e.g. ``database:`` ...
query_str: ...

By default, the engines use the ``key-value`` template for displaying results /
see :origin:`simple <searx/templates/simple/result_templates/key-value.html>`
theme. If you are not satisfied with the original result layout, you can use
see :origin:`simple <searx/templates/result_templates/key-value.html>`.
If you are not satisfied with the original result layout, you can use
your own template, set ``result_template`` attribute to ``{template_name}`` and
place the templates at::

searx/templates/{theme_name}/result_templates/{template_name}
searx/templates/result_templates/{template_name}

If you do not wish to expose these engines on a public instance, you can still
add them and limit the access by setting ``tokens`` as described in section
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ choose a meaningful commit message and we are happy to receive your pull
request. To not end in *wild west* we have some directives, please pay attention
to our ":ref:`how to contribute`" guideline.

If you implement themes, you will need to setup a :ref:`make node.env` once:
If you implement theme, you will need to setup a :ref:`make node.env` once:

.. code:: sh

Expand Down
9 changes: 0 additions & 9 deletions docs/dev/search_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ Parameters
Filter search results of engines which support safe search. See if an engine
supports safe search in the preferences page of an instance.

``theme`` : default ``simple``
[ ``simple`` ]

Theme of instance.

Please note, available themes depend on an instance. It is possible that an
instance administrator deleted, created or renamed themes on their instance.
See the available options in the preferences page of the instance.

``enabled_plugins`` : optional
List of enabled plugins.

Expand Down
7 changes: 1 addition & 6 deletions searx/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def transform_form_items(self, items):
class Preferences:
"""Validates and saves preferences to cookies"""

def __init__(self, themes: List[str], categories: List[str], engines: Dict[str, Engine], plugins: Iterable[Plugin]):
def __init__(self, categories: List[str], engines: Dict[str, Engine], plugins: Iterable[Plugin]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really remove the theme option entirely. Maybe we want to support (external) themes one day?

I don't have a finial opinion, perhaps it is better after at all, to remove entirely first and think about a support of (external) themes when we have a need for.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking twice .. its more clear if we remove the theme from the preferences entirely / #1153 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree. For now we only have the simple theme and in the future we can think about external themes / a new impl. of themes as only CSS for example...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the master branch, to add a new theme, a maintainer creates a directory in the templates and static directories ... and then the existing theme (the simple theme) is forgotten ; which make sense from the maintainer point of view.

See my-spot fork for example:

With this PR, we make sure only the maintained theme is available.

The remaining question: how my-spot deals with its own theme? (my-spot is an example here)

  • either reuse the templates and static directories.
  • either use two new directories, for example searx/etheme/templates and searx/etheme/static:
    • it is easier to backport commits (no conflicts)
    • the history of the searx/etheme directory is clean.

I'm not sure this is a good solution, but this PR:

  • make the code more straightforward / easier to understand for someone new to the project.
  • enforce the fact we won't support more than one theme.

note: my-spot is based of searx anyway.

super().__init__()

self.key_value_settings: Dict[str, Setting] = {
Expand Down Expand Up @@ -340,11 +340,6 @@ def __init__(self, themes: List[str], categories: List[str], engines: Dict[str,
'2': 2
}
),
'theme': EnumStringSetting(
settings['ui']['default_theme'],
locked=is_locked('theme'),
choices=themes
),
'results_on_new_tab': MapSetting(
settings['ui']['results_on_new_tab'],
locked=is_locked('results_on_new_tab'),
Expand Down
2 changes: 0 additions & 2 deletions searx/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ ui:
query_in_title: false
# infinite_scroll: When true, automatically loads the next page when scrolling to bottom of the current page.
infinite_scroll: false
# ui theme
default_theme: simple
# center the results ?
center_alignment: false
# Default interface locale - leave blank to detect from browser information or
Expand Down
1 change: 0 additions & 1 deletion searx/settings_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def apply_schema(settings, schema, path_list):
'static_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'static')),
'static_use_hash': SettingsValue(bool, False),
'templates_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'templates')),
'default_theme': SettingsValue(str, 'simple'),
'default_locale': SettingsValue(str, ''),
'theme_args': {
'simple_style': SettingsValue(SIMPLE_STYLE, 'auto'),
Expand Down
4 changes: 2 additions & 2 deletions searx/static/themes/simple/gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ module.exports = function (grunt) {
svgo: ['--config', 'svg4web.svgo.js']
},
files: {
'<%= _templates %>/simple/searxng-wordmark.min.svg': '<%= _brand %>/searxng-wordmark.svg',
'<%= _templates %>/searxng-wordmark.min.svg': '<%= _brand %>/searxng-wordmark.svg',
'img/searxng.svg': '<%= _brand %>/searxng.svg',
'img/img_load_error.svg': '<%= _brand %>/img_load_error.svg'
}
Expand Down Expand Up @@ -192,7 +192,7 @@ module.exports = function (grunt) {
'heart-outline': 'node_modules/ionicons/dist/svg/heart-outline.svg',
'information-circle-outline': 'src/svg/information-circle-outline.svg',
},
dest: '../../../templates/simple/icons.html',
dest: '../../../templates/icons.html',
},
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "simple/base.html" %}
{% extends "base.html" %}
{% block content %}
<div class="center">
<h1>{{ _('Page not found') }}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<link rel="icon" href="{{ url_for('static', filename='img/favicon.svg') }}" type="image/svg+xml">
</head>
<body class="{{ endpoint }}_endpoint" >
<main id="main_{{ self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}" class="{{body_class}}">
<main id="main_{{ self._TemplateReference__context.name|replace(".html", "") }}" class="{{body_class}}">
{% if errors %}
<div class="dialog-error" role="alert">
<a href="#" class="close" aria-label="close" title="close">×</a>
Expand All @@ -41,7 +41,7 @@
{% endif %}

<nav id="links_on_top">
{%- from 'simple/icons.html' import icon_big -%}
{%- from 'icons.html' import icon_big -%}
{%- block linkto_about -%}
<a href="{{ url_for('info', pagename='about') }}" class="link_on_top_about">{{ icon_big('information-circle-outline') }}<span>{{ _('About') }}</span></a>
{%- endblock -%}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/icons.html' import icon_big %}
{% from 'icons.html' import icon_big %}
{%- set category_icons = {
'general': 'search-outline',
'images': 'image-outline',
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions searx/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}
{% from 'icons.html' import icon_big %}
{% block content %}
<div class="index">
<div class="title"><h1>SearXNG</h1></div>
{% include 'simple_search.html' %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'simple/page_with_header.html' %}
{% extends 'page_with_header.html' %}
{% block title %}{{ active_page.title }} - {% endblock %}
{% block linkto_about %}{% endblock %}
{% block linkto_donate %}{% endblock %}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/icons.html' import icon_small %}
{% from 'icons.html' import icon_small %}

<!-- Draw favicon -->
{% macro draw_favicon(favicon) -%}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/icons.html' import icon %}
{% from 'icons.html' import icon %}
<div class="alert alert-info fade in" role="alert">
<strong class="lead">{{ icon('info-sign') }} {{ _('Information!') }}</strong>
{{ _('currently, there are no cookies defined.') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/icons.html' import icon_big %}
{% from 'icons.html' import icon_big %}
{% if unresponsive_engines %}
<div class="dialog-error" role="alert">
{{ icon_big('warning') }}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set body_class = "page_with_header" %}
{% extends "simple/base.html" %}
{% extends "base.html" %}
{% block header %}
<a href="{{ url_for('index') }}"><img class="logo" src="{{ url_for('static', filename='img/searxng.png') }}" alt="SearXNG"></a>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% from 'simple/macros.html' import tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %}
{% from 'simple/icons.html' import icon_big %}
{% from 'macros.html' import tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %}
{% from 'icons.html' import icon_big %}

{% extends "simple/page_with_header.html" %}
{% extends "page_with_header.html" %}

{%- macro plugin_preferences(section) -%}
{%- for plugin in plugins -%}
Expand Down Expand Up @@ -107,7 +107,7 @@ <h1>{{ _('Preferences') }}</h1>
<fieldset>
<legend>{{ _('Default categories') }}</legend>
{% set display_tooltip = false %}
{% include 'simple/categories.html' %}
{% include 'categories.html' %}
</fieldset>
{% endif %}
{% if 'language' not in locked_preferences %}
Expand Down Expand Up @@ -191,17 +191,6 @@ <h1>{{ _('Preferences') }}</h1>
</fieldset>
{% endif %}
{% if 'theme' not in locked_preferences %}
<fieldset>
<legend id="pref_theme">{{ _('Theme') }}</legend>
<p class="value">
<select name="theme" aria-labelledby="pref_theme">
{%- for name in themes -%}
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
{%- endfor -%}
</select>
</p>
<div class="description">{{ _('Change SearXNG layout') }}</div>
</fieldset>
<fieldset>
<legend id="pref_simple_style">{{ _('Theme style') }}</legend>
<p class="value">
Expand Down Expand Up @@ -409,7 +398,7 @@ <h1>{{ _('Preferences') }}</h1>
{% endfor %}
</table>
{% else %}
{% include 'simple/messages/no_cookies.html' %}
{% include 'messages/no_cookies.html' %}
{% endif %}
<h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
<div class="selectable_url">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
{% from 'macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}

{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
{% from 'macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}

{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
{% from 'simple/icons.html' import icon_small %}
{% from 'macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
{% from 'icons.html' import icon_small %}

{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
Expand Down
14 changes: 14 additions & 0 deletions searx/templates/result_templates/products.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer, result_footer_rtl with context %}

{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
{% if result.price %}<div class="result_price">{{ result.price }}</div></br>{% endif %}
{% if result.shipping %}<div class="result_shipping">{{ result.shipping }}</div></br>{% endif %}
{% if result.source_country %}<div class="result_source_country">{{ result.source_country }}</div></br>{% endif %}
{%- if result.content %}
<p class="content">
{{ result.content }}
</p>
{% endif -%}
{{- result_sub_footer(result, proxify) -}}
{{- result_footer(result) }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer, result_link with context %}
{% from 'macros.html' import result_header, result_sub_header, result_sub_footer, result_footer, result_link with context %}

{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
{% from 'macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}

{{ result_header(result, favicons, image_proxify) }}
{{ result_sub_header(result) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "simple/base.html" %}
{% from 'simple/icons.html' import icon, icon_big, icon_small %}
{% extends "base.html" %}
{% from 'icons.html' import icon, icon_big, icon_small %}
{% macro engine_data_form(engine_data) -%}
{% for engine_name, kv_data in engine_data.items() %}
{% for k, v in kv_data.items() %}
Expand All @@ -10,7 +10,7 @@
{% block title %}{% if query_in_title %}{{- q|e }} - {% endif %}{% endblock %}
{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}&amp;pageno={{ pageno }}&amp;time_range={{ time_range }}&amp;language={{ current_language }}&amp;safesearch={{ safesearch }}&amp;format=rss">{% endblock %}
{% block content %}
{% include 'simple/search.html' %}
{% include 'search.html' %}

{% if results and results|map(attribute='template')|unique|list|count == 1 %}
{% set only_template = 'only_template_' + results[0]['template']|default('default')|replace('.html', '') %}
Expand Down Expand Up @@ -58,7 +58,7 @@
{% if infoboxes %}
<div id="infoboxes">
{% for infobox in infoboxes -%}
{% include 'simple/infobox.html' %}
{% include 'infobox.html' %}
{%- endfor %}
</div>
{% endif %}
Expand Down Expand Up @@ -145,7 +145,7 @@ <h4 id="corrections-title">{{ _('Try searching for:') }}</h4>
{% if result.close_group and not only_template %}</div>{% endif %}
{% endfor %}
{% if not results and not answers %}
{% include 'simple/messages/no_results.html' %}
{% include 'messages/no_results.html' %}
{% endif %}
</div>
<div id="backToTop">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="search_header">
<a id="search_logo" href="{{ url_for('index') }}" tabindex="0" title="{{ _('Display the front page') }}">
<span hidden>SearXNG</span>
{% include 'simple/searxng-wordmark.min.svg' without context %}
{% include 'searxng-wordmark.min.svg' without context %}
</a>
<div id="search_view">
<div class="search_box">
Expand All @@ -12,12 +12,12 @@
</div>
</div>
{% set display_tooltip = true %}
{% include 'simple/categories.html' %}
{% include 'categories.html' %}
</div>
<div class="search_filters">
{% include 'simple/filters/languages.html' %}
{% include 'simple/filters/time_range.html' %}
{% include 'simple/filters/safesearch.html' %}
{% include 'filters/languages.html' %}
{% include 'filters/time_range.html' %}
{% include 'filters/safesearch.html' %}
</div>
<input type="hidden" name="theme" value="{{ theme }}" >
{% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
Expand Down
8 changes: 0 additions & 8 deletions searx/templates/simple/index.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% from 'simple/icons.html' import icon_big %}
{% from 'simple/new_issue.html' import new_issue with context %}
{% from 'icons.html' import icon_big %}
{% from 'new_issue.html' import new_issue with context %}

{% extends "simple/page_with_header.html" %}
{% extends "page_with_header.html" %}

{%- macro th_sort(column_order, column_name) -%}
{% if selected_engine_name %}
Expand Down
Loading