diff --git a/daemon.py b/daemon.py index 9367cc30..72f054fc 100644 --- a/daemon.py +++ b/daemon.py @@ -90,6 +90,7 @@ from webinterface import htmlProfileAfterSearch from webinterface import htmlEditProfile from webinterface import htmlTermsOfService from webinterface import htmlHashtagSearch +from webinterface import htmlModerationInfo from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload @@ -2118,6 +2119,11 @@ class PubServer(BaseHTTPRequestHandler): if '=' in moderationStr: moderationText=moderationStr.split('=')[1].strip() moderationText=moderationText.replace('+',' ').replace('%40','@').replace('%3A',':').replace('%23','#').strip() + elif moderationStr.startswith('submitInfo'): + self._login_headers('text/html') + self.wfile.write(htmlModerationInfo(self.server.baseDir).encode('utf-8')) + self.server.POSTbusy=False + return elif moderationStr.startswith('submitBlock'): moderationButton='block' elif moderationStr.startswith('submitUnblock'): diff --git a/webinterface.py b/webinterface.py index 6c77caa7..2236c3b2 100644 --- a/webinterface.py +++ b/webinterface.py @@ -35,16 +35,42 @@ from content import getMentionsFromHtml from config import getConfigParam from skills import getSkills -def noOfModerationPosts(baseDir: str) -> int: - """Returns the number of posts addressed to moderators - """ - moderationIndexFile=baseDir+'/accounts/moderation.txt' - if not os.path.isfile(moderationIndexFile): - return 0 - with open(moderationIndexFile, "r") as f: - lines = f.readlines() - return len(lines) - return 0 +def htmlModerationInfo(baseDir: str) -> str: + infoForm='' + with open(baseDir+'/epicyon-profile.css', 'r') as cssFile: + infoCSS=cssFile.read() + infoForm=htmlHeader(infoCSS) + + infoForm+='

Moderation Information

' + + infoShown=False + suspendedFilename=baseDir+'/accounts/suspended.txt' + if os.path.isfile(suspendedFilename): + with open(suspendedFilename, "r") as f: + suspendedStr = f.read() + infoForm+= \ + '
' \ + '
Suspended accounts' \ + '
These are currently suspended' \ + ' ' \ + '
' + infoShown=True + + blockingFilename=baseDir+'/accounts/blocking.txt' + if os.path.isfile(blockingFilename): + with open(blockingFilename, "r") as f: + blockedStr = f.read() + infoForm+= \ + '
' \ + '
Blocked accounts' \ + '
These are globally blocked for all accounts on this instance' \ + ' ' \ + '
' + infoShown=True + if not infoShown: + infoForm+='

Any blocks or suspensions made by moderators will be shown here.

' + infoForm+=htmlFooter() + return infoForm def htmlHashtagSearch(baseDir: str,hashtag: str,pageNumber: int,postsPerPage: int, session,wfRequest: {},personCache: {}) -> str: @@ -1075,6 +1101,7 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \ ' ' \ ' ' \ ' ' \ + ' ' \ '' # add the javascript for content warnings