From 3294f629b09f1977e3e74b4f16441704f14a2b06 Mon Sep 17 00:00:00 2001 From: HelloZeroNet Date: Wed, 27 Apr 2016 11:14:15 +0200 Subject: [PATCH] Rev1277, Fix sidebar site size display --- plugins/Sidebar/SidebarPlugin.py | 8 ++++++-- src/Config.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/Sidebar/SidebarPlugin.py b/plugins/Sidebar/SidebarPlugin.py index cb68e5c8..a57e0406 100644 --- a/plugins/Sidebar/SidebarPlugin.py +++ b/plugins/Sidebar/SidebarPlugin.py @@ -126,14 +126,18 @@ class UiWebsocketPlugin(object): # Collect stats size_filetypes = {} size_total = 0 - for content in site.content_manager.contents.values(): + for key, content in site.content_manager.contents.iteritems(): if "files" not in content: continue for file_name, file_details in content["files"].items(): size_total += file_details["size"] ext = file_name.split(".")[-1] size_filetypes[ext] = size_filetypes.get(ext, 0) + file_details["size"] - size_other = size_total + + # The missing difference is content.json sizes + if "json" in size_filetypes: + size_filetypes["json"] += site.settings["size"] - size_total + size_total = size_other = site.settings["size"] # Bar for extension, color in extensions: diff --git a/src/Config.py b/src/Config.py index ae6b146b..565e4b83 100644 --- a/src/Config.py +++ b/src/Config.py @@ -8,7 +8,7 @@ class Config(object): def __init__(self, argv): self.version = "0.3.7" - self.rev = 1276 + self.rev = 1277 self.argv = argv self.action = None self.config_file = "zeronet.conf"