forked from indymedia/epicyon
Have a list of trusted handles permitted to post to the newswire
parent
b27e47fb65
commit
228234a4da
15
newswire.py
15
newswire.py
|
@ -221,7 +221,16 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
|
||||||
maxBlogsPerAccount: int) -> None:
|
maxBlogsPerAccount: int) -> None:
|
||||||
"""Adds blogs from this instance into the newswire
|
"""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'
|
suspendedFilename = baseDir + '/accounts/suspended.txt'
|
||||||
|
|
||||||
# go through each account
|
# go through each account
|
||||||
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
||||||
for handle in dirs:
|
for handle in dirs:
|
||||||
|
@ -229,6 +238,8 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
|
||||||
continue
|
continue
|
||||||
if 'inbox@' in handle:
|
if 'inbox@' in handle:
|
||||||
continue
|
continue
|
||||||
|
if handle not in newswireTrusted:
|
||||||
|
continue
|
||||||
accountDir = os.path.join(baseDir + '/accounts', handle)
|
accountDir = os.path.join(baseDir + '/accounts', handle)
|
||||||
|
|
||||||
# has this account been suspended?
|
# has this account been suspended?
|
||||||
|
@ -244,10 +255,6 @@ def addLocalBlogsToNewswire(baseDir: str, newswire: {},
|
||||||
if foundSuspended:
|
if foundSuspended:
|
||||||
continue
|
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?
|
# is there a blogs timeline for this account?
|
||||||
blogsIndex = accountDir + '/tlblogs.index'
|
blogsIndex = accountDir + '/tlblogs.index'
|
||||||
if os.path.isfile(blogsIndex):
|
if os.path.isfile(blogsIndex):
|
||||||
|
|
Loading…
Reference in New Issue