forked from indymedia/epicyon
List of accounts on moderator info screen
parent
99374a63dc
commit
fba6679b21
|
@ -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);
|
||||
|
|
|
@ -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: {},
|
|||
'</a></h1></center><br>'
|
||||
|
||||
infoShown = False
|
||||
|
||||
cols = 5
|
||||
infoForm += '<div class="container">\n'
|
||||
infoForm += '<table class="accountsTable">\n'
|
||||
infoForm += ' <colgroup>\n'
|
||||
for col in range(cols):
|
||||
infoForm += ' <col span="1" class="accountsTableCol">\n'
|
||||
infoForm += ' </colgroup>\n'
|
||||
infoForm += '<tr>\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 += '<td>\n<a href="' + acctUrl + '">'
|
||||
infoForm += '<img src="' + avatarUrl + '" />'
|
||||
infoForm += '<br>' + acctNickname + '</a>\n</td>\n'
|
||||
col += 1
|
||||
if col == cols:
|
||||
# new row of accounts
|
||||
infoForm += '</tr>\n<tr>\n'
|
||||
break
|
||||
infoForm += '</tr>\n</table>\n'
|
||||
infoForm += '</div>\n'
|
||||
|
||||
suspendedFilename = baseDir + '/accounts/suspended.txt'
|
||||
if os.path.isfile(suspendedFilename):
|
||||
with open(suspendedFilename, "r") as f:
|
||||
suspendedStr = f.read()
|
||||
infoForm += '<div class="container">'
|
||||
infoForm += '<div class="container">\n'
|
||||
infoForm += ' <br><b>' + \
|
||||
translate['Suspended accounts'] + '</b>'
|
||||
infoForm += ' <br>' + \
|
||||
|
@ -164,15 +206,15 @@ def htmlModerationInfo(cssCache: {}, translate: {},
|
|||
infoForm += \
|
||||
' <textarea id="message" ' + \
|
||||
'name="suspended" style="height:200px">' + \
|
||||
suspendedStr + '</textarea>'
|
||||
infoForm += '</div>'
|
||||
suspendedStr + '</textarea>\n'
|
||||
infoForm += '</div>\n'
|
||||
infoShown = True
|
||||
|
||||
blockingFilename = baseDir + '/accounts/blocking.txt'
|
||||
if os.path.isfile(blockingFilename):
|
||||
with open(blockingFilename, "r") as f:
|
||||
blockedStr = f.read()
|
||||
infoForm += '<div class="container">'
|
||||
infoForm += '<div class="container">\n'
|
||||
infoForm += \
|
||||
' <br><b>' + \
|
||||
translate['Blocked accounts and hashtags'] + '</b>'
|
||||
|
@ -182,29 +224,29 @@ def htmlModerationInfo(cssCache: {}, translate: {},
|
|||
infoForm += \
|
||||
' <textarea id="message" ' + \
|
||||
'name="blocked" style="height:700px">' + \
|
||||
blockedStr + '</textarea>'
|
||||
infoForm += '</div>'
|
||||
blockedStr + '</textarea>\n'
|
||||
infoForm += '</div>\n'
|
||||
infoShown = True
|
||||
|
||||
filtersFilename = baseDir + '/accounts/filters.txt'
|
||||
if os.path.isfile(filtersFilename):
|
||||
with open(filtersFilename, "r") as f:
|
||||
filteredStr = f.read()
|
||||
infoForm += '<div class="container">'
|
||||
infoForm += '<div class="container">\n'
|
||||
infoForm += \
|
||||
' <br><b>' + \
|
||||
translate['Filtered words'] + '</b>'
|
||||
infoForm += \
|
||||
' <textarea id="message" ' + \
|
||||
'name="filtered" style="height:700px">' + \
|
||||
filteredStr + '</textarea>'
|
||||
infoForm += '</div>'
|
||||
filteredStr + '</textarea>\n'
|
||||
infoForm += '</div>\n'
|
||||
infoShown = True
|
||||
|
||||
if not infoShown:
|
||||
infoForm += \
|
||||
'<center><p>' + \
|
||||
translate[msgStr2] + \
|
||||
'</p></center>'
|
||||
'</p></center>\n'
|
||||
infoForm += htmlFooter()
|
||||
return infoForm
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue