mirror of https://github.com/searxng/searxng.git
[fix] save unknown preferences parameters to cookies
Without this courgette color selector can not work
This commit is contained in:
parent
5dd2340bc6
commit
237d251d14
|
@ -229,6 +229,7 @@ class Preferences(object):
|
||||||
|
|
||||||
self.engines = EnginesSetting('engines', choices=engines)
|
self.engines = EnginesSetting('engines', choices=engines)
|
||||||
self.plugins = PluginsSetting('plugins', choices=plugins)
|
self.plugins = PluginsSetting('plugins', choices=plugins)
|
||||||
|
self.unknown_params = {}
|
||||||
|
|
||||||
def parse_cookies(self, input_data):
|
def parse_cookies(self, input_data):
|
||||||
for user_setting_name, user_setting in input_data.iteritems():
|
for user_setting_name, user_setting in input_data.iteritems():
|
||||||
|
@ -254,6 +255,8 @@ class Preferences(object):
|
||||||
enabled_categories.append(user_setting_name[len('category_'):])
|
enabled_categories.append(user_setting_name[len('category_'):])
|
||||||
elif user_setting_name.startswith('plugin_'):
|
elif user_setting_name.startswith('plugin_'):
|
||||||
disabled_plugins.append(user_setting_name)
|
disabled_plugins.append(user_setting_name)
|
||||||
|
else:
|
||||||
|
self.unknown_params[user_setting_name] = user_setting
|
||||||
self.key_value_settings['categories'].parse_form(enabled_categories)
|
self.key_value_settings['categories'].parse_form(enabled_categories)
|
||||||
self.engines.parse_form(disabled_engines)
|
self.engines.parse_form(disabled_engines)
|
||||||
self.plugins.parse_form(disabled_plugins)
|
self.plugins.parse_form(disabled_plugins)
|
||||||
|
@ -268,4 +271,6 @@ class Preferences(object):
|
||||||
user_setting.save(user_setting_name, resp)
|
user_setting.save(user_setting_name, resp)
|
||||||
self.engines.save(resp)
|
self.engines.save(resp)
|
||||||
self.plugins.save(resp)
|
self.plugins.save(resp)
|
||||||
|
for k, v in self.unknown_params.items():
|
||||||
|
resp.set_cookie(k, v, max_age=COOKIE_MAX_AGE)
|
||||||
return resp
|
return resp
|
||||||
|
|
Loading…
Reference in New Issue