forked from Icycoide/searxng
[enh] per user plugin switch
This commit is contained in:
parent
00cc4dcbf4
commit
cae22bfc76
2 changed files with 14 additions and 2 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue