mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
Load the list of icons only once
This commit is contained in:
parent
53a9af39ef
commit
e71b665fd5
@ -72,6 +72,13 @@ babel = Babel(app)
|
|||||||
favicons = ['wikipedia', 'youtube', 'vimeo', 'dailymotion', 'soundcloud',
|
favicons = ['wikipedia', 'youtube', 'vimeo', 'dailymotion', 'soundcloud',
|
||||||
'twitter', 'stackoverflow', 'github', 'deviantart']
|
'twitter', 'stackoverflow', 'github', 'deviantart']
|
||||||
|
|
||||||
|
global_favicons = []
|
||||||
|
for indice,theme in enumerate(themes):
|
||||||
|
global_favicons.append([])
|
||||||
|
theme_img_path = searx_dir+"/static/"+theme+"/img/"
|
||||||
|
for (dirpath, dirnames, filenames) in os.walk(theme_img_path):
|
||||||
|
global_favicons[indice].extend(filenames)
|
||||||
|
|
||||||
cookie_max_age = 60 * 60 * 24 * 365 * 23 # 23 years
|
cookie_max_age = 60 * 60 * 24 * 365 * 23 # 23 years
|
||||||
|
|
||||||
|
|
||||||
@ -292,11 +299,6 @@ def index():
|
|||||||
if engine in favicons:
|
if engine in favicons:
|
||||||
result['favicon'] = engine
|
result['favicon'] = engine
|
||||||
|
|
||||||
mypath = searx_dir+"/static/"+get_current_theme_name()+"/img/"
|
|
||||||
favs=[]
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk(mypath):
|
|
||||||
favs.extend(filenames)
|
|
||||||
|
|
||||||
# TODO, check if timezone is calculated right
|
# TODO, check if timezone is calculated right
|
||||||
if 'publishedDate' in result:
|
if 'publishedDate' in result:
|
||||||
result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
|
result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
|
||||||
@ -350,7 +352,7 @@ def index():
|
|||||||
answers=search.answers,
|
answers=search.answers,
|
||||||
infoboxes=search.infoboxes,
|
infoboxes=search.infoboxes,
|
||||||
theme=get_current_theme_name(),
|
theme=get_current_theme_name(),
|
||||||
favicons=favs
|
favicons=global_favicons[themes.index(get_current_theme_name())]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user