Browse Source

[theme] peel out oscar from SearXNG development

This is the first step of removing oscar theme

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 3 years ago
parent
commit
e8541b6006

+ 0 - 7
.github/dependabot.yml

@@ -8,13 +8,6 @@ updates:
       day: "friday"
     open-pull-requests-limit: 5
     target-branch: "master"
-  - package-ecosystem: "npm"
-    directory: "/searx/static/themes/oscar"
-    schedule:
-      interval: "weekly"
-      day: "friday"
-    open-pull-requests-limit: 5
-    target-branch: "master"
   - package-ecosystem: "npm"
     directory: "/searx/static/themes/simple"
     schedule:

+ 1 - 1
Makefile

@@ -87,7 +87,7 @@ MANAGE += pyenv pyenv.install pyenv.uninstall
 MANAGE += pypi.upload pypi.upload.test
 MANAGE += format.python
 MANAGE += test.yamllint test.pylint test.pyright test.black test.pybabel test.unit test.coverage test.robot test.rst test.clean
-MANAGE += themes.all themes.oscar themes.simple themes.simple.test pygments.less
+MANAGE += themes.all themes.simple themes.simple.test pygments.less
 MANAGE += static.build.commit static.build.drop static.build.restore
 MANAGE += nvm.install nvm.clean nvm.status nvm.nodejs
 

+ 1 - 1
docs/admin/api.rst

@@ -24,7 +24,7 @@ Sample response
        "images",
      ],
      "default_locale": "",
