Update signed file using the sidebar
This commit is contained in:
parent
d2d2967f11
commit
fc9c604b66
2 changed files with 13 additions and 6 deletions
|
@ -318,13 +318,13 @@ class Sidebar extends Class
|
||||||
|
|
||||||
if wrapper.site_info.privatekey
|
if wrapper.site_info.privatekey
|
||||||
# Privatekey stored in users.json
|
# Privatekey stored in users.json
|
||||||
wrapper.ws.cmd "siteSign", ["stored", inner_path], (res) =>
|
wrapper.ws.cmd "siteSign", {privatekey: "stored", inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||||
|
|
||||||
else
|
else
|
||||||
# Ask the user for privatekey
|
# Ask the user for privatekey
|
||||||
wrapper.displayPrompt "Enter your private key:", "password", "Sign", (privatekey) => # Prompt the private key
|
wrapper.displayPrompt "Enter your private key:", "password", "Sign", (privatekey) => # Prompt the private key
|
||||||
wrapper.ws.cmd "siteSign", [privatekey, inner_path], (res) =>
|
wrapper.ws.cmd "siteSign", {privatekey: privatekey, inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||||
if res == "ok"
|
if res == "ok"
|
||||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ class UiWebsocket(object):
|
||||||
self.response(to, ret)
|
self.response(to, ret)
|
||||||
|
|
||||||
# Sign content.json
|
# Sign content.json
|
||||||
def actionSiteSign(self, to, privatekey=None, inner_path="content.json", response_ok=True):
|
def actionSiteSign(self, to, privatekey=None, inner_path="content.json", response_ok=True, update_changed_files=False):
|
||||||
self.log.debug("Signing: %s" % inner_path)
|
self.log.debug("Signing: %s" % inner_path)
|
||||||
site = self.site
|
site = self.site
|
||||||
extend = {} # Extended info for signing
|
extend = {} # Extended info for signing
|
||||||
|
@ -293,8 +293,10 @@ class UiWebsocket(object):
|
||||||
privatekey = self.user.getAuthPrivatekey(self.site.address)
|
privatekey = self.user.getAuthPrivatekey(self.site.address)
|
||||||
|
|
||||||
# Signing
|
# Signing
|
||||||
site.content_manager.loadContent(inner_path, add_bad_files=False, force=True) # Reload content.json, ignore errors to make it up-to-date
|
# Reload content.json, ignore errors to make it up-to-date
|
||||||
signed = site.content_manager.sign(inner_path, privatekey, extend=extend) # Sign using private key sent by user
|
site.content_manager.loadContent(inner_path, add_bad_files=False, force=True)
|
||||||
|
# Sign using private key sent by user
|
||||||
|
signed = site.content_manager.sign(inner_path, privatekey, extend=extend, update_changed_files=update_changed_files)
|
||||||
if not signed:
|
if not signed:
|
||||||
self.cmd("notification", ["error", "Content sign failed: invalid private key."])
|
self.cmd("notification", ["error", "Content sign failed: invalid private key."])
|
||||||
self.response(to, {"error": "Site sign failed"})
|
self.response(to, {"error": "Site sign failed"})
|
||||||
|
@ -302,6 +304,9 @@ class UiWebsocket(object):
|
||||||
|
|
||||||
site.content_manager.loadContent(inner_path, add_bad_files=False) # Load new content.json, ignore errors
|
site.content_manager.loadContent(inner_path, add_bad_files=False) # Load new content.json, ignore errors
|
||||||
|
|
||||||
|
if update_changed_files:
|
||||||
|
self.site.updateWebsocket(file_done=inner_path)
|
||||||
|
|
||||||
if response_ok:
|
if response_ok:
|
||||||
self.response(to, "ok")
|
self.response(to, "ok")
|
||||||
|
|
||||||
|
@ -485,7 +490,9 @@ class UiWebsocket(object):
|
||||||
# Display confirmation of change
|
# Display confirmation of change
|
||||||
cert_current = self.user.certs[domain]
|
cert_current = self.user.certs[domain]
|
||||||
body = "You current certificate: <b>%s/%s@%s</b>" % (cert_current["auth_type"], cert_current["auth_user_name"], domain)
|
body = "You current certificate: <b>%s/%s@%s</b>" % (cert_current["auth_type"], cert_current["auth_user_name"], domain)
|
||||||
self.cmd("confirm", [body, "Change it to %s/%s@%s" % (auth_type, auth_user_name, domain)],
|
self.cmd(
|
||||||
|
"confirm",
|
||||||
|
[body, "Change it to %s/%s@%s" % (auth_type, auth_user_name, domain)],
|
||||||
lambda (res): self.cbCertAddConfirm(to, domain, auth_type, auth_user_name, cert)
|
lambda (res): self.cbCertAddConfirm(to, domain, auth_type, auth_user_name, cert)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue