Rev957, Sidebar displays onion peers in graph, Sidebar display bad file retry number, Sidebar site Update/Pause/Delete, Ratelimit sidebar update, Encoded typo, Fix onion findHashId, More retry for bad files, Log file path errors, Testcase for self findhashIds, Testcase for Tor findHashId, Better Tor version parse, UiWebsocket callback on update/pause/resume/delete, Skip invalid postMessage messages

This commit is contained in:
HelloZeroNet 2016-03-09 00:48:57 +01:00
parent ea3257dc09
commit e891a10e54
18 changed files with 204 additions and 36 deletions

View file

@ -86,7 +86,6 @@
}).call(this);
/* ---- plugins/Sidebar/media/Scrollable.js ---- */
@ -316,7 +315,11 @@ window.initScrollable = function () {
};
Sidebar.prototype.setSiteInfo = function(site_info) {
this.updateHtmlTag();
RateLimit(1000, (function(_this) {
return function() {
return _this.updateHtmlTag();
};
})(this));
return this.displayGlobe();
};
@ -341,7 +344,7 @@ window.initScrollable = function () {
_this.log("Patching content");
morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>', {
onBeforeMorphEl: function(from_el, to_el) {
if (from_el.className === "globe") {
if (from_el.className === "globe" || from_el.className.indexOf("noupdate") >= 0) {
return false;
} else {
return true;
@ -449,6 +452,41 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-update").off("click").on("click", (function(_this) {
return function() {
_this.tag.find("#button-update").addClass("loading");
wrapper.ws.cmd("siteUpdate", wrapper.site_info.address, function() {
wrapper.notifications.add("done-updated", "done", "Site updated!", 5000);
return _this.tag.find("#button-update").removeClass("loading");
});
return false;
};
})(this));
this.tag.find("#button-pause").off("click").on("click", (function(_this) {
return function() {
_this.tag.find("#button-pause").addClass("hidden");
wrapper.ws.cmd("sitePause", wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-resume").off("click").on("click", (function(_this) {
return function() {
_this.tag.find("#button-resume").addClass("hidden");
wrapper.ws.cmd("siteResume", wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-delete").off("click").on("click", (function(_this) {
return function() {
wrapper.displayConfirm("Are you sure?", "Delete this site", function() {
_this.tag.find("#button-delete").addClass("loading");
return wrapper.ws.cmd("siteDelete", wrapper.site_info.address, function() {
return document.location = $(".fixbutton-bg").attr("href");
});
});
return false;
};
})(this));
this.tag.find("#checkbox-owned").off("click").on("click", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);