New API command: fileNeed to request optional file

This commit is contained in:
shortcutme 2017-08-09 14:20:49 +02:00
parent 24982aee42
commit d093764731
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -605,6 +605,14 @@ class UiWebsocket(object):
body = base64.b64encode(body)
return self.response(to, body)
def actionFileNeed(self, to, inner_path, timeout=300):
try:
with gevent.Timeout(timeout):
self.site.needFile(inner_path, priority=6)
except Exception, err:
return self.response(to, {"error": str(err)})
return self.response(to, "ok")
def actionFileRules(self, to, inner_path):
rules = self.site.content_manager.getRules(inner_path)
if inner_path.endswith("content.json") and rules: