Have a list of trusted handles permitted to post to the newswire

main
Bob Mottram 2020-10-05 19:21:12 +01:00
parent b27e47fb65
commit 228234a4da
1 changed files with 11 additions and 4 deletions

View File

@ -221,7 +221,16 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
maxBlogsPerAccount: int) -> None:
"""Adds blogs from this instance into the newswire
"""
# get the list of handles who are trusted to post to the newswire
newswireTrusted = ''
newswireTrustedFilename = baseDir + '/accounts/newswiretrusted.txt'
if os.path.isfile(newswireTrustedFilename):
with open(newswireTrustedFilename, 'r+') as trustFile:
newswireTrusted = trustFile.read()
# file containing suspended account nicknames
suspendedFilename = baseDir + '/accounts/suspended.txt'
# go through each account
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for handle in dirs:
@ -229,6 +238,8 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
continue
if 'inbox@' in handle:
continue
if handle not in newswireTrusted:
continue
accountDir = os.path.join(baseDir + '/accounts', handle)
# has this account been suspended?
@ -244,10 +255,6 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
if foundSuspended:
continue
# has this account been blocked from posting to newswire?
if os.path.isfile(accountDir + '/.noblognewswire'):
continue
# is there a blogs timeline for this account?
blogsIndex = accountDir + '/tlblogs.index'
if os.path.isfile(blogsIndex):