diff --git a/plugins/Sidebar/SidebarPlugin.py b/plugins/Sidebar/SidebarPlugin.py index 72a003f3..03dba3f8 100644 --- a/plugins/Sidebar/SidebarPlugin.py +++ b/plugins/Sidebar/SidebarPlugin.py @@ -4,6 +4,7 @@ import cgi import sys import math import time +import json try: import cStringIO as StringIO except: @@ -290,9 +291,18 @@ class UiWebsocketPlugin(object): def sidebarRenderIdentity(self, body, site): auth_address = self.user.getAuthAddress(self.site.address) + rules = self.site.content_manager.getRules("data/users/%s/content.json" % auth_address) + if rules and rules.get("max_size"): + quota = rules["max_size"] / 1024 + content = site.content_manager.contents["data/users/%s/content.json" % auth_address] + used = len(json.dumps(content)) + sum([file["size"] for file in content["files"].values()]) + used = used / 1024 + else: + quota = used = 0 + body.append("""
  • - + {auth_address} Change
  • diff --git a/plugins/Sidebar/media-globe/all.js b/plugins/Sidebar/media-globe/all.js index cbf68e8c..6d41940f 100644 --- a/plugins/Sidebar/media-globe/all.js +++ b/plugins/Sidebar/media-globe/all.js @@ -1343,4 +1343,4 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b}; THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1}; THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;bd.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight; -f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}}; +f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}}; \ No newline at end of file diff --git a/plugins/Sidebar/media-globe/globe.js b/plugins/Sidebar/media-globe/globe.js index ba736185..eab71f9e 100644 --- a/plugins/Sidebar/media-globe/globe.js +++ b/plugins/Sidebar/media-globe/globe.js @@ -432,4 +432,4 @@ DAT.Globe = function(container, opts) { return this; -}; \ No newline at end of file +}; diff --git a/plugins/Sidebar/media/Sidebar.coffee b/plugins/Sidebar/media/Sidebar.coffee index 0c732fae..45b4c3cf 100644 --- a/plugins/Sidebar/media/Sidebar.coffee +++ b/plugins/Sidebar/media/Sidebar.coffee @@ -315,7 +315,7 @@ class Sidebar extends Class # Publish content.json @tag.find("#button-publish").off("click").on "click", => - inner_path = @tag.find("#select-contents").val() + inner_path = @tag.find("#input-contents").val() @tag.find("#button-publish").addClass "loading" wrapper.ws.cmd "sitePublish", {"inner_path": inner_path, "sign": false}, => @tag.find("#button-publish").removeClass "loading" @@ -360,6 +360,7 @@ class Sidebar extends Class @globe.createPoints() @globe.animate() catch e + console.log "WebGL error", e @tag.find(".globe").addClass("error").text("WebGL not supported") @tag.find(".globe").removeClass("loading") diff --git a/plugins/Sidebar/media/all.js b/plugins/Sidebar/media/all.js index 42db3a97..b731638b 100644 --- a/plugins/Sidebar/media/all.js +++ b/plugins/Sidebar/media/all.js @@ -551,7 +551,7 @@ window.initScrollable = function () { this.tag.find("#button-publish").off("click").on("click", (function(_this) { return function() { var inner_path; - inner_path = _this.tag.find("#select-contents").val(); + inner_path = _this.tag.find("#input-contents").val(); _this.tag.find("#button-publish").addClass("loading"); return wrapper.ws.cmd("sitePublish", { "inner_path": inner_path, @@ -620,6 +620,7 @@ window.initScrollable = function () { _this.globe.animate(); } catch (_error) { e = _error; + console.log("WebGL error", e); _this.tag.find(".globe").addClass("error").text("WebGL not supported"); } } diff --git a/src/Config.py b/src/Config.py index a825e191..c1e2f5eb 100644 --- a/src/Config.py +++ b/src/Config.py @@ -8,7 +8,7 @@ class Config(object): def __init__(self, argv): self.version = "0.3.6" - self.rev = 957 + self.rev = 966 self.argv = argv self.action = None self.config_file = "zeronet.conf" diff --git a/src/Site/Site.py b/src/Site/Site.py index 4512b2e5..57089d10 100644 --- a/src/Site/Site.py +++ b/src/Site/Site.py @@ -404,8 +404,8 @@ class Site(object): inner_path, len(published), len(passive_peers) )) - for peer in passive_peers[0:3]: - gevent.spawn(self.publisher, inner_path, passive_peers, published, limit=limit+3) + for peer in passive_peers[0:limit]: + gevent.spawn(self.publisher, inner_path, passive_peers, published, limit=limit*2) # Send my hashfield to every connected peer if changed gevent.spawn(self.sendMyHashfield, 100) diff --git a/src/Site/SiteManager.py b/src/Site/SiteManager.py index e3f3af2c..6a084a77 100644 --- a/src/Site/SiteManager.py +++ b/src/Site/SiteManager.py @@ -54,6 +54,11 @@ class SiteManager(object): from Site import Site site = self.get(address) if not site: # Site not exist yet + # Try to find site with differect case + for recover_address, recover_site in self.sites.items(): + if recover_address.lower() == address.lower(): + return recover_site + if not self.isAddress(address): return False # Not address: %s % address logging.debug("Added new site: %s" % address)