mirror of https://gitlab.com/bashrc2/epicyon
Only include federated shares if the domains list is not empty
parent
974b97dc87
commit
712f7d9b14
|
@ -38,6 +38,8 @@ def _getLeftColumnShares(baseDir: str,
|
||||||
"""
|
"""
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
||||||
|
# NOTE: this could potentially be slow if the number of federated
|
||||||
|
# shared items is large
|
||||||
sharesJson, lastPage = \
|
sharesJson, lastPage = \
|
||||||
sharesTimelineJson(actor, pageNumber, maxSharesInLeftColumn,
|
sharesTimelineJson(actor, pageNumber, maxSharesInLeftColumn,
|
||||||
baseDir, maxSharesInLeftColumn,
|
baseDir, maxSharesInLeftColumn,
|
||||||
|
|
|
@ -362,30 +362,31 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
|
||||||
if ctr >= maxSharesPerAccount:
|
if ctr >= maxSharesPerAccount:
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
catalogsDir = baseDir + '/cache/catalogs'
|
if sharedItemsFederatedDomains:
|
||||||
if os.path.isdir(catalogsDir):
|
catalogsDir = baseDir + '/cache/catalogs'
|
||||||
for subdir, dirs, files in os.walk(catalogsDir):
|
if os.path.isdir(catalogsDir):
|
||||||
for f in files:
|
for subdir, dirs, files in os.walk(catalogsDir):
|
||||||
if '#' in f:
|
for f in files:
|
||||||
continue
|
if '#' in f:
|
||||||
if not f.endswith('.shares.json'):
|
continue
|
||||||
continue
|
if not f.endswith('.shares.json'):
|
||||||
federatedDomain = f.split('.')[0]
|
continue
|
||||||
if federatedDomain not in sharedItemsFederatedDomains:
|
federatedDomain = f.split('.')[0]
|
||||||
continue
|
if federatedDomain not in sharedItemsFederatedDomains:
|
||||||
sharesFilename = catalogsDir + '/' + f
|
continue
|
||||||
sharesJson = loadJson(sharesFilename)
|
sharesFilename = catalogsDir + '/' + f
|
||||||
if not sharesJson:
|
sharesJson = loadJson(sharesFilename)
|
||||||
continue
|
if not sharesJson:
|
||||||
ctr = 0
|
continue
|
||||||
for itemID, item in sharesJson.items():
|
ctr = 0
|
||||||
# assign owner to the item
|
for itemID, item in sharesJson.items():
|
||||||
item['actor'] = itemID.split('/shareditems/')[0]
|
# assign owner to the item
|
||||||
allSharesJson[str(item['published'])] = item
|
item['actor'] = itemID.split('/shareditems/')[0]
|
||||||
ctr += 1
|
allSharesJson[str(item['published'])] = item
|
||||||
if ctr >= maxSharesPerAccount:
|
ctr += 1
|
||||||
break
|
if ctr >= maxSharesPerAccount:
|
||||||
break
|
break
|
||||||
|
break
|
||||||
# sort the shared items in descending order of publication date
|
# sort the shared items in descending order of publication date
|
||||||
sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True))
|
sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True))
|
||||||
lastPage = False
|
lastPage = False
|
||||||
|
|
Loading…
Reference in New Issue