Allow to also list connecting site with siteList API command

This commit is contained in:
shortcutme 2018-10-15 12:58:14 +02:00
parent 046b95d5b1
commit 2518867d50
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -275,7 +275,7 @@ class UiWebsocket(object):
# Format site info
def formatSiteInfo(self, site, create_user=True):
content = site.content_manager.contents.get("content.json")
content = site.content_manager.contents.get("content.json", {})
if content: # Remove unnecessary data transfer
content = content.copy()
content["files"] = len(content.get("files", {}))
@ -844,12 +844,12 @@ class UiWebsocket(object):
self.response(to, "ok")
# List all site info
def actionSiteList(self, to):
def actionSiteList(self, to, connecting_sites=False):
ret = []
SiteManager.site_manager.load() # Reload sites
for site in self.server.sites.values():
if not site.content_manager.contents.get("content.json"):
continue # Broken site
if not site.content_manager.contents.get("content.json") and not connecting_sites:
continue # Incomplete site
ret.append(self.formatSiteInfo(site, create_user=False)) # Dont generate the auth_address on listing
self.response(to, ret)