Pass key
through to _get_settings (rest_api.py)
This commit is contained in:
parent
a3a75f3480
commit
807021ecc4
1 changed files with 2 additions and 3 deletions
|
@ -33,8 +33,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(data.encode("utf8"))
|
self.wfile.write(data.encode("utf8"))
|
||||||
|
|
||||||
def _get_settings(self):
|
def _get_settings(self, key):
|
||||||
key = params.get("key", None)
|
|
||||||
key_setting = _bot.get_setting("api-key-%s" % key, {})
|
key_setting = _bot.get_setting("api-key-%s" % key, {})
|
||||||
minify = _bot.get_setting("rest-api-minify", False)
|
minify = _bot.get_setting("rest-api-minify", False)
|
||||||
return [key_setting, minify]
|
return [key_setting, minify]
|
||||||
|
@ -54,7 +53,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||||
hook = hooks[0]
|
hook = hooks[0]
|
||||||
authenticated = hook.get_kwarg("authenticated", True)
|
authenticated = hook.get_kwarg("authenticated", True)
|
||||||
key = params.get("key", None)
|
key = params.get("key", None)
|
||||||
key_setting, minify = _bot.trigger(self._get_settings)
|
key_setting, minify = _bot.trigger(lambda: self._get_settings(key))
|
||||||
permissions = key_setting.get("permissions", [])
|
permissions = key_setting.get("permissions", [])
|
||||||
|
|
||||||
if key_setting:
|
if key_setting:
|
||||||
|
|
Loading…
Reference in a new issue