Fix signing&publishing file owned by ZeroID/other provider user. Fixes my old PR lol

This commit is contained in:
Ivanq 2018-05-26 12:15:23 +03:00
parent e874730679
commit fac3721dfd
2 changed files with 34 additions and 6 deletions

View file

@ -716,7 +716,7 @@ window.initScrollable = function () {
inner_path: inner_path
}, function(res) {
var ref;
if (_this.wrapper.site_info.privatekey || (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
if (_this.wrapper.site_info.privatekey) {
return _this.wrapper.ws.cmd("siteSign", {
privatekey: "stored",
inner_path: inner_path,
@ -726,6 +726,16 @@ window.initScrollable = function () {
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
}
});
} else if (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0) {
return _this.wrapper.ws.cmd("siteSign", {
privatekey: null,
inner_path: inner_path,
update_changed_files: true
}, function(res) {
if (res === "ok") {
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed!", 5000);
}
});
} else {
return _this.wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return _this.wrapper.ws.cmd("siteSign", {
@ -784,7 +794,7 @@ window.initScrollable = function () {
inner_path: inner_path
}, function(res) {
var ref;
if (_this.wrapper.site_info.privatekey || (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0)) {
if (_this.wrapper.site_info.privatekey) {
return _this.wrapper.ws.cmd("sitePublish", {
privatekey: "stored",
inner_path: inner_path,
@ -794,6 +804,16 @@ window.initScrollable = function () {
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
}
});
} else if (ref = _this.wrapper.site_info.auth_address, indexOf.call(res.signers, ref) >= 0) {
return _this.wrapper.ws.cmd("sitePublish", {
privatekey: null,
inner_path: inner_path,
sign: true
}, function(res) {
if (res === "ok") {
return _this.wrapper.notifications.add("sign", "done", inner_path + " Signed and published!", 5000);
}
});
} else {
return _this.wrapper.displayPrompt("Enter your private key:", "password", "Sign", "", function(privatekey) {
return _this.wrapper.ws.cmd("sitePublish", {