diff --git a/epicyon-profile.css b/epicyon-profile.css index 2e9436d3..58c31101 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -950,6 +950,14 @@ div.container { font-size: var(--font-size); color: var(--title-color); } + .accountsTable { + width: 100%; + border: 0; + } + .accountsTableCol { + width: 20%; + text-align: center; + } .containerHeader { border: var(--border-width-header) solid var(--border-color); background-color: var(--header-bg-color); @@ -1601,6 +1609,14 @@ div.container { font-size: var(--font-size-mobile); color: var(--title-color); } + .accountsTable { + width: 100%; + border: 0; + } + .accountsTableCol { + width: 20%; + text-align: center; + } .containerHeader { border: var(--border-width-header) solid var(--border-color); background-color: var(--header-bg-color); diff --git a/webapp_moderation.py b/webapp_moderation.py index 46c5ba63..79929ef2 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -7,10 +7,12 @@ __email__ = "bob@freedombone.net" __status__ = "Production" import os +from utils import loadJson from utils import getNicknameFromActor from utils import getDomainFromActor from posts import getPublicPostInfo from webapp_timeline import htmlTimeline +# from webapp_utils import getPersonAvatarUrl from webapp_utils import getContentWarningButton from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter @@ -152,11 +154,51 @@ def htmlModerationInfo(cssCache: {}, translate: {}, '
' infoShown = False + + cols = 5 + infoForm += '
\n' + infoForm += '\n' + infoForm += ' \n' + for col in range(cols): + infoForm += ' \n' + infoForm += ' \n' + infoForm += '\n' + col = 0 + for subdir, dirs, files in os.walk(baseDir + '/accounts'): + for acct in dirs: + if '@' not in acct: + continue + if 'inbox@' in acct or 'news@' in acct: + continue + accountDir = os.path.join(baseDir + '/accounts', acct) + acctNickname = acct.split('@')[0] + actorJson = loadJson(accountDir + '.json') + if not actorJson: + continue + actor = actorJson['id'] + avatarUrl = '' + if actorJson.get('icon'): + if actorJson['icon'].get('url'): + avatarUrl = actorJson['icon']['url'] + acctUrl = \ + '/users/' + nickname + '?options=' + actor + ';1;' + \ + avatarUrl.replace('/', '-') + infoForm += '\n' + col += 1 + if col == cols: + # new row of accounts + infoForm += '\n\n' + break + infoForm += '\n
\n' + infoForm += '' + infoForm += '
' + acctNickname + '
\n
\n' + infoForm += '
\n' + suspendedFilename = baseDir + '/accounts/suspended.txt' if os.path.isfile(suspendedFilename): with open(suspendedFilename, "r") as f: suspendedStr = f.read() - infoForm += '
' + infoForm += '
\n' infoForm += '
' + \ translate['Suspended accounts'] + '' infoForm += '
' + \ @@ -164,15 +206,15 @@ def htmlModerationInfo(cssCache: {}, translate: {}, infoForm += \ ' ' - infoForm += '
' + suspendedStr + '\n' + infoForm += '
\n' infoShown = True blockingFilename = baseDir + '/accounts/blocking.txt' if os.path.isfile(blockingFilename): with open(blockingFilename, "r") as f: blockedStr = f.read() - infoForm += '
' + infoForm += '
\n' infoForm += \ '
' + \ translate['Blocked accounts and hashtags'] + '' @@ -182,29 +224,29 @@ def htmlModerationInfo(cssCache: {}, translate: {}, infoForm += \ ' ' - infoForm += '
' + blockedStr + '\n' + infoForm += '
\n' infoShown = True filtersFilename = baseDir + '/accounts/filters.txt' if os.path.isfile(filtersFilename): with open(filtersFilename, "r") as f: filteredStr = f.read() - infoForm += '
' + infoForm += '
\n' infoForm += \ '
' + \ translate['Filtered words'] + '' infoForm += \ ' ' - infoForm += '
' + filteredStr + '\n' + infoForm += '
\n' infoShown = True if not infoShown: infoForm += \ '

' + \ translate[msgStr2] + \ - '

' + '

\n' infoForm += htmlFooter() return infoForm diff --git a/webapp_post.py b/webapp_post.py index 28891dca..69a9eed4 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -47,6 +47,7 @@ from content import getMentionsFromHtml from content import switchWords from person import isPersonSnoozed from announce import announcedByPerson +from webapp_utils import getAvatarImageUrl from webapp_utils import getPersonAvatarUrl from webapp_utils import updateAvatarImageCache from webapp_utils import loadIndividualPostAsHtmlFromCache @@ -177,32 +178,6 @@ def getPostFromRecentCache(session, return postHtml -def getAvatarImageUrl(session, - baseDir: str, httpPrefix: str, - postActor: str, personCache: {}, - avatarUrl: str, allowDownloads: bool) -> str: - """Returns the avatar image url - """ - # get the avatar image url for the post actor - if not avatarUrl: - avatarUrl = \ - getPersonAvatarUrl(baseDir, postActor, personCache, - allowDownloads) - avatarUrl = \ - updateAvatarImageCache(session, baseDir, httpPrefix, - postActor, avatarUrl, personCache, - allowDownloads) - else: - updateAvatarImageCache(session, baseDir, httpPrefix, - postActor, avatarUrl, personCache, - allowDownloads) - - if not avatarUrl: - avatarUrl = postActor + '/avatar.png' - - return avatarUrl - - def getAvatarImageHtml(showAvatarOptions: bool, nickname: str, domainFull: str, avatarUrl: str, postActor: str, diff --git a/webapp_utils.py b/webapp_utils.py index f70d7603..8003737c 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -850,3 +850,29 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str: if not highlight: return label return '*' + str(label) + '*' + + +def getAvatarImageUrl(session, + baseDir: str, httpPrefix: str, + postActor: str, personCache: {}, + avatarUrl: str, allowDownloads: bool) -> str: + """Returns the avatar image url + """ + # get the avatar image url for the post actor + if not avatarUrl: + avatarUrl = \ + getPersonAvatarUrl(baseDir, postActor, personCache, + allowDownloads) + avatarUrl = \ + updateAvatarImageCache(session, baseDir, httpPrefix, + postActor, avatarUrl, personCache, + allowDownloads) + else: + updateAvatarImageCache(session, baseDir, httpPrefix, + postActor, avatarUrl, personCache, + allowDownloads) + + if not avatarUrl: + avatarUrl = postActor + '/avatar.png' + + return avatarUrl