diff --git a/README.md b/README.md index f4ee63e46..5c5b2ab6b 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,8 @@ To run a security audit: ./security_audit ``` -Note that not all of the issues identified will necessarily be relevant to this project. +Note that not all of the issues identified will necessarily be relevant to this project. Consider its output as a list of things which potentially can be investigated but usually will turn out not to be relevant. + ## Installing on Onion or i2p domains @@ -248,6 +249,11 @@ systemctl restart epicyon If you want to use your own favicon then copy your `favicon.ico` file to the base directory where you installed Epicyon. +## Changing Themes + +When changing themes you may need to ensure that your nginx cache is cleared (/var/www/cache/*) and that your local browser cache is cleared for the site (Shift + Reload). Otherwise images and icons from the previous theme may remain. + + ## Adding Themes If you want to add a new theme then first add the name of your theme to the translations files. diff --git a/daemon.py b/daemon.py index e02d1909f..10e368d97 100644 --- a/daemon.py +++ b/daemon.py @@ -136,6 +136,7 @@ from webapp_timeline import htmlInboxBlogs from webapp_timeline import htmlInboxNews from webapp_timeline import htmlInboxFeatures from webapp_timeline import htmlOutbox +from webapp_moderation import htmlAccountInfo from webapp_moderation import htmlModeration from webapp_moderation import htmlModerationInfo from webapp_create_post import htmlNewPost @@ -1403,6 +1404,7 @@ class PubServer(BaseHTTPRequestHandler): """Actions on the moderator screeen """ usersPath = path.replace('/moderationaction', '') + nickname = usersPath.replace('/users/', '') actorStr = httpPrefix + '://' + domainFull + usersPath length = int(self.headers['Content-length']) @@ -1439,9 +1441,26 @@ class PubServer(BaseHTTPRequestHandler): moderationText = \ urllib.parse.unquote_plus(modText.strip()) elif moderationStr.startswith('submitInfo'): - msg = htmlModerationInfo(self.server.cssCache, - self.server.translate, - baseDir, httpPrefix) + searchHandle = moderationText + if searchHandle: + if '@' not in searchHandle: + searchHandle = None + if searchHandle: + msg = \ + htmlAccountInfo(self.server.cssCache, + self.server.translate, + baseDir, httpPrefix, + nickname, + self.server.domain, + self.server.port, + searchHandle, + self.server.debug) + else: + msg = \ + htmlModerationInfo(self.server.cssCache, + self.server.translate, + baseDir, httpPrefix, + nickname) msg = msg.encode('utf-8') self._login_headers('text/html', len(msg), callingDomain) @@ -3826,6 +3845,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName = fields['themeDropdown'] setTheme(baseDir, self.server.themeName, domain, allowLocalNetworkAccess) + self.server.iconsCache = {} + self.server.fontsCache = {} self.server.showPublishAsIcon = \ getConfigParam(self.server.baseDir, 'showPublishAsIcon') @@ -4199,6 +4220,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName = currTheme setTheme(baseDir, currTheme, domain, self.server.allowLocalNetworkAccess) + self.server.iconsCache = {} + self.server.fontsCache = {} self.server.showPublishAsIcon = \ getConfigParam(self.server.baseDir, 'showPublishAsIcon') @@ -5329,6 +5352,9 @@ class PubServer(BaseHTTPRequestHandler): debug, self.server.projectVersion) if announceJson: + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('repeat.png'): + del self.server.iconsCache['repeat.png'] self._postToOutboxThread(announceJson) self.server.GETbusy = False actorAbsolute = httpPrefix + '://' + domainFull + actor @@ -5419,6 +5445,9 @@ class PubServer(BaseHTTPRequestHandler): 'type': 'Announce' } } + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('repeat_inactive.png'): + del self.server.iconsCache['repeat_inactive.png'] self._postToOutboxThread(newUndoAnnounce) self.server.GETbusy = False actorAbsolute = httpPrefix + '://' + domainFull + actor @@ -5700,6 +5729,9 @@ class PubServer(BaseHTTPRequestHandler): likedPostFilename, likeUrl, likeActor, domain, debug) + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('like.png'): + del self.server.iconsCache['like.png'] else: print('WARN: unable to locate file for liked post ' + likeUrl) @@ -5804,6 +5836,9 @@ class PubServer(BaseHTTPRequestHandler): baseDir, likedPostFilename, likeUrl, undoActor, domain, debug) + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('like_inactive.png'): + del self.server.iconsCache['like_inactive.png'] # send out the undo like to followers self._postToOutbox(undoLikeJson, self.server.projectVersion) self.server.GETbusy = False @@ -5895,6 +5930,9 @@ class PubServer(BaseHTTPRequestHandler): self.server.cachedWebfingers, self.server.debug, self.server.projectVersion) + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('bookmark.png'): + del self.server.iconsCache['bookmark.png'] # self._postToOutbox(bookmarkJson, self.server.projectVersion) self.server.GETbusy = False actorAbsolute = \ @@ -5985,6 +6023,9 @@ class PubServer(BaseHTTPRequestHandler): self.server.cachedWebfingers, debug, self.server.projectVersion) + # clear the icon from the cache so that it gets updated + if self.server.iconsCache.get('bookmark_inactive.png'): + del self.server.iconsCache['bookmark_inactive.png'] # self._postToOutbox(undoBookmarkJson, self.server.projectVersion) self.server.GETbusy = False actorAbsolute = \ @@ -8090,6 +8131,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.votingTimeMins) fullWidthTimelineButtonHeader = \ self.server.fullWidthTimelineButtonHeader + moderationActionStr = '' msg = \ htmlModeration(self.server.cssCache, self.server.defaultTimeline, @@ -8117,7 +8159,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.iconsAsButtons, self.server.rssIconAtTop, self.server.publishButtonAtTop, - authorized) + authorized, moderationActionStr) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -10954,6 +10996,74 @@ class PubServer(BaseHTTPRequestHandler): 'show blogs 2 done', 'show shares 2 done') + # block a domain from htmlAccountInfo + if authorized and '/users/' in self.path and \ + '/accountinfo?blockdomain=' in self.path and \ + '?handle=' in self.path: + nickname = self.path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + if not isModerator(self.server.baseDir, nickname): + self._400() + return + blockDomain = self.path.split('/accountinfo?blockdomain=')[1] + searchHandle = blockDomain.split('?handle=')[1] + searchHandle = urllib.parse.unquote_plus(searchHandle) + blockDomain = blockDomain.split('?handle=')[0] + blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) + if '?' in blockDomain: + blockDomain = blockDomain.split('?')[0] + addGlobalBlock(self.server.baseDir, '*', blockDomain) + self.server.GETbusy = False + msg = \ + htmlAccountInfo(self.server.cssCache, + self.server.translate, + self.server.baseDir, + self.server.httpPrefix, + nickname, + self.server.domain, + self.server.port, + searchHandle, + self.server.debug) + msg = msg.encode('utf-8') + self._login_headers('text/html', + len(msg), callingDomain) + self._write(msg) + return + + # unblock a domain from htmlAccountInfo + if authorized and '/users/' in self.path and \ + '/accountinfo?unblockdomain=' in self.path and \ + '?handle=' in self.path: + nickname = self.path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + if not isModerator(self.server.baseDir, nickname): + self._400() + return + blockDomain = self.path.split('/accountinfo?unblockdomain=')[1] + searchHandle = blockDomain.split('?handle=')[1] + searchHandle = urllib.parse.unquote_plus(searchHandle) + blockDomain = blockDomain.split('?handle=')[0] + blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) + removeGlobalBlock(self.server.baseDir, '*', blockDomain) + self.server.GETbusy = False + msg = \ + htmlAccountInfo(self.server.cssCache, + self.server.translate, + self.server.baseDir, + self.server.httpPrefix, + nickname, + self.server.domain, + self.server.port, + searchHandle, + self.server.debug) + msg = msg.encode('utf-8') + self._login_headers('text/html', + len(msg), callingDomain) + self._write(msg) + return + # get the bookmarks timeline for a given person if self.path.endswith('/tlbookmarks') or \ '/tlbookmarks?page=' in self.path or \ @@ -11021,7 +11131,7 @@ class PubServer(BaseHTTPRequestHandler): # get the moderation feed for a moderator if self.path.endswith('/moderation') or \ - '/moderation?page=' in self.path: + '/moderation?' in self.path: if self._showModTimeline(authorized, callingDomain, self.path, self.server.baseDir, diff --git a/epicyon-profile.css b/epicyon-profile.css index 94309a067..2e9436d3d 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -930,6 +930,10 @@ div.container { overflow: hidden; } +.accountInfoDomains { + margin: 0 20%; +} + @media screen and (min-width: 400px) { body, html { background-color: var(--main-bg-color); diff --git a/epicyon.py b/epicyon.py index 59c0e2cd5..37df367e9 100644 --- a/epicyon.py +++ b/epicyon.py @@ -526,8 +526,8 @@ if args.posts: if args.postDomains: if '@' not in args.postDomains: if '/users/' in args.postDomains: - postsNickname = getNicknameFromActor(args.posts) - postsDomain, postsPort = getDomainFromActor(args.posts) + postsNickname = getNicknameFromActor(args.postDomains) + postsDomain, postsPort = getDomainFromActor(args.postDomains) args.postDomains = postsNickname + '@' + postsDomain if postsPort: if postsPort != 80 and postsPort != 443: @@ -565,8 +565,9 @@ if args.postDomainsBlocked: # given handle but which are globally blocked on this instance if '@' not in args.postDomainsBlocked: if '/users/' in args.postDomainsBlocked: - postsNickname = getNicknameFromActor(args.posts) - postsDomain, postsPort = getDomainFromActor(args.posts) + postsNickname = getNicknameFromActor(args.postDomainsBlocked) + postsDomain, postsPort = \ + getDomainFromActor(args.postDomainsBlocked) args.postDomainsBlocked = postsNickname + '@' + postsDomain if postsPort: if postsPort != 80 and postsPort != 443: diff --git a/theme/hacker/icons/calendar.png b/theme/hacker/icons/calendar.png index 80ae04060..c70130d9f 100644 Binary files a/theme/hacker/icons/calendar.png and b/theme/hacker/icons/calendar.png differ diff --git a/theme/hacker/icons/calendar_notify.png b/theme/hacker/icons/calendar_notify.png index 21d68fd85..b29692291 100644 Binary files a/theme/hacker/icons/calendar_notify.png and b/theme/hacker/icons/calendar_notify.png differ diff --git a/theme/hacker/icons/favicon.ico b/theme/hacker/icons/favicon.ico index c7cb1bbbe..e04365761 100644 Binary files a/theme/hacker/icons/favicon.ico and b/theme/hacker/icons/favicon.ico differ diff --git a/theme/hacker/icons/scope_event.png b/theme/hacker/icons/scope_event.png index 80ae04060..c70130d9f 100644 Binary files a/theme/hacker/icons/scope_event.png and b/theme/hacker/icons/scope_event.png differ diff --git a/translations/ar.json b/translations/ar.json index 2a96a612f..8ce52a2f5 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "حدد رمز التحرير لإضافة موجز ويب لـ RSS", "Select the edit icon to add web links": "حدد رمز التحرير لإضافة روابط الويب", "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", - "Ask about a shared item.": "اسأل عن عنصر مشترك." + "Ask about a shared item.": "اسأل عن عنصر مشترك.", + "Account Information": "معلومات الحساب", + "This account interacts with the following instances": "يتفاعل هذا الحساب مع الحالات التالية" } diff --git a/translations/ca.json b/translations/ca.json index 7ff65aab7..7e9b2d8a7 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Seleccioneu la icona d'edició per afegir canals RSS", "Select the edit icon to add web links": "Seleccioneu la icona d'edició per afegir enllaços web", "Hashtag Categories RSS Feed": "Feed RSS de categories de hashtag", - "Ask about a shared item.": "Pregunteu sobre un element compartit." + "Ask about a shared item.": "Pregunteu sobre un element compartit.", + "Account Information": "Informació del compte", + "This account interacts with the following instances": "Aquest compte interactua amb les instàncies següents" } diff --git a/translations/cy.json b/translations/cy.json index b10bb537e..a0c996809 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Dewiswch yr eicon golygu i ychwanegu porthwyr RSS", "Select the edit icon to add web links": "Dewiswch yr eicon golygu i ychwanegu dolenni gwe", "Hashtag Categories RSS Feed": "Categorïau Hashtag RSS Feed", - "Ask about a shared item.": "Gofynnwch am eitem a rennir." + "Ask about a shared item.": "Gofynnwch am eitem a rennir.", + "Account Information": "Gwybodaeth Gyfrif", + "This account interacts with the following instances": "Mae'r cyfrif hwn yn rhyngweithio â'r achosion canlynol" } diff --git a/translations/de.json b/translations/de.json index ebd9e4e5a..f9eac6115 100644 --- a/translations/de.json +++ b/translations/de.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Wählen Sie das Bearbeitungssymbol, um RSS-Feeds hinzuzufügen", "Select the edit icon to add web links": "Wählen Sie das Bearbeitungssymbol, um Weblinks hinzuzufügen", "Hashtag Categories RSS Feed": "Hashtag Kategorien RSS Feed", - "Ask about a shared item.": "Fragen Sie nach einem gemeinsamen Artikel." + "Ask about a shared item.": "Fragen Sie nach einem gemeinsamen Artikel.", + "Account Information": "Kontoinformationen", + "This account interacts with the following instances": "Dieses Konto interagiert mit den folgenden Instanzen" } diff --git a/translations/en.json b/translations/en.json index 45e450a1e..b17f8b92b 100644 --- a/translations/en.json +++ b/translations/en.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Select the edit icon to add RSS feeds", "Select the edit icon to add web links": "Select the edit icon to add web links", "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", - "Ask about a shared item.": "Ask about a shared item." + "Ask about a shared item.": "Ask about a shared item.", + "Account Information": "Account Information", + "This account interacts with the following instances": "This account interacts with the following instances" } diff --git a/translations/es.json b/translations/es.json index 12e541e78..4c970fe79 100644 --- a/translations/es.json +++ b/translations/es.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Seleccione el icono de edición para agregar fuentes RSS", "Select the edit icon to add web links": "Seleccione el icono de edición para agregar enlaces web", "Hashtag Categories RSS Feed": "Feed RSS de categorías de hashtags", - "Ask about a shared item.": "Pregunte por un elemento compartido." + "Ask about a shared item.": "Pregunte por un elemento compartido.", + "Account Information": "Información de la cuenta", + "This account interacts with the following instances": "Esta cuenta interactúa con las siguientes instancias" } diff --git a/translations/fr.json b/translations/fr.json index 7816fc8f8..167940b2a 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Sélectionnez l'icône d'édition pour ajouter des flux RSS", "Select the edit icon to add web links": "Sélectionnez l'icône de modification pour ajouter des liens Web", "Hashtag Categories RSS Feed": "Flux RSS des catégories Hashtag", - "Ask about a shared item.": "Renseignez-vous sur un élément partagé." + "Ask about a shared item.": "Renseignez-vous sur un élément partagé.", + "Account Information": "Information sur le compte", + "This account interacts with the following instances": "Ce compte interagit avec les instances suivantes" } diff --git a/translations/ga.json b/translations/ga.json index ac41d0205..13e51eada 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Roghnaigh an deilbhín eagar chun fothaí RSS a chur leis", "Select the edit icon to add web links": "Roghnaigh an deilbhín eagar chun naisc ghréasáin a chur leis", "Hashtag Categories RSS Feed": "Catagóirí Hashtag RSS Feed", - "Ask about a shared item.": "Fiafraigh faoi earra roinnte." + "Ask about a shared item.": "Fiafraigh faoi earra roinnte.", + "Account Information": "Faisnéis Chuntais", + "This account interacts with the following instances": "Idirghníomhaíonn an cuntas seo leis na cásanna seo a leanas" } diff --git a/translations/hi.json b/translations/hi.json index 65fec21ff..40ddfc5f6 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "RSS फ़ीड जोड़ने के लिए संपादन आइकन का चयन करें", "Select the edit icon to add web links": "वेब लिंक जोड़ने के लिए संपादन आइकन का चयन करें", "Hashtag Categories RSS Feed": "हैशटैग श्रेणियाँ आरएसएस फ़ीड", - "Ask about a shared item.": "एक साझा आइटम के बारे में पूछें।" + "Ask about a shared item.": "एक साझा आइटम के बारे में पूछें।", + "Account Information": "खाते की जानकारी", + "This account interacts with the following instances": "यह खाता निम्नलिखित उदाहरणों के साथ सहभागिता करता है" } diff --git a/translations/it.json b/translations/it.json index fabd4f973..5ab6e0dbc 100644 --- a/translations/it.json +++ b/translations/it.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Seleziona l'icona di modifica per aggiungere feed RSS", "Select the edit icon to add web links": "Seleziona l'icona di modifica per aggiungere link web", "Hashtag Categories RSS Feed": "Feed RSS delle categorie hashtag", - "Ask about a shared item.": "Chiedi informazioni su un elemento condiviso." + "Ask about a shared item.": "Chiedi informazioni su un elemento condiviso.", + "Account Information": "Informazioni account", + "This account interacts with the following instances": "Questo account interagisce con le seguenti istanze" } diff --git a/translations/ja.json b/translations/ja.json index 7bed89c46..3afb8aff8 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "編集アイコンを選択してRSSフィードを追加します", "Select the edit icon to add web links": "編集アイコンを選択してWebリンクを追加します", "Hashtag Categories RSS Feed": "ハッシュタグカテゴリRSSフィード", - "Ask about a shared item.": "共有アイテムについて質問します。" + "Ask about a shared item.": "共有アイテムについて質問します。", + "Account Information": "口座情報", + "This account interacts with the following instances": "このアカウントは、次のインスタンスと相互作用します" } diff --git a/translations/oc.json b/translations/oc.json index a224b833a..9f8a92a0e 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -335,5 +335,7 @@ "Select the edit icon to add RSS feeds": "Select the edit icon to add RSS feeds", "Select the edit icon to add web links": "Select the edit icon to add web links", "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", - "Ask about a shared item.": "Ask about a shared item." + "Ask about a shared item.": "Ask about a shared item.", + "Account Information": "Account Information", + "This account interacts with the following instances": "This account interacts with the following instances" } diff --git a/translations/pt.json b/translations/pt.json index 305243eac..53af4b8d6 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Selecione o ícone de edição para adicionar feeds RSS", "Select the edit icon to add web links": "Selecione o ícone de edição para adicionar links da web", "Hashtag Categories RSS Feed": "Feed RSS das categorias de hashtag", - "Ask about a shared item.": "Pergunte sobre um item compartilhado." + "Ask about a shared item.": "Pergunte sobre um item compartilhado.", + "Account Information": "Informação da conta", + "This account interacts with the following instances": "Esta conta interage com as seguintes instâncias" } diff --git a/translations/ru.json b/translations/ru.json index 3c0155cea..e44e037f5 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "Щелкните значок редактирования, чтобы добавить RSS-каналы", "Select the edit icon to add web links": "Щелкните значок редактирования, чтобы добавить веб-ссылки", "Hashtag Categories RSS Feed": "RSS-канал категорий хэштегов", - "Ask about a shared item.": "Спросите об общем элементе." + "Ask about a shared item.": "Спросите об общем элементе.", + "Account Information": "Информация об аккаунте", + "This account interacts with the following instances": "Этот аккаунт взаимодействует со следующими экземплярами" } diff --git a/translations/zh.json b/translations/zh.json index 470be2cd5..f12a444da 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -339,5 +339,7 @@ "Select the edit icon to add RSS feeds": "选择编辑图标以添加RSS feed", "Select the edit icon to add web links": "选择编辑图标以添加Web链接", "Hashtag Categories RSS Feed": "标签类别RSS提要", - "Ask about a shared item.": "询问共享项目。" + "Ask about a shared item.": "询问共享项目。", + "Account Information": "帐户信息", + "This account interacts with the following instances": "此帐户与以下实例进行交互" } diff --git a/utils.py b/utils.py index aa82ea054..54b1a8649 100644 --- a/utils.py +++ b/utils.py @@ -1148,7 +1148,8 @@ def validNickname(domain: str, nickname: str) -> bool: 'channel', 'calendar', 'tlreplies', 'tlmedia', 'tlblogs', 'tlevents', 'tlblogs', 'tlfeatures', - 'moderation', 'activity', 'undo', + 'moderation', 'moderationaction', + 'activity', 'undo', 'reply', 'replies', 'question', 'like', 'likes', 'users', 'statuses', 'tags', 'accounts', 'channels', 'profile', diff --git a/webapp_column_left.py b/webapp_column_left.py index 5e5df5cf7..8d91101da 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -215,7 +215,8 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, lineStr = lineStr[:len(lineStr)-1] # add link to the returned html htmlStr += \ - '

' + \ + '

' + \ lineStr + '

\n' linksFileContainsEntries = True else: diff --git a/webapp_column_right.py b/webapp_column_right.py index 91412956b..589184817 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -242,7 +242,8 @@ def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, title = removeLongWords(item[0], 16, []).replace('\n', '
') htmlStr += '

' + \ - '' + \ + '' + \ '' + title + \ '' + totalVotesStr if moderator: @@ -269,7 +270,8 @@ def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, title = removeLongWords(item[0], 16, []).replace('\n', '
') if moderator and moderatedItem: htmlStr += '

' + \ - '' + \ + '' + \ title + '' + totalVotesStr htmlStr += ' ' + dateShown htmlStr += '' + \ - '' + \ + '' + \ title + '' + \ totalVotesStr htmlStr += ' ' diff --git a/webapp_moderation.py b/webapp_moderation.py index 6c23ef401..bb8859c11 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -7,9 +7,13 @@ __email__ = "bob@freedombone.net" __status__ = "Production" import os +from utils import getNicknameFromActor +from utils import getDomainFromActor +from posts import getPublicPostDomains from webapp_timeline import htmlTimeline from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter +from blocking import isBlockedDomain def htmlModeration(cssCache: {}, defaultTimeline: str, @@ -27,7 +31,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str, iconsAsButtons: bool, rssIconAtTop: bool, publishButtonAtTop: bool, - authorized: bool) -> str: + authorized: bool, moderationActionStr: str) -> str: """Show the moderation feed as html This is what you see when selecting the "mod" timeline """ @@ -41,15 +45,77 @@ def htmlModeration(cssCache: {}, defaultTimeline: str, newswire, False, False, positiveVoting, showPublishAsIcon, fullWidthTimelineButtonHeader, iconsAsButtons, rssIconAtTop, publishButtonAtTop, - authorized) + authorized, moderationActionStr) + + +def htmlAccountInfo(cssCache: {}, translate: {}, + baseDir: str, httpPrefix: str, + nickname: str, domain: str, port: int, + searchHandle: str, debug: bool) -> str: + """Shows which domains a search handle interacts with. + This screen is shown if a moderator enters a handle and selects info + on the moderation screen + """ + msgStr1 = 'This account interacts with the following instances' + + infoForm = '' + cssFilename = baseDir + '/epicyon-profile.css' + if os.path.isfile(baseDir + '/epicyon.css'): + cssFilename = baseDir + '/epicyon.css' + + infoForm = htmlHeaderWithExternalStyle(cssFilename) + + searchNickname = getNicknameFromActor(searchHandle) + searchDomain, searchPort = getDomainFromActor(searchHandle) + + searchHandle = searchNickname + '@' + searchDomain + infoForm += \ + '

' + \ + translate['Account Information'] + ': ' + searchHandle + '


' + + infoForm += translate[msgStr1] + '


' + + proxyType = 'tor' + domainList = [] + domainList = getPublicPostDomains(None, + baseDir, searchNickname, searchDomain, + proxyType, searchPort, + httpPrefix, debug, + __version__, domainList) + infoForm += '
' + usersPath = '/users/' + nickname + '/accountinfo' + for postDomain in domainList: + infoForm += '' + postDomain + ' ' + if isBlockedDomain(baseDir, postDomain): + infoForm += \ + '' + infoForm += '' + else: + infoForm += \ + '' + infoForm += '' + infoForm += '
' + + infoForm += '
' + infoForm += htmlFooter() + return infoForm def htmlModerationInfo(cssCache: {}, translate: {}, - baseDir: str, httpPrefix: str) -> str: + baseDir: str, httpPrefix: str, + nickname: str) -> str: msgStr1 = \ 'These are globally blocked for all accounts on this instance' msgStr2 = \ 'Any blocks or suspensions made by moderators will be shown here.' + infoForm = '' cssFilename = baseDir + '/epicyon-profile.css' if os.path.isfile(baseDir + '/epicyon.css'): @@ -58,9 +124,9 @@ def htmlModerationInfo(cssCache: {}, translate: {}, infoForm = htmlHeaderWithExternalStyle(cssFilename) infoForm += \ - '

' + \ + '

' + \ translate['Moderation Information'] + \ - '

' + '


' infoShown = False suspendedFilename = baseDir + '/accounts/suspended.txt' diff --git a/webapp_timeline.py b/webapp_timeline.py index 43459c655..ca71c10d3 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -58,7 +58,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, iconsAsButtons: bool, rssIconAtTop: bool, publishButtonAtTop: bool, - authorized: bool) -> str: + authorized: bool, + moderationActionStr: str) -> str: """Show the timeline as html """ enableTimingLog = False @@ -441,8 +442,13 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, idx = 'Nickname or URL. Block using *@domain or nickname@domain' tlStr += \ ' ' + translate[idx] + '
\n' - tlStr += '
\n' + if moderationActionStr: + tlStr += '
\n' + else: + tlStr += '
\n' tlStr += \ '