-     "default_theme": "oscar",
+     "default_theme": "simple",
      "engines": [
        {
          "categories": [

+ 2 - 3
docs/admin/engines/nosql-engines.rst

@@ -18,9 +18,8 @@ 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:`oscar <searx/templates/oscar/result_templates/key-value.html>` &
-:origin:`simple <searx/templates/simple/result_templates/key-value.html>`
-themes.  If you are not satisfied with the original result layout, you can use
+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::
 

+ 2 - 3
docs/admin/engines/sql-engines.rst

@@ -30,9 +30,8 @@ engines, e.g. ``database:`` ...
      query_str: ...
 
 By default, the engines use the ``key-value`` template for displaying results /
-see :origin:`oscar <searx/templates/oscar/result_templates/key-value.html>` &
-:origin:`simple <searx/templates/simple/result_templates/key-value.html>`
-themes.  If you are not satisfied with the original result layout, you can use
+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::
 

+ 2 - 12
docs/dev/search_api.rst

@@ -75,8 +75,8 @@ 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 ``oscar``
-  [ ``oscar``, ``simple`` ]
+``theme`` : default ``simple``
+  [ ``simple`` ]
 
   Theme of instance.
 
@@ -84,16 +84,6 @@ Parameters
   instance administrator deleted, created or renamed themes on their instance.
   See the available options in the preferences page of the instance.
 
-``oscar-style`` : default ``logicodev``
-  [ ``pointhi``, ``logicodev`` ]
-
-  Style of Oscar theme.  It is only parsed if the theme of an instance is
-  ``oscar``.
-
-  Please note, available styles depend on an instance.  It is possible that an
-  instance administrator deleted, created or renamed styles on their
-  instance. See the available options in the preferences page of the instance.
-
 ``enabled_plugins`` : optional
   List of enabled plugins.
 

+ 2 - 14
manage

@@ -115,7 +115,6 @@ test.:
   clean     : clean intermediate test stuff
 themes.:
   all       : build all themes
-  oscar     : build oscar theme
   simple    : build simple theme
 pygments.:
   less      : build LESS files for pygments
@@ -554,9 +553,6 @@ node.env() {
     nodejs.ensure
     (   set -e
 
-        build_msg INSTALL "searx/static/themes/oscar/package.json"
-        npm --prefix searx/static/themes/oscar install
-
         build_msg INSTALL "searx/static/themes/simple/package.json"
         npm --prefix searx/static/themes/simple install
     )
@@ -576,7 +572,6 @@ node.clean() {
     fi
     build_msg CLEAN "themes -- locally installed npm dependencies"
     (   set -e
-        npm --prefix searx/static/themes/oscar run clean
         npm --prefix searx/static/themes/simple run clean
     )
     dump_return $?
@@ -762,7 +757,6 @@ themes.all() {
     (   set -e
         pygments.less
         node.env
-        themes.oscar
         themes.simple
     )
     dump_return $?
@@ -771,14 +765,14 @@ themes.all() {
 themes.live() {
     local LIVE_THEME="${LIVE_THEME:-${1}}"
     case "${LIVE_THEME}" in
-        simple|oscar)
+        simple)
             theme="searx/static/themes/${LIVE_THEME}"
             ;;
         '')
             die_caller 42 "missing theme argument"
             ;;
         *)
-            die_caller 42 "unknown theme '${LIVE_THEME}' // [simple|oscar]'"
+            die_caller 42 "unknown theme '${LIVE_THEME}' // [simple]'"
             ;;
     esac
     build_msg GRUNT "theme: $1 (live build)"
@@ -792,12 +786,6 @@ themes.live() {
         | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |'
 }
 
-themes.oscar() {
-    build_msg GRUNT "theme: oscar"
-    npm --prefix searx/static/themes/oscar run build
-    dump_return $?
-}
-
 themes.simple() {
     (   set -e
         build_msg GRUNT "theme: simple"

+ 0 - 5
searx/preferences.py

@@ -362,11 +362,6 @@ class Preferences:
                 locked=is_locked('doi_resolver'),
                 choices=DOI_RESOLVERS
             ),
-            'oscar-style': EnumStringSetting(
-                settings['ui']['theme_args']['oscar_style'],
-                locked=is_locked('oscar-style'),
-                choices=['', 'logicodev', 'logicodev-dark', 'pointhi']
-            ),
             'simple_style': EnumStringSetting(
                 settings['ui']['theme_args']['simple_style'],
                 locked=is_locked('simple_style'),

+ 0 - 2
searx/settings.yml

@@ -86,8 +86,6 @@ ui:
   # Open result links in a new tab by default
   # results_on_new_tab: false
   theme_args:
-    # default style of oscar
-    oscar_style: logicodev
     # style of simple theme: auto, light, dark
     simple_style: auto
 

+ 0 - 2
searx/settings_defaults.py

@@ -18,7 +18,6 @@ searx_dir = abspath(dirname(__file__))
 logger = logging.getLogger('searx')
 OUTPUT_FORMATS = ['html', 'csv', 'json', 'rss']
 LANGUAGE_CODES = ['all'] + list(l[0] for l in languages)
-OSCAR_STYLE = ('logicodev', 'logicodev-dark', 'pointhi')
 SIMPLE_STYLE = ('auto', 'light', 'dark')
 CATEGORIES_AS_TABS = {
     'general': {},
@@ -181,7 +180,6 @@ SCHEMA = {
         'default_theme': SettingsValue(str, 'simple'),
         'default_locale': SettingsValue(str, ''),
         'theme_args': {
-            'oscar_style': SettingsValue(OSCAR_STYLE, 'logicodev'),
             'simple_style': SettingsValue(SIMPLE_STYLE, 'auto'),
         },
         'results_on_new_tab': SettingsValue(bool, False),

+ 1 - 1
searx/templates/oscar/messages/no_cookies.html → searx/templates/simple/messages/no_cookies.html

@@ -1,4 +1,4 @@
-{% from 'oscar/macros.html' import icon %}
+{% from 'simple/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.') }}

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

@@ -399,7 +399,7 @@
        {% endfor %}
      </table>
      {% else %}
-        {% include 'oscar/messages/no_cookies.html' %}
+        {% include 'simple/messages/no_cookies.html' %}
      {% endif %}
      <h4>{{ _('Search URL of the currently saved preferences') }} :</h4>
      <div class="selectable_url">

+ 0 - 79
searxng_extra/update/update_pygments.py

@@ -17,75 +17,6 @@ from pygments.token import Comment, Error, Generic, Keyword, Literal, Name, Oper
 
 from searx import searx_dir
 
-
-class LogicodevStyle(Style):  # pylint: disable=R0903
-    """Logicodev style
-    based on https://github.com/searx/searx/blob/2a5c39e33c3306ca17e09211fbf5a0f785cb10c8/searx/static/themes/oscar/less/logicodev/code.less
-    """  # pylint: disable=C0301
-
-    background_color = '#282C34'
-
-    styles = {
-        # fmt: off
-        Comment:                        "#556366 italic",
-        Comment.Multiline:              "#556366 italic",
-        Comment.Preproc:                "#BC7A00",
-        Comment.Single:                 "#556366 italic",
-        Comment.Special:                "#556366 italic",
-        Error:                          "border:#ff0000",
-        Generic.Deleted:                "#A00000",
-        Generic.Emph:                   "italic",
-        Generic.Error:                  "#FF0000",
-        Generic.Heading:                "#000080 bold",
-        Generic.Inserted:               "#00A000",
-        Generic.Output:                 "#888888",
-        Generic.Prompt:                 "#000080 bold",
-        Generic.Strong:                 "bold",
-        Generic.Subheading:             "#800080 bold",
-        Generic.Traceback:              "#0044DD",
-        Keyword:                        "#BE74D5 bold",
-        Keyword.Constant:               "#BE74D5 bold",
-        Keyword.Declaration:            "#BE74D5 bold",
-        Keyword.Namespace:              "#BE74D5 bold",
-        Keyword.Pseudo:                 "#BE74D5",
-        Keyword.Reserved:               "#BE74D5 bold",
-        Keyword.Type:                   "#D46C72",
-        Literal.Number:                 "#D19A66",
-        Literal.String:                 "#86C372",
-        Literal.String.Backtick:        "#86C372",
-        Literal.String.Char:            "#86C372",
-        Literal.String.Doc:             "#86C372 italic",
-        Literal.String.Double:          "#86C372",
-        Literal.String.Escape:          "#BB6622 bold",
-        Literal.String.Heredoc:         "#86C372",
-        Literal.String.Interpol:        "#BB6688 bold",
-        Literal.String.Other:           "#BE74D5",
-        Literal.String.Regex:           "#BB6688",
-        Literal.String.Single:          "#86C372",
-        Literal.String.Symbol:          "#DFC06F",
-        Name.Attribute:                 "#7D9029",
-        Name.Builtin:                   "#BE74D5",
-        Name.Builtin.Pseudo:            "#BE74D5",
-        Name.Class:                     "#61AFEF bold",
-        Name.Constant:                  "#D19A66",
-        Name.Decorator:                 "#AA22FF",
-        Name.Entity:                    "#999999 bold",
-        Name.Exception:                 "#D2413A bold",
-        Name.Function:                  "#61AFEF",
-        Name.Label:                     "#A0A000",
-        Name.Namespace:                 "#61AFEF bold",
-        Name.Tag:                       "#BE74D5 bold",
-        Name.Variable:                  "#DFC06F",
-        Name.Variable.Class:            "#DFC06F",
-        Name.Variable.Global:           "#DFC06F",
-        Name.Variable.Instance:         "#DFC06F",
-        Operator:                       "#D19A66",
-        Operator.Word:                  "#AA22FF bold",
-        Text.Whitespace:                "#D7DAE0",
-        # fmt: on
-    }
-
-
 CSSCLASS = '.code-highlight'
 RULE_CODE_LINENOS = """ .linenos {
     -webkit-touch-callout: none;
@@ -128,16 +59,6 @@ def get_css(cssclass, style):
 
 def main():
 
-    fname = 'static/themes/oscar/src/generated/pygments-logicodev.less'
-    print("update: %s" % fname)
-    with open(get_output_filename(fname), 'w') as f:
-        f.write(get_css(CSSCLASS, LogicodevStyle))
-
-    fname = 'static/themes/oscar/src/generated/pygments-pointhi.less'
-    print("update: %s" % fname)
-    with open(get_output_filename(fname), 'w') as f:
-        f.write(get_css(CSSCLASS, 'default'))
-
     fname = 'static/themes/simple/src/generated/pygments.less'
     print("update: %s" % fname)
     with open(get_output_filename(fname), 'w') as f:

+ 1 - 1
tests/robot/settings_robot.yml

@@ -24,7 +24,7 @@ server:
 ui:
   static_path: ""
   templates_path: ""
-  default_theme: oscar
+  default_theme: simple
 
 preferences:
   lock: []

+ 16 - 16
tests/robot/test_webapp.py

@@ -10,7 +10,7 @@ url = "http://localhost:11111/"
 def test_index(browser):
     # Visit URL
     browser.visit(url)
-    assert browser.is_text_present('about')
+    assert browser.is_text_present('searxng')
 
 
 def test_404(browser):
@@ -21,54 +21,54 @@ def test_404(browser):
 
 def test_about(browser):
     browser.visit(url)
-    browser.click_link_by_text('about')
+    browser.click_link_by_text('searxng')
     assert browser.is_text_present('Why use it?')
 
 
 def test_preferences(browser):
     browser.visit(url)
-    browser.click_link_by_text('preferences')
+    browser.click_link_by_href('/preferences')
     assert browser.is_text_present('Preferences')
-    assert browser.is_text_present('Cookies')
+    assert browser.is_text_present('COOKIES')
 
     assert browser.is_element_present_by_xpath('//label[@for="checkbox_dummy"]')
 
 
 def test_preferences_engine_select(browser):
     browser.visit(url)
-    browser.click_link_by_text('preferences')
+    browser.click_link_by_href('/preferences')
 
-    assert browser.is_element_present_by_xpath('//a[@href="#tab_engine"]')
-    browser.find_by_xpath('//a[@href="#tab_engine"]').first.click()
+    assert browser.is_element_present_by_xpath('//label[@for="tab-engines"]')
+    browser.find_by_xpath('//label[@for="tab-engines"]').first.click()
 
     assert not browser.find_by_xpath('//input[@id="engine_general_dummy__general"]').first.checked
     browser.find_by_xpath('//label[@for="engine_general_dummy__general"]').first.check()
-    browser.find_by_xpath('//input[@value="save"]').first.click()
+    browser.find_by_xpath('//input[@type="submit"]').first.click()
 
     # waiting for the redirect - without this the test is flaky..
     sleep(1)
 
     browser.visit(url)
-    browser.click_link_by_text('preferences')
-    browser.find_by_xpath('//a[@href="#tab_engine"]').first.click()
+    browser.click_link_by_href('/preferences')
+    browser.find_by_xpath('//label[@for="tab-engines"]').first.click()
 
     assert browser.find_by_xpath('//input[@id="engine_general_dummy__general"]').first.checked
 
 
 def test_preferences_locale(browser):
     browser.visit(url)
-    browser.click_link_by_text('preferences')
+    browser.click_link_by_href('/preferences')
 
-    browser.find_by_xpath('//a[@href="#tab_ui"]').first.click()
-    browser.select('locale', 'hu')
-    browser.find_by_xpath('//input[@value="save"]').first.click()
+    browser.find_by_xpath('//label[@for="tab-ui"]').first.click()
+    browser.select('locale', 'fr')
+    browser.find_by_xpath('//input[@type="submit"]').first.click()
 
     # waiting for the redirect - without this the test is flaky..
     sleep(1)
 
     browser.visit(url)
-    browser.click_link_by_text('beállítások')
-    browser.is_text_present('Beállítások')
+    browser.click_link_by_href('/preferences')
+    browser.is_text_present('Préférences')
 
 
 def test_search(browser):

+ 25 - 10
tests/unit/test_preferences.py

@@ -119,17 +119,32 @@ class TestPreferences(SearxTestCase):
     def test_encode(self):
         from searx.preferences import Preferences
 
-        pref = Preferences(['oscar', 'simple'], ['general'], {}, [])
+        pref = Preferences(['simple'], ['general'], {}, [])
         url_params = (
-            'eJx1VMmO2zAM_Zr6YrTocujJh6JF0QEKzKAz7VVgJNohLIseUU7ivy-VcWy5yyGOTVGP73GLKJNPYjiYgGeT4NB8BS9YOSY'
-            'TUdifMDYM-vmGY1d5CN0EHTYOK88W_PXNkcDBozOjnzoK0vyi4bWnHs2RU4-zvHr_-RF9a-5Cy3GARByy7X7EkKMoBeMp9CuPQ-SzYMx'
-            '8Vr9P1qKI-XJ_p1fOkRJWNCgVM0a-zAttmBJbHkaPSZlNts-_jiuBFgUh2mPztkpHHLBhsRArDHvm356eHh5vATS0Mqagr0ZsZO_V8hT'
-            'B9srt54_v6jewJugqL4Nn_hYSdhxnI-jRpi05GDQCStOT7UGVmJY8ZnltRKyF23SGiLWjqNcygKGkpyeGZIywJfD1gI5AjRTAmBM55Aw'
-            'Q0Tn626lj7jzWo4e5hnEsIlprX6dTgdBRpyRBFKTDgBF8AasVyT4gvSTEoXRpXWRyG3CYQYld65I_V6lboILTMAlZY65_ejRDcHgp0Tv'
-            'EPtGAsqTiBf3m76g7pP9B84mwjPvuUtASRDei1nDF2ix_JXW91UJkXrPh6RAhznVmKyQl7dwJdMJ6bz1QOmgzYlrEzHDMcEUuo44AgS1'
-            'CvkjaOb2Q2AyY5oGDTs_OLXE_c2I5cg9hk3kEJZ0fu4SuktsIA2RhuJwP86AdripThCBeO9uVUejyPGmFSxPrqEYcuWi25zOEXV9tc1m'
-            '_KP1nafYtdfv6Q9hKfWmGm9A_3G635UwiVndLGdFCiLWkONk0xUxGLGGweGWTa2nZYZ0fS1YKlE3Uuw8fPl52E5U8HJYbC7sbjXUsrnT'
-            'XHXRbELfO-1fGSqskiGnMK7B0dV3t8Lq08pbdtYpuVdoKWA2Yjuyah_vHp2rZWjo0zXL8Gw8DTj0='
+            'eJx1Vk1z4zYM_TXxRZNMd7eddg8-pe21nWnvGoiEJEQkofDDtvzrC1qSRdnbQxQTBA'
+            'Hw8eGRCiJ27AnDsUOHHszBgOsSdHjU-Pr7HwfDCkweHCBFVmxHgxGPB7LiU4-eL9Px'
+            'TzABDxZjz_r491___HsI0GJA8Ko__nSIPVo8BspLDx5DMjHU7GqH5zpCsyzXTLVMsj'
+            'mhPzLI8I19d5iX1SFOUkUu4QD6BE6hrpcE8_LPhH6qydWRonjORnItOYqyXHk2Zs1E'
+            'ARojAdB15GTrMA6VJe_Z13VLBsPL1_ccmk5YUajrBRqxNhSbpAaMdU1Rxkqp13iq6x'
+            'Np5LxMI15RwtgUSOWx7iqNtyqI3S4Wej6TrmsWfHx2lcD5r-PSa7NWN8glxPxf5r5c'
+            'ikGrPedw6wZaj1gFbuMZPFaaPKrIAtFceOvJDQSqCNBRJ7BAiGX6TtCEZt0ta2zQd8'
+            'uwY-4MVqOBqYJxDFvucsbyiXLVd4i6kbUuMeqh8ZA_S1yyutlgIQfFYnLykziFH9vW'
+            'kB8Uet5iDKQGCEWBhiSln6q80UDlBDch4psPSy1wNZMnVYR2o13m3ASwreQRnceRi2'
+            'AjSNqOwsqWmbAZxSp_7kcBFnJBeHez4CKpKqieDQgsQREK5fNcBB_H3HrFIUUeJo4s'
+            'Wx7Abekn6HnHpTM10348UMM8hEejdKbY8ncxfCaO-OgVOHn1ZJX2DRSf8px4eqj6y7'
+            'dvv162anXS6LYjC3h1YEt_yx-IQ2lxcMo82gw-NVOHdj28EdHH1GDBFYuaQFIMQsrz'
+            'GZtiyicrqlAYznyhgd2bHFeYHLvJYlHfy_svL7995bOjofp4ef_55fv36zRANbIJA2'
+            'FX0C_v34oE3Es9oHtQIOFFZcilS5WdV_J5YUHRoeAvdCrZ0IDTCuy4sTOvHvMe96rl'
+            'usfxs5rcrLuTv1lmOApYmqip6_bEz4eORSyR2xA8tmWxKnkvP3fM0Hgi4bpstFisWR'
+            'TWV31adSdvSkPc7SkKbtOOTxgny05ALE6pNdL5vhQ5dFQKhYxjbpJZ0ChuSWcN22nh'
+            'rGpPwC32HXSL7Qm8xf6Dzu6XfLfk19dFoZ4li1sRD9fJVVnWYOmiDCe97Uw0RGi4am'
+            'o-JJA7IMMYUO7fIvM6N6ZG4ILlotrPhyjXSbSQqQZj7i2d-2pzGntRIHefJS8viwaK'
+            '-iW6NN9uyTSuTP88CwtKrG-GPaSz6Qn92fwEtGxVk4QMrAhMdev7m6yMBLMOF86iZN'
+            'JIe_xEadXAQuzW8HltyDCkJrmYVqVOI_oU7ijL64W03LLC81jcA8kFuQpDX1R90-b9'
+            '_iZOD2J1t9xfE0BGSJ5PqHA7kUUudYuG7HFjz12C2Mz3zNhD8eQgFa_sdiy3InNWHg'
+            'pV9OCCkWPUZRivRfA2g3DytC3fnlajSaJs4Zihvrwto7eeQxRVR3noCSDzhbZzYKjn'
+            'd-DZy7PtaVp2WgvPBpzCXUL_J1OGex48RVmOXzBU8_N3kqekkefRDzxNK2_Klp9mBJ'
+            'wsUnXyRqq1mScHuYalUY7_AZTCR4s=&q='
         )
         pref.parse_encoded_data(url_params)
         self.assertEqual(

+ 0 - 4
utils/lib_static.sh

@@ -4,10 +4,6 @@
 
 STATIC_BUILD_COMMIT="[build] /static"
 STATIC_BUILT_PATHS=(
-    'searx/static/themes/oscar/css'
-    'searx/static/themes/oscar/js'
-    'searx/static/themes/oscar/src/generated/pygments-logicodev.less'
-    'searx/static/themes/oscar/src/generated/pygments-pointhi.less'
     'searx/static/themes/simple/css'
     'searx/static/themes/simple/js'
     'searx/static/themes/simple/src/generated/pygments.less'