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
|
||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
||||
# NOTE: this could potentially be slow if the number of federated
|
||||
# shared items is large
|
||||
sharesJson, lastPage = \
|
||||
sharesTimelineJson(actor, pageNumber, maxSharesInLeftColumn,
|
||||
baseDir, maxSharesInLeftColumn,
|
||||
|
|
|
@ -362,30 +362,31 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
|
|||
if ctr >= maxSharesPerAccount:
|
||||
break
|
||||
break
|
||||
catalogsDir = baseDir + '/cache/catalogs'
|
||||
if os.path.isdir(catalogsDir):
|
||||
for subdir, dirs, files in os.walk(catalogsDir):
|
||||
for f in files:
|
||||
if '#' in f:
|
||||
continue
|
||||
if not f.endswith('.shares.json'):
|
||||
continue
|
||||
federatedDomain = f.split('.')[0]
|
||||
if federatedDomain not in sharedItemsFederatedDomains:
|
||||
continue
|
||||
sharesFilename = catalogsDir + '/' + f
|
||||
sharesJson = loadJson(sharesFilename)
|
||||
if not sharesJson:
|
||||
continue
|
||||
ctr = 0
|
||||
for itemID, item in sharesJson.items():
|
||||
# assign owner to the item
|
||||
item['actor'] = itemID.split('/shareditems/')[0]
|
||||
allSharesJson[str(item['published'])] = item
|
||||
ctr += 1
|
||||
if ctr >= maxSharesPerAccount:
|
||||
break
|
||||
break
|
||||
if sharedItemsFederatedDomains:
|
||||
catalogsDir = baseDir + '/cache/catalogs'
|
||||
if os.path.isdir(catalogsDir):
|
||||
for subdir, dirs, files in os.walk(catalogsDir):
|
||||
for f in files:
|
||||
if '#' in f:
|
||||
continue
|
||||
if not f.endswith('.shares.json'):
|
||||
continue
|
||||
federatedDomain = f.split('.')[0]
|
||||
if federatedDomain not in sharedItemsFederatedDomains:
|
||||
continue
|
||||
sharesFilename = catalogsDir + '/' + f
|
||||
sharesJson = loadJson(sharesFilename)
|
||||
if not sharesJson:
|
||||
continue
|
||||
ctr = 0
|
||||
for itemID, item in sharesJson.items():
|
||||
# assign owner to the item
|
||||
item['actor'] = itemID.split('/shareditems/')[0]
|
||||
allSharesJson[str(item['published'])] = item
|
||||
ctr += 1
|
||||
if ctr >= maxSharesPerAccount:
|
||||
break
|
||||
break
|
||||
# sort the shared items in descending order of publication date
|
||||
sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True))
|
||||
lastPage = False
|
||||
|
|
Loading…
Reference in New Issue