Checking account directories

main
Bob Mottram 2021-06-25 19:02:05 +01:00
parent 2c09f48367
commit d7ad3733ff
6 changed files with 15 additions and 45 deletions

19
blog.py
View File

@ -16,6 +16,7 @@ from webapp_utils import htmlHeaderWithBlogMarkup
from webapp_utils import htmlFooter
from webapp_utils import getPostAttachmentsAsHtml
from webapp_media import addEmbeddedElements
from utils import isAccountDir
from utils import removeHtml
from utils import getConfigParam
from utils import getFullDomain
@ -643,11 +644,7 @@ def _noOfBlogAccounts(baseDir: str) -> int:
ctr = 0
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
if not isAccountDir(acct):
continue
accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index'
@ -662,11 +659,7 @@ def _singleBlogAccountNickname(baseDir: str) -> str:
"""
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
if not isAccountDir(acct):
continue
accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index'
@ -704,11 +697,7 @@ def htmlBlogView(authorized: bool,
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
if not isAccountDir(acct):
continue
accountDir = os.path.join(baseDir + '/accounts', acct)
blogsIndex = accountDir + '/tlblogs.index'

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Core"
import os
from utils import isAccountDir
from utils import getNicknameFromActor
from utils import getDomainFromActor
from webfinger import webfingerHandle
@ -186,11 +187,7 @@ def migrateAccounts(baseDir: str, session,
ctr = 0
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for handle in dirs:
if '@' not in handle:
continue
if handle.startswith('inbox@'):
continue
if handle.startswith('news@'):
if not isAccountDir(handle):
continue
nickname = handle.split('@')[0]
domain = handle.split('@')[1]

View File

@ -7,6 +7,7 @@ __email__ = "bob@freedombone.net"
__status__ = "Production"
import os
from utils import isAccountDir
from utils import loadJson
from utils import saveJson
from utils import getImageExtensions
@ -623,11 +624,7 @@ def _setThemeImages(baseDir: str, name: str) -> None:
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
if not isAccountDir(acct):
continue
accountDir = \
os.path.join(baseDir + '/accounts', acct)

View File

@ -5,7 +5,7 @@ __version__ = "1.2.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
__module_group__ = "Core"
__module_group__ = "ActivityPu"
import os
import re
@ -1454,10 +1454,7 @@ def noOfActiveAccountsMonthly(baseDir: str, months: int) -> bool:
monthSeconds = int(60*60*24*30*months)
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for account in dirs:
if '@' not in account:
continue
if account.startswith('inbox@') or \
account.startswith('news@'):
if not isAccountDir(account):
continue
lastUsedFilename = \
baseDir + '/accounts/' + account + '/.lastUsed'

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Web Interface"
import os
from utils import isAccountDir
from utils import getFullDomain
from utils import isEditor
from utils import loadJson
@ -270,11 +271,7 @@ def htmlModerationInfo(cssCache: {}, translate: {},
accounts = []
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@'):
continue
elif acct.startswith('news@'):
if not isAccountDir(acct):
continue
accounts.append(acct)
break

View File

@ -11,6 +11,7 @@ import os
from shutil import copyfile
import urllib.parse
from datetime import datetime
from utils import isAccountDir
from utils import getConfigParam
from utils import getFullDomain
from utils import isEditor
@ -407,11 +408,7 @@ def htmlSkillsSearch(actor: str,
for f in files:
if not f.endswith('.json'):
continue
if '@' not in f:
continue
if f.startswith('inbox@'):
continue
elif f.startswith('news@'):
if not isAccountDir(f):
continue
actorFilename = os.path.join(subdir, f)
actorJson = loadJson(actorFilename)
@ -446,11 +443,7 @@ def htmlSkillsSearch(actor: str,
for f in files:
if not f.endswith('.json'):
continue
if '@' not in f:
continue
if f.startswith('inbox@'):
continue
elif f.startswith('news@'):
if not isAccountDir(f):
continue
actorFilename = os.path.join(subdir, f)
cachedActorJson = loadJson(actorFilename)