Include news account

main
Bob Mottram 2021-04-21 17:09:56 +01:00
parent 10492581ff
commit 35205a9309
5 changed files with 30 additions and 10 deletions

12
blog.py
View File

@ -619,7 +619,9 @@ def _noOfBlogAccounts(baseDir: str) -> int:
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct: if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
continue continue
accountDir = os.path.join(baseDir + '/accounts', acct) accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index' blogsIndex = accountDir + '/tlblogs.index'
@ -636,7 +638,9 @@ def _singleBlogAccountNickname(baseDir: str) -> str:
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct: if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
continue continue
accountDir = os.path.join(baseDir + '/accounts', acct) accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index' blogsIndex = accountDir + '/tlblogs.index'
@ -676,7 +680,9 @@ def htmlBlogView(authorized: bool,
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct: if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
continue continue
accountDir = os.path.join(baseDir + '/accounts', acct) accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index' blogsIndex = accountDir + '/tlblogs.index'

View File

@ -551,7 +551,9 @@ def _setThemeImages(baseDir: str, name: str) -> None:
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct: if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
continue continue
accountDir = \ accountDir = \
os.path.join(baseDir + '/accounts', acct) os.path.join(baseDir + '/accounts', acct)

View File

@ -388,7 +388,9 @@ def getFollowersOfPerson(baseDir: str,
for subdir, dirs, files in os.walk(baseDir + '/accounts'): for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for account in dirs: for account in dirs:
filename = os.path.join(subdir, account) + '/' + followFile filename = os.path.join(subdir, account) + '/' + followFile
if account == handle or account.startswith('inbox@'): if account == handle or \
account.startswith('inbox@') or \
account.startswith('news@'):
continue continue
if not os.path.isfile(filename): if not os.path.isfile(filename):
continue continue
@ -1057,7 +1059,7 @@ def clearFromPostCaches(baseDir: str, recentPostsCache: {},
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct: if acct.startswith('inbox@'):
continue continue
cacheDir = os.path.join(baseDir + '/accounts', acct) cacheDir = os.path.join(baseDir + '/accounts', acct)
postFilename = cacheDir + filename postFilename = cacheDir + filename
@ -1405,8 +1407,11 @@ def noOfAccounts(baseDir: str) -> bool:
for subdir, dirs, files in os.walk(baseDir + '/accounts'): for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for account in dirs: for account in dirs:
if '@' in account: if '@' in account:
if not account.startswith('inbox@'): if account.startswith('inbox@'):
accountCtr += 1 continue
elif account.startswith('news@'):
continue
accountCtr += 1
break break
return accountCtr return accountCtr
@ -1420,7 +1425,8 @@ def noOfActiveAccountsMonthly(baseDir: str, months: int) -> bool:
for subdir, dirs, files in os.walk(baseDir + '/accounts'): for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for account in dirs: for account in dirs:
if '@' in account: if '@' in account:
if not account.startswith('inbox@'): if not account.startswith('inbox@') and \
not account.startswith('news@'):
lastUsedFilename = \ lastUsedFilename = \
baseDir + '/accounts/' + account + '/.lastUsed' baseDir + '/accounts/' + account + '/.lastUsed'
if os.path.isfile(lastUsedFilename): if os.path.isfile(lastUsedFilename):

View File

@ -270,7 +270,9 @@ def htmlModerationInfo(cssCache: {}, translate: {},
for acct in dirs: for acct in dirs:
if '@' not in acct: if '@' not in acct:
continue continue
if 'inbox@' in acct or 'news@' in acct: if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
continue continue
accounts.append(acct) accounts.append(acct)
break break

View File

@ -404,6 +404,8 @@ def htmlSkillsSearch(actor: str,
continue continue
if f.startswith('inbox@'): if f.startswith('inbox@'):
continue continue
elif f.startswith('news@'):
continue
actorFilename = os.path.join(subdir, f) actorFilename = os.path.join(subdir, f)
actorJson = loadJson(actorFilename) actorJson = loadJson(actorFilename)
if actorJson: if actorJson:
@ -439,6 +441,8 @@ def htmlSkillsSearch(actor: str,
continue continue
if f.startswith('inbox@'): if f.startswith('inbox@'):
continue continue
elif f.startswith('news@'):
continue
actorFilename = os.path.join(subdir, f) actorFilename = os.path.join(subdir, f)
cachedActorJson = loadJson(actorFilename) cachedActorJson = loadJson(actorFilename)
if cachedActorJson: if cachedActorJson: