Account info screen

main
Bob Mottram 2020-12-09 22:55:15 +00:00
parent 1e52123c0d
commit ef87a23079
19 changed files with 175 additions and 24 deletions

View File

@ -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
@ -1440,10 +1441,27 @@ class PubServer(BaseHTTPRequestHandler):
moderationText = \
urllib.parse.unquote_plus(modText.strip())
elif moderationStr.startswith('submitInfo'):
msg = htmlModerationInfo(self.server.cssCache,
self.server.translate,
baseDir, httpPrefix,
nickname)
searchHandle = \
urllib.parse.unquote_plus(moderationStr.strip())
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)
@ -10978,6 +10996,42 @@ 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:
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]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
addGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False
# TODO this should go back to the account info screen
self._redirect_headers('/users/' + nickname + '/moderation',
cookie, callingDomain)
return
# unblock a domain from htmlAccountInfo
if authorized and '/users/' in self.path and \
'/accountinfo?unblockdomain=' 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]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
removeGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False
# TODO this should go back to the account info screen
self._redirect_headers('/users/' + nickname + '/moderation',
cookie, callingDomain)
return
# get the bookmarks timeline for a given person
if self.path.endswith('/tlbookmarks') or \
'/tlbookmarks?page=' in self.path or \

View File

@ -930,6 +930,10 @@ div.container {
overflow: hidden;
}
.accountInfoDomains {
margin: 0 10%;
}
@media screen and (min-width: 400px) {
body, html {
background-color: var(--main-bg-color);

View File

@ -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:

View File

@ -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": "يتفاعل هذا الحساب مع الحالات التالية"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "यह खाता निम्नलिखित उदाहरणों के साथ सहभागिता करता है"
}

View File

@ -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"
}

View File

@ -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": "このアカウントは、次のインスタンスと相互作用します"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "Этот аккаунт взаимодействует со следующими экземплярами"
}

View File

@ -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": "此帐户与以下实例进行交互"
}

View File

@ -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,
@ -44,6 +48,63 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
authorized)
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)
infoForm += \
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
translate['Account Information'] + \
': ' + searchNickname + '@' + searchDomain + \
'</a></h1><br><br>'
infoForm += translate[msgStr1] + '</center><br><br>'
proxyType = 'tor'
domainList = []
domainList = getPublicPostDomains(None,
baseDir, searchNickname, searchDomain,
proxyType, searchPort,
httpPrefix, debug,
__version__, domainList)
infoForm += '<div class="accountInfoDomains">'
usersPath = '/users/' + nickname + '/accountinfo'
for postDomain in domainList:
infoForm += '<a href="' + \
httpPrefix + '://' + postDomain + '">' + postDomain + '</a> '
if isBlockedDomain(postDomain):
infoForm += \
'<a href="' + usersPath + '?unblockdomain=' + postDomain + '">'
infoForm += '<button class="buttonhighlighted"><span>' + \
translate['Unblock'] + '</span></button></a>'
else:
infoForm += \
'<a href="' + usersPath + '?blockdomain=' + postDomain + '">'
infoForm += '<button class="button"><span>' + \
translate['Block'] + '</span></button></a>'
infoForm += '<br>'
infoForm += '</div>'
infoForm += htmlFooter()
return infoForm
def htmlModerationInfo(cssCache: {}, translate: {},
baseDir: str, httpPrefix: str,
nickname: str) -> str:
@ -51,6 +112,7 @@ def htmlModerationInfo(cssCache: {}, translate: {},
'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'):
@ -61,7 +123,7 @@ def htmlModerationInfo(cssCache: {}, translate: {},
infoForm += \
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
translate['Moderation Information'] + \
'</a></h1></center>'
'</a></h1></center><br>'
infoShown = False
suspendedFilename = baseDir + '/accounts/suspended.txt'