Use websocket connection instead of fileserver to execute commands from CLI

This commit is contained in:
shortcutme 2018-04-03 14:49:40 +02:00
parent 09f1ad0625
commit 82e6bc5d31
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
3 changed files with 29 additions and 46 deletions

View file

@ -419,26 +419,6 @@ class FileRequest(object):
peer.hashfield.replaceFromString(params["hashfield_raw"])
self.response({"ok": "Updated"})
def actionSiteReload(self, params):
if self.connection.ip not in config.ip_local and self.connection.ip != config.ip_external:
self.response({"error": "Only local host allowed"})
site = self.sites.get(params["site"])
site.content_manager.loadContent(params["inner_path"], add_bad_files=False)
site.storage.verifyFiles(quick_check=True)
site.updateWebsocket()
self.response({"ok": "Reloaded"})
def actionSitePublish(self, params):
if self.connection.ip not in config.ip_local and self.connection.ip != config.ip_external:
self.response({"error": "Only local host allowed"})
site = self.sites.get(params["site"])
num = site.publish(limit=8, inner_path=params.get("inner_path", "content.json"), diffs=params.get("diffs", {}))
self.response({"ok": "Successfuly published to %s peers" % num})
# Send a simple Pong! answer
def actionPing(self, params):
self.response("Pong!")