UserSetSettings, UserGetSettings Websocket API commands
This commit is contained in:
parent
1384da4691
commit
efbef25c76
2 changed files with 14 additions and 1 deletions
|
@ -818,13 +818,20 @@ class UiWebsocket(object):
|
|||
self.cmd("notification", ["done", _["Site cloned"] + "<script>window.top.location = '/%s'</script>" % new_address])
|
||||
gevent.spawn(new_site.announce)
|
||||
|
||||
|
||||
def actionSiteSetLimit(self, to, size_limit):
|
||||
self.site.settings["size_limit"] = int(size_limit)
|
||||
self.site.saveSettings()
|
||||
self.response(to, "ok")
|
||||
self.site.download(blind_includes=True)
|
||||
|
||||
def actionUserGetSettings(self, to):
|
||||
settings = self.user.sites[self.site.address].get("settings", {})
|
||||
self.response(to, settings)
|
||||
|
||||
def actionUserSetSettings(self, to, settings):
|
||||
self.user.setSettings(self.site.address, settings)
|
||||
self.response(to, "ok")
|
||||
|
||||
def actionServerUpdate(self, to):
|
||||
self.cmd("updating")
|
||||
sys.modules["main"].update_after_shutdown = True
|
||||
|
|
|
@ -67,6 +67,12 @@ class User(object):
|
|||
self.save()
|
||||
self.log.debug("Deleted site: %s" % address)
|
||||
|
||||
def setSettings(self, address, settings):
|
||||
site_data = self.getSiteData(address)
|
||||
site_data["settings"] = settings
|
||||
self.save()
|
||||
return site_data
|
||||
|
||||
# Get data for a new, unique site
|
||||
# Return: [site_address, bip32_index, {"auth_address": "xxx", "auth_privatekey": "xxx", "privatekey": "xxx"}]
|
||||
def getNewSiteData(self):
|
||||
|
|
Loading…
Reference in a new issue