About screen

master
Bob Mottram 2019-08-26 17:02:47 +01:00
parent 3a993e5d49
commit 91981c7953
3 changed files with 50 additions and 0 deletions

View File

@ -76,6 +76,7 @@ from roles import setRole
from roles import clearModeratorStatus
from skills import outboxSkills
from availability import outboxAvailability
from webinterface import htmlAbout
from webinterface import htmlRemoveSharedItem
from webinterface import htmlInboxDMs
from webinterface import htmlUnblockConfirm
@ -792,6 +793,15 @@ class PubServer(BaseHTTPRequestHandler):
self.server.GETbusy=False
return
if self.path.startswith('/about'):
msg=htmlAbout(self.server.baseDir, \
self.server.httpPrefix, \
self.server.domainFull).encode()
self._login_headers('text/html',len(msg))
self.wfile.write(msg)
self.server.GETbusy=False
return
if self.path.startswith('/login') or self.path=='/':
# request basic auth
msg=htmlLogin(self.server.baseDir).encode('utf-8')

13
default_about.txt 100644
View File

@ -0,0 +1,13 @@
<h1>About this Instance</h1>
<h3>Origin Story</h3>
<p>How your instance began.</p>
<h3>Lore</h3>
<p>Customs and rituals.</p>
<h3>Epic Tales</h3>
<p>Heroic deeds and dastardly foes.</p>

View File

@ -523,6 +523,33 @@ def htmlTermsOfService(baseDir: str,httpPrefix: str,domainFull: str) -> str:
TOSForm+=htmlFooter()
return TOSForm
def htmlAbout(baseDir: str,httpPrefix: str,domainFull: str) -> str:
"""Show the about screen
"""
adminNickname = getConfigParam(baseDir,'admin')
if not os.path.isfile(baseDir+'/accounts/about.txt'):
copyfile(baseDir+'/default_about.txt',baseDir+'/accounts/about.txt')
if os.path.isfile(baseDir+'/img/login-background.png'):
if not os.path.isfile(baseDir+'/accounts/login-background.png'):
copyfile(baseDir+'/img/login-background.png',baseDir+'/accounts/login-background.png')
aboutText='Information about this instance goes here.'
if os.path.isfile(baseDir+'/accounts/about.txt'):
with open(baseDir+'/accounts/about.txt', 'r') as file:
aboutText = file.read()
aboutForm=''
with open(baseDir+'/epicyon-profile.css', 'r') as cssFile:
termsCSS = cssFile.read()
aboutForm=htmlHeader(termsCSS)
aboutForm+='<div class="container">'+aboutText+'</div>'
if adminNickname:
adminActor=httpPrefix+'://'+domainFull+'/users/'+adminNickname
aboutForm+='<div class="container"><center><p class="administeredby">Administered by <a href="'+adminActor+'">'+adminNickname+'</a></p></center></div>'
aboutForm+=htmlFooter()
return aboutForm
def htmlHashtagBlocked(baseDir: str) -> str:
"""Show the screen for a blocked hashtag
"""