forked from zaclys/searxng
Merge pull request #665 from return42/default-theme
[mod] switch default theme from oscar to simple
This commit is contained in:
commit
6c38bb5994
|
@ -76,7 +76,7 @@ ui:
|
||||||
# it decreases the privacy, since the browser can records the page titles.
|
# it decreases the privacy, since the browser can records the page titles.
|
||||||
query_in_title: false
|
query_in_title: false
|
||||||
# ui theme
|
# ui theme
|
||||||
default_theme: oscar
|
default_theme: simple
|
||||||
# Default interface locale - leave blank to detect from browser information or
|
# Default interface locale - leave blank to detect from browser information or
|
||||||
# use codes from the 'locales' config section
|
# use codes from the 'locales' config section
|
||||||
default_locale: ""
|
default_locale: ""
|
||||||
|
|
|
@ -177,7 +177,7 @@ SCHEMA = {
|
||||||
'ui': {
|
'ui': {
|
||||||
'static_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'static')),
|
'static_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'static')),
|
||||||
'templates_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'templates')),
|
'templates_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'templates')),
|
||||||
'default_theme': SettingsValue(str, 'oscar'),
|
'default_theme': SettingsValue(str, 'simple'),
|
||||||
'default_locale': SettingsValue(str, ''),
|
'default_locale': SettingsValue(str, ''),
|
||||||
'theme_args': {
|
'theme_args': {
|
||||||
'oscar_style': SettingsValue(OSCAR_STYLE, 'logicodev'),
|
'oscar_style': SettingsValue(OSCAR_STYLE, 'logicodev'),
|
||||||
|
|
|
@ -105,7 +105,7 @@ def get_search_query(
|
||||||
"language": args.lang,
|
"language": args.lang,
|
||||||
"time_range": args.timerange,
|
"time_range": args.timerange,
|
||||||
}
|
}
|
||||||
preferences = searx.preferences.Preferences(['oscar'], engine_categories, searx.engines.engines, [])
|
preferences = searx.preferences.Preferences(['simple'], engine_categories, searx.engines.engines, [])
|
||||||
preferences.key_value_settings['safesearch'].parse(args.safesearch)
|
preferences.key_value_settings['safesearch'].parse(args.safesearch)
|
||||||
|
|
||||||
search_query = searx.webadapter.get_search_query_from_webapp(preferences, form)[0]
|
search_query = searx.webadapter.get_search_query_from_webapp(preferences, form)[0]
|
||||||
|
|
|
@ -27,10 +27,10 @@ server:
|
||||||
ui:
|
ui:
|
||||||
static_path: ""
|
static_path: ""
|
||||||
templates_path: ""
|
templates_path: ""
|
||||||
default_theme: oscar
|
default_theme: simple
|
||||||
default_locale: ""
|
default_locale: ""
|
||||||
theme_args:
|
theme_args:
|
||||||
oscar_style: logicodev
|
simple_style: auto
|
||||||
|
|
||||||
engines:
|
engines:
|
||||||
- name: wikidata
|
- name: wikidata
|
||||||
|
|
|
@ -119,7 +119,7 @@ class TestPreferences(SearxTestCase):
|
||||||
def test_encode(self):
|
def test_encode(self):
|
||||||
from searx.preferences import Preferences
|
from searx.preferences import Preferences
|
||||||
|
|
||||||
pref = Preferences(['oscar'], ['general'], {}, [])
|
pref = Preferences(['oscar', 'simple'], ['general'], {}, [])
|
||||||
url_params = (
|
url_params = (
|
||||||
'eJx1VMmO2zAM_Zr6YrTocujJh6JF0QEKzKAz7VVgJNohLIseUU7ivy-VcWy5yyGOTVGP73GLKJNPYjiYgGeT4NB8BS9YOSY'
|
'eJx1VMmO2zAM_Zr6YrTocujJh6JF0QEKzKAz7VVgJNohLIseUU7ivy-VcWy5yyGOTVGP73GLKJNPYjiYgGeT4NB8BS9YOSY'
|
||||||
'TUdifMDYM-vmGY1d5CN0EHTYOK88W_PXNkcDBozOjnzoK0vyi4bWnHs2RU4-zvHr_-RF9a-5Cy3GARByy7X7EkKMoBeMp9CuPQ-SzYMx'
|
'TUdifMDYM-vmGY1d5CN0EHTYOK88W_PXNkcDBozOjnzoK0vyi4bWnHs2RU4-zvHr_-RF9a-5Cy3GARByy7X7EkKMoBeMp9CuPQ-SzYMx'
|
||||||
|
|
|
@ -30,14 +30,14 @@ class ValidateQueryCase(SearxTestCase):
|
||||||
searx.search.initialize(TEST_ENGINES)
|
searx.search.initialize(TEST_ENGINES)
|
||||||
|
|
||||||
def test_query_private_engine_without_token(self):
|
def test_query_private_engine_without_token(self):
|
||||||
preferences = Preferences(['oscar'], ['general'], engines, [])
|
preferences = Preferences(['simple'], ['general'], engines, [])
|
||||||
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences)
|
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences)
|
||||||
self.assertEqual(len(valid), 0)
|
self.assertEqual(len(valid), 0)
|
||||||
self.assertEqual(len(unknown), 0)
|
self.assertEqual(len(unknown), 0)
|
||||||
self.assertEqual(len(invalid_token), 1)
|
self.assertEqual(len(invalid_token), 1)
|
||||||
|
|
||||||
def test_query_private_engine_with_incorrect_token(self):
|
def test_query_private_engine_with_incorrect_token(self):
|
||||||
preferences_with_tokens = Preferences(['oscar'], ['general'], engines, [])
|
preferences_with_tokens = Preferences(['simple'], ['general'], engines, [])
|
||||||
preferences_with_tokens.parse_dict({'tokens': 'bad-token'})
|
preferences_with_tokens.parse_dict({'tokens': 'bad-token'})
|
||||||
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences_with_tokens)
|
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences_with_tokens)
|
||||||
self.assertEqual(len(valid), 0)
|
self.assertEqual(len(valid), 0)
|
||||||
|
@ -45,7 +45,7 @@ class ValidateQueryCase(SearxTestCase):
|
||||||
self.assertEqual(len(invalid_token), 1)
|
self.assertEqual(len(invalid_token), 1)
|
||||||
|
|
||||||
def test_query_private_engine_with_correct_token(self):
|
def test_query_private_engine_with_correct_token(self):
|
||||||
preferences_with_tokens = Preferences(['oscar'], ['general'], engines, [])
|
preferences_with_tokens = Preferences(['simple'], ['general'], engines, [])
|
||||||
preferences_with_tokens.parse_dict({'tokens': 'my-token'})
|
preferences_with_tokens.parse_dict({'tokens': 'my-token'})
|
||||||
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences_with_tokens)
|
valid, unknown, invalid_token = validate_engineref_list(SEARCHQUERY, preferences_with_tokens)
|
||||||
self.assertEqual(len(valid), 1)
|
self.assertEqual(len(valid), 1)
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ViewsTestCase(SearxTestCase):
|
||||||
def get_current_theme_name_mock(override=None):
|
def get_current_theme_name_mock(override=None):
|
||||||
if override:
|
if override:
|
||||||
return override
|
return override
|
||||||
return 'oscar'
|
return 'simple'
|
||||||
|
|
||||||
self.setattr4test(webapp, 'get_current_theme_name', get_current_theme_name_mock)
|
self.setattr4test(webapp, 'get_current_theme_name', get_current_theme_name_mock)
|
||||||
|
|
||||||
|
@ -83,9 +83,7 @@ class ViewsTestCase(SearxTestCase):
|
||||||
result = self.app.post('/')
|
result = self.app.post('/')
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
b'<div class="text-hide center-block" id="main-logo">'
|
b'<div class="title"><h1>SearXNG</h1></div>',
|
||||||
+ b'<img class="center-block img-responsive" src="/static/themes/oscar/img/searxng.svg"'
|
|
||||||
+ b' alt="searx logo" />SearXNG</div>',
|
|
||||||
result.data,
|
result.data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,7 +100,7 @@ class ViewsTestCase(SearxTestCase):
|
||||||
def test_search_empty_html(self):
|
def test_search_empty_html(self):
|
||||||
result = self.app.post('/search', data={'q': ''})
|
result = self.app.post('/search', data={'q': ''})
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertIn(b'<span class="instance pull-left"><a href="/">SearXNG</a></span>', result.data)
|
self.assertIn(b'<div class="title"><h1>SearXNG</h1></div>', result.data)
|
||||||
|
|
||||||
def test_search_empty_json(self):
|
def test_search_empty_json(self):
|
||||||
result = self.app.post('/search', data={'q': '', 'format': 'json'})
|
result = self.app.post('/search', data={'q': '', 'format': 'json'})
|
||||||
|
@ -120,13 +118,12 @@ class ViewsTestCase(SearxTestCase):
|
||||||
result = self.app.post('/search', data={'q': 'test'})
|
result = self.app.post('/search', data={'q': 'test'})
|
||||||
|
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
b'<h4 class="result_header" id="result-2"><img width="32" height="32" class="favicon"'
|
b'<span class="url_o1"><span class="url_i1">http://second.test.xyz</span></span>',
|
||||||
+ b' src="/static/themes/oscar/img/icons/youtube.png" alt="youtube" /><a href="http://second.test.xyz"'
|
|
||||||
+ b' rel="noreferrer" aria-labelledby="result-2">Second <span class="highlight">Test</span></a></h4>', # noqa
|
|
||||||
result.data,
|
result.data,
|
||||||
)
|
)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
b'<p class="result-content">second <span class="highlight">test</span> content</p>', result.data # noqa
|
b'<p class="content">\n second <span class="highlight">test</span> ',
|
||||||
|
result.data,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_index_json(self):
|
def test_index_json(self):
|
||||||
|
@ -186,9 +183,11 @@ class ViewsTestCase(SearxTestCase):
|
||||||
def test_preferences(self):
|
def test_preferences(self):
|
||||||
result = self.app.get('/preferences')
|
result = self.app.get('/preferences')
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertIn(b'<form method="post" action="/preferences" id="search_form" autocomplete="off">', result.data)
|
self.assertIn(b'<form id="search_form" method="post" action="/preferences"', result.data)
|
||||||
self.assertIn(b'<label class="col-sm-3 col-md-2" for="categories">Default categories</label>', result.data)
|
self.assertIn(
|
||||||
self.assertIn(b'<label class="col-sm-3 col-md-2" for="locale">Interface language</label>', result.data)
|
b'<input type="checkbox" id="checkbox_general" name="category_general" checked="checked"/>', result.data
|
||||||
|
)
|
||||||
|
self.assertIn(b'<legend>Interface language</legend>', result.data)
|
||||||
|
|
||||||
def test_browser_locale(self):
|
def test_browser_locale(self):
|
||||||
result = self.app.get('/preferences', headers={'Accept-Language': 'zh-tw;q=0.8'})
|
result = self.app.get('/preferences', headers={'Accept-Language': 'zh-tw;q=0.8'})
|
||||||
|
|
Loading…
Reference in New Issue