From 2de3c9a54463f8200189bd3ebefaaa42d17c9431 Mon Sep 17 00:00:00 2001 From: Vadim Ushakov Date: Tue, 17 Mar 2020 23:09:40 +0700 Subject: [PATCH] Allow opening the sidebar while content.json is not loaded If one opens the sidebar of a site not being downloaded yet, the following error occurs: ``` Internal error: KeyError('content.json',): 'content.json' UiWebsocket.py line 79 > 235 > Sidebar/SidebarPlugin.py line 527 > 120 > ContentDbDict.py line 59 ``` Also, the sidebar is not visible. This fixes the both issues. For sites without peers, the only way to delete the site was to navigate to ZeroHellow, scroll the left panel to "Connecting sites", and delete the site from the list. Now those sites can be deleted from the sidebar. --- plugins/Sidebar/SidebarPlugin.py | 2 +- plugins/Sidebar/media/Sidebar.css | 2 +- plugins/Sidebar/media/all.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Sidebar/SidebarPlugin.py b/plugins/Sidebar/SidebarPlugin.py index e6087adf..ab2e9683 100644 --- a/plugins/Sidebar/SidebarPlugin.py +++ b/plugins/Sidebar/SidebarPlugin.py @@ -117,7 +117,7 @@ class UiWebsocketPlugin(object): peer_ips = [peer.key for peer in site.getConnectablePeers(20, allow_private=False)] peer_ips.sort(key=lambda peer_ip: ".onion:" in peer_ip) copy_link = "http://127.0.0.1:43110/%s/?zeronet_peers=%s" % ( - site.content_manager.contents["content.json"].get("domain", site.address), + site.content_manager.contents.get("content.json", {}).get("domain", site.address), ",".join(peer_ips) ) diff --git a/plugins/Sidebar/media/Sidebar.css b/plugins/Sidebar/media/Sidebar.css index cf56f061..2468eb0d 100644 --- a/plugins/Sidebar/media/Sidebar.css +++ b/plugins/Sidebar/media/Sidebar.css @@ -18,7 +18,7 @@ .sidebar .link-right:active { background-color: #444 } /* SIDEBAR */ -.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; } +.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; z-index: 2; } .sidebar { background-color: #212121; position: fixed; backface-visibility: hidden; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/ .sidebar .content { margin: 30px; font-family: "Segoe UI Light", "Segoe UI", "Helvetica Neue"; color: white; width: 375px; height: 300px; font-weight: 200; transition: all 1s; opacity: 0 } .sidebar-container.loaded .content { opacity: 1; transform: none } diff --git a/plugins/Sidebar/media/all.css b/plugins/Sidebar/media/all.css index 4921d57f..741169f3 100644 --- a/plugins/Sidebar/media/all.css +++ b/plugins/Sidebar/media/all.css @@ -130,7 +130,7 @@ .sidebar .link-right:active { background-color: #444 } /* SIDEBAR */ -.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; } +.sidebar-container { width: 100%; height: 100%; overflow: hidden; position: fixed; z-index: 2; } .sidebar { background-color: #212121; position: fixed; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; -ms-backface-visibility: hidden; backface-visibility: hidden ; right: -1200px; height: 100%; width: 1200px; } /*box-shadow: inset 0px 0px 10px #000*/ .sidebar .content { margin: 30px; font-family: "Segoe UI Light", "Segoe UI", "Helvetica Neue"; color: white; width: 375px; height: 300px; font-weight: 200; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s; -ms-transition: all 1s; transition: all 1s ; opacity: 0 } .sidebar-container.loaded .content { opacity: 1; -webkit-transform: none ; -moz-transform: none ; -o-transform: none ; -ms-transform: none ; transform: none }