forked from indymedia/epicyon
Translate login screen
parent
5c44b93fb0
commit
c25b373ee2
17
daemon.py
17
daemon.py
|
@ -898,7 +898,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
if self.path.startswith('/login') or self.path=='/':
|
||||
# request basic auth
|
||||
msg=htmlLogin(self.server.baseDir).encode('utf-8')
|
||||
msg=htmlLogin(self.server.translate,self.server.baseDir).encode('utf-8')
|
||||
self._login_headers('text/html',len(msg))
|
||||
self.wfile.write(msg)
|
||||
self.server.GETbusy=False
|
||||
|
@ -1601,7 +1601,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
maxPostsInFeed, 'inbox', \
|
||||
True,self.server.ocapAlways)
|
||||
msg=htmlInbox(pageNumber,maxPostsInFeed, \
|
||||
msg=htmlInbox(self.server.translate, \
|
||||
pageNumber,maxPostsInFeed, \
|
||||
self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
|
@ -1666,7 +1667,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
maxPostsInFeed, 'dm', \
|
||||
True,self.server.ocapAlways)
|
||||
msg=htmlInboxDMs(pageNumber,maxPostsInFeed, \
|
||||
msg=htmlInboxDMs(self.server.translate, \
|
||||
pageNumber,maxPostsInFeed, \
|
||||
self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
|
@ -1726,7 +1728,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
maxPostsInFeed, 'outbox', \
|
||||
authorized, \
|
||||
self.server.ocapAlways)
|
||||
msg=htmlOutbox(pageNumber,maxPostsInFeed, \
|
||||
msg=htmlOutbox(self.server.translate, \
|
||||
pageNumber,maxPostsInFeed, \
|
||||
self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
|
@ -1780,7 +1783,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
maxPostsInFeed, 'moderation', \
|
||||
True,self.server.ocapAlways)
|
||||
msg=htmlModeration(pageNumber,maxPostsInFeed, \
|
||||
msg=htmlModeration(self.server.translate, \
|
||||
pageNumber,maxPostsInFeed, \
|
||||
self.server.session, \
|
||||
self.server.baseDir, \
|
||||
self.server.cachedWebfingers, \
|
||||
|
@ -2656,7 +2660,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
moderationText=moderationStr.split('=')[1].strip()
|
||||
moderationText=moderationText.replace('+',' ').replace('%40','@').replace('%3A',':').replace('%23','#').strip()
|
||||
elif moderationStr.startswith('submitInfo'):
|
||||
msg=htmlModerationInfo(self.server.baseDir).encode('utf-8')
|
||||
msg=htmlModerationInfo(self.server.translate, \
|
||||
self.server.baseDir).encode('utf-8')
|
||||
self._login_headers('text/html',len(msg))
|
||||
self.wfile.write(msg)
|
||||
self.server.POSTbusy=False
|
||||
|
|
|
@ -90,5 +90,21 @@
|
|||
"Stop blocking": "Stop blocking",
|
||||
"Enter an emoji name to search for": "Enter an emoji name to search for",
|
||||
"Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Enter an address, shared item, #hashtag, *skill or :emoji: to search for",
|
||||
"Go Back": "Go Back"
|
||||
"Go Back": "Go Back",
|
||||
"Moderation Information": "Moderation Information",
|
||||
"Suspended accounts": "Suspended accounts",
|
||||
"These are currently suspended": "These are currently suspended",
|
||||
"Blocked accounts and hashtags": "Blocked accounts and hashtags",
|
||||
"These are globally blocked for all accounts on this instance": "These are globally blocked for all accounts on this instance",
|
||||
"Any blocks or suspensions made by moderators will be shown here.": "Any blocks or suspensions made by moderators will be shown here.",
|
||||
"Welcome. Please enter your login details below.": "Welcome. Please enter your login details below.",
|
||||
"Welcome. Please login or register a new account.": "Welcome. Please login or register a new account.",
|
||||
"Please enter some credentials": "Please enter some credentials",
|
||||
"You will become the admin of this site.": "You will become the admin of this site.",
|
||||
"Terms of Service": "Terms of Service",
|
||||
"About this Instance": "About this Instance",
|
||||
"Nickname": "Nickname",
|
||||
"Enter Nickname": "Enter Nickname",
|
||||
"Password": "Password",
|
||||
"Enter Password": "Enter Password"
|
||||
}
|
||||
|
|
|
@ -90,5 +90,21 @@
|
|||
"Stop blocking": "Arrêtez le blocage",
|
||||
"Enter an emoji name to search for": "Entrez un nom emoji à rechercher",
|
||||
"Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Entrez une adresse, un objet partagé, #hashtag, * skill ou: emoji: à rechercher",
|
||||
"Go Back": "Retourner"
|
||||
"Go Back": "Retourner",
|
||||
"Moderation Information": "Informations de modération",
|
||||
"Suspended accounts": "Comptes suspendus",
|
||||
"These are currently suspended": "Ceux-ci sont actuellement suspendus",
|
||||
"Blocked accounts and hashtags": "Comptes bloqués et hashtags",
|
||||
"These are globally blocked for all accounts on this instance": "Ceux-ci sont globalement bloqués pour tous les comptes sur cette instance.",
|
||||
"Any blocks or suspensions made by moderators will be shown here.": "Tous les blocages ou suspensions réalisés par les modérateurs seront affichés ici.",
|
||||
"Welcome. Please enter your login details below.": "Bienvenue. S'il vous plaît entrer vos informations de connexion ci-dessous.",
|
||||
"Welcome. Please login or register a new account.": "Bienvenue. Veuillez vous connecter ou créer un nouveau compte.",
|
||||
"Please enter some credentials": "S'il vous plaît entrer des informations d'identification",
|
||||
"You will become the admin of this site.": "Vous allez devenir l'administrateur de ce site.",
|
||||
"Terms of Service": "Conditions d'utilisation",
|
||||
"About this Instance": "A propos de cette instance",
|
||||
"Nickname": "Pseudo",
|
||||
"Enter Nickname": "Entrez le pseudo",
|
||||
"Password": "Mot de passe",
|
||||
"Enter Password": "Entrer le mot de passe"
|
||||
}
|
||||
|
|
|
@ -184,13 +184,13 @@ def htmlSearchSharedItems(baseDir: str,searchStr: str, \
|
|||
sharedItemsForm+=htmlFooter()
|
||||
return sharedItemsForm
|
||||
|
||||
def htmlModerationInfo(baseDir: str) -> str:
|
||||
def htmlModerationInfo(translate: {},baseDir: str) -> str:
|
||||
infoForm=''
|
||||
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
|
||||
infoCSS=cssFile.read()
|
||||
infoForm=htmlHeader(infoCSS)
|
||||
|
||||
infoForm+='<center><h1>Moderation Information</h1></center>'
|
||||
infoForm+='<center><h1>'+translate['Moderation Information']+'</h1></center>'
|
||||
|
||||
infoShown=False
|
||||
suspendedFilename=baseDir+'/accounts/suspended.txt'
|
||||
|
@ -199,8 +199,8 @@ def htmlModerationInfo(baseDir: str) -> str:
|
|||
suspendedStr = f.read()
|
||||
infoForm+= \
|
||||
'<div class="container">' \
|
||||
' <br><b>Suspended accounts</b>' \
|
||||
' <br>These are currently suspended' \
|
||||
' <br><b>'+translate['Suspended accounts']+'</b>' \
|
||||
' <br>'+translate['These are currently suspended']+ \
|
||||
' <textarea id="message" name="suspended" style="height:200px">'+suspendedStr+'</textarea>' \
|
||||
'</div>'
|
||||
infoShown=True
|
||||
|
@ -211,13 +211,13 @@ def htmlModerationInfo(baseDir: str) -> str:
|
|||
blockedStr = f.read()
|
||||
infoForm+= \
|
||||
'<div class="container">' \
|
||||
' <br><b>Blocked accounts and hashtags</b>' \
|
||||
' <br>These are globally blocked for all accounts on this instance' \
|
||||
' <br><b>'+translate['Blocked accounts and hashtags']+'</b>' \
|
||||
' <br>'+translate['These are globally blocked for all accounts on this instance']+ \
|
||||
' <textarea id="message" name="blocked" style="height:200px">'+blockedStr+'</textarea>' \
|
||||
'</div>'
|
||||
infoShown=True
|
||||
if not infoShown:
|
||||
infoForm+='<center><p>Any blocks or suspensions made by moderators will be shown here.</p></center>'
|
||||
infoForm+='<center><p>'+translate['Any blocks or suspensions made by moderators will be shown here.']+'</p></center>'
|
||||
infoForm+=htmlFooter()
|
||||
return infoForm
|
||||
|
||||
|
@ -542,7 +542,7 @@ def htmlGetLoginCredentials(loginParams: str,lastLoginTime: int) -> (str,str,boo
|
|||
register=True
|
||||
return nickname,password,register
|
||||
|
||||
def htmlLogin(baseDir: str) -> str:
|
||||
def htmlLogin(translate: {},baseDir: str) -> str:
|
||||
"""Shows the login screen
|
||||
"""
|
||||
accounts=noOfAccounts(baseDir)
|
||||
|
@ -554,9 +554,10 @@ def htmlLogin(baseDir: str) -> str:
|
|||
copyfile(baseDir+'/img/login-background.png',baseDir+'/accounts/login-background.png')
|
||||
|
||||
if accounts>0:
|
||||
loginText='<p class="login-text">Welcome. Please enter your login details below.</p>'
|
||||
loginText='<p class="login-text">'+translate['Welcome. Please enter your login details below.']+'</p>'
|
||||
else:
|
||||
loginText='<p class="login-text">Please enter some credentials</p><p>You will become the admin of this site.</p>'
|
||||
loginText='<p class="login-text">'+translate['Please enter some credentials']+'</p>'
|
||||
loginText+='<p class="login-text">'+translate['You will become the admin of this site.']+'</p>'
|
||||
if os.path.isfile(baseDir+'/accounts/login.txt'):
|
||||
# custom login message
|
||||
with open(baseDir+'/accounts/login.txt', 'r') as file:
|
||||
|
@ -570,15 +571,15 @@ def htmlLogin(baseDir: str) -> str:
|
|||
if getConfigParam(baseDir,'registration')=='open':
|
||||
if int(getConfigParam(baseDir,'registrationsRemaining'))>0:
|
||||
if accounts>0:
|
||||
loginText='<p class="login-text">Welcome. Please login or register a new account.</p>'
|
||||
loginText='<p class="login-text">'+translate['Welcome. Please login or register a new account.']+'</p>'
|
||||
registerButtonStr='<button type="submit" name="register">Register</button>'
|
||||
|
||||
TOSstr='<p class="login-text"><a href="/terms">Terms of Service</a></p>'
|
||||
TOSstr+='<p class="login-text"><a href="/about">About this Instance</a></p>'
|
||||
TOSstr='<p class="login-text"><a href="/terms">'+translate['Terms of Service']+'</a></p>'
|
||||
TOSstr+='<p class="login-text"><a href="/about">'+translate['About this Instance']+'</a></p>'
|
||||
|
||||
loginButtonStr=''
|
||||
if accounts>0:
|
||||
loginButtonStr='<button type="submit" name="submit">Login</button>'
|
||||
loginButtonStr='<button type="submit" name="submit">'+translate['Login']+'</button>'
|
||||
|
||||
loginForm=htmlHeader(loginCSS)
|
||||
loginForm+= \
|
||||
|
@ -589,11 +590,11 @@ def htmlLogin(baseDir: str) -> str:
|
|||
' </div>' \
|
||||
'' \
|
||||
' <div class="container">' \
|
||||
' <label for="nickname"><b>Nickname</b></label>' \
|
||||
' <input type="text" placeholder="Enter Nickname" name="username" required autofocus>' \
|
||||
' <label for="nickname"><b>'+translate['Nickname']+'</b></label>' \
|
||||
' <input type="text" placeholder="'+translate['Enter Nickname']+'" name="username" required autofocus>' \
|
||||
'' \
|
||||
' <label for="password"><b>Password</b></label>' \
|
||||
' <input type="password" placeholder="Enter Password" name="password" required>'+ \
|
||||
' <label for="password"><b>'+translate['Password']+'</b></label>' \
|
||||
' <input type="password" placeholder="'+translate['Enter Password']+'" name="password" required>'+ \
|
||||
registerButtonStr+loginButtonStr+ \
|
||||
' </div>' \
|
||||
'</form>'
|
||||
|
@ -1895,7 +1896,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
|||
tlStr+=htmlFooter()
|
||||
return tlStr
|
||||
|
||||
def htmlInbox(pageNumber: int,itemsPerPage: int, \
|
||||
def htmlInbox(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||
allowDeletion: bool, \
|
||||
|
@ -1905,33 +1906,36 @@ def htmlInbox(pageNumber: int,itemsPerPage: int, \
|
|||
manuallyApproveFollowers= \
|
||||
followerApprovalActive(baseDir,nickname,domain)
|
||||
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
return htmlTimeline(translate,pageNumber, \
|
||||
itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,inboxJson,'inbox',allowDeletion, \
|
||||
httpPrefix,projectVersion,manuallyApproveFollowers)
|
||||
|
||||
def htmlInboxDMs(pageNumber: int,itemsPerPage: int, \
|
||||
def htmlInboxDMs(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||
allowDeletion: bool, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the DM timeline as html
|
||||
"""
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
return htmlTimeline(translate,pageNumber, \
|
||||
itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,inboxJson,'dm',allowDeletion, \
|
||||
httpPrefix,projectVersion,False)
|
||||
|
||||
def htmlModeration(pageNumber: int,itemsPerPage: int, \
|
||||
def htmlModeration(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||
allowDeletion: bool, \
|
||||
httpPrefix: str,projectVersion: str) -> str:
|
||||
"""Show the moderation feed as html
|
||||
"""
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
return htmlTimeline(translate,pageNumber, \
|
||||
itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,inboxJson,'moderation',allowDeletion, \
|
||||
httpPrefix,projectVersion,True)
|
||||
|
||||
def htmlOutbox(pageNumber: int,itemsPerPage: int, \
|
||||
def htmlOutbox(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||
nickname: str,domain: str,port: int,outboxJson: {}, \
|
||||
allowDeletion: bool,
|
||||
|
@ -1940,7 +1944,8 @@ def htmlOutbox(pageNumber: int,itemsPerPage: int, \
|
|||
"""
|
||||
manuallyApproveFollowers= \
|
||||
followerApprovalActive(baseDir,nickname,domain)
|
||||
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
return htmlTimeline(translate,pageNumber, \
|
||||
itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||
nickname,domain,port,outboxJson,'outbox',allowDeletion, \
|
||||
httpPrefix,projectVersion,manuallyApproveFollowers)
|
||||
|
||||
|
|
Loading…
Reference in New Issue