diff --git a/src/Ui/UiWebsocket.py b/src/Ui/UiWebsocket.py index 4f49b73c..10f2422f 100644 --- a/src/Ui/UiWebsocket.py +++ b/src/Ui/UiWebsocket.py @@ -968,15 +968,17 @@ class UiWebsocket(object): else: self.response(to, {"error": "Unknown site: %s" % address}) - def cbSiteClone(self, to, address, root_inner_path="", target_address=None): + def cbSiteClone(self, to, address, root_inner_path="", target_address=None, redirect=True): self.cmd("notification", ["info", _["Cloning site..."]]) site = self.server.sites.get(address) + response = {} if target_address: target_site = self.server.sites.get(target_address) privatekey = self.user.getSiteData(target_site.address).get("privatekey") site.clone(target_address, privatekey, root_inner_path=root_inner_path) self.cmd("notification", ["done", _["Site source code upgraded!"]]) site.publish() + response = {"address": target_address} else: # Generate a new site from user's bip32 seed new_address, new_address_index, new_site_data = self.user.getNewSiteData() @@ -984,11 +986,14 @@ class UiWebsocket(object): new_site.settings["own"] = True new_site.saveSettings() self.cmd("notification", ["done", _["Site cloned"]]) - self.cmd("redirect", "/%s" % new_address) + if redirect : + self.cmd("redirect", "/%s" % new_address) gevent.spawn(new_site.announce) + response = {"address": new_address} + self.response(to, response) return "ok" - def actionSiteClone(self, to, address, root_inner_path="", target_address=None): + def actionSiteClone(self, to, address, root_inner_path="", target_address=None, redirect=True): if not SiteManager.site_manager.isAddress(address): self.response(to, {"error": "Not a site: %s" % address}) return @@ -1006,12 +1011,12 @@ class UiWebsocket(object): return {"error": "Site still in sync"} if "ADMIN" in self.getPermissions(to): - self.cbSiteClone(to, address, root_inner_path, target_address) + self.cbSiteClone(to, address, root_inner_path, target_address, redirect) else: self.cmd( "confirm", [_["Clone site %s?"] % address, _["Clone"]], - lambda res: self.cbSiteClone(to, address, root_inner_path, target_address) + lambda res: self.cbSiteClone(to, address, root_inner_path, target_address, redirect) ) def actionSiteSetLimit(self, to, size_limit):