diff options
author | Adam Tauber <asciimoo@gmail.com> | 2015-03-10 20:44:02 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2015-03-10 20:44:02 +0100 |
commit | cae22bfc7609d00f987e679cf6d048873d268d84 (patch) | |
tree | 4ff49f22ffe5cd52fdb11af5cc254eb9e031ce75 /searx/webapp.py | |
parent | 00cc4dcbf44d9ecea89befb08cae4ee5561c4247 (diff) | |
download | searxng-cae22bfc7609d00f987e679cf6d048873d268d84.tar.gz searxng-cae22bfc7609d00f987e679cf6d048873d268d84.zip |
[enh] per user plugin switch
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index f5d779f15..78c0c71f1 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -305,6 +305,18 @@ def render(template_name, override_theme=None, **kwargs): '{}/{}'.format(kwargs['theme'], template_name), **kwargs) +@app.before_request +def pre_request(): + + request.user_plugins = [] + allowed_plugins = request.cookies.get('allowed_plugins', '').split(',') + disabled_plugins = request.cookies.get('disabled_plugins', '').split(',') + for plugin in plugins: + if ((plugin.default_on and plugin.name not in disabled_plugins) + or plugin.name in allowed_plugins): + request.user_plugins.append(plugin) + + @app.route('/search', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST']) def index(): |