From 71d65ad07aeaa0c91f40c3d783af6082432cd198 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 10 Aug 2019 16:33:18 +0100 Subject: [PATCH] Add administered by link to terms --- daemon.py | 4 +++- epicyon-profile.css | 4 ++++ epicyon.py | 13 ++++++++++++- webinterface.py | 6 +++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index 884b00ce5..a6305de5b 100644 --- a/daemon.py +++ b/daemon.py @@ -634,7 +634,9 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/terms'): self._login_headers('text/html') - self.wfile.write(htmlTermsOfService(self.server.baseDir).encode()) + self.wfile.write(htmlTermsOfService(self.server.baseDir, \ + self.server.httpPrefix, \ + self.server.domainFull).encode()) self.server.GETbusy=False return diff --git a/epicyon-profile.css b/epicyon-profile.css index 6865d1604..9564c0f24 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -280,6 +280,10 @@ body, html { margin: 10px 0; } +.container p.administeredby { + font-size: 18px; +} + .container::after { content: ""; clear: both; diff --git a/epicyon.py b/epicyon.py index ffce90015..e567fca1f 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1195,6 +1195,16 @@ if args.testdata: if os.path.isdir(baseDir+'/tags'): shutil.rmtree(baseDir+'/tags') + if os.path.isdir(baseDir+'/accounts'): + shutil.rmtree(baseDir+'/accounts') + if os.path.isdir(baseDir+'/keys'): + shutil.rmtree(baseDir+'/keys') + if os.path.isdir(baseDir+'/media'): + shutil.rmtree(baseDir+'/media') + if os.path.isdir(baseDir+'/sharefiles'): + shutil.rmtree(baseDir+'/sharefiles') + if os.path.isdir(baseDir+'/wfendpoints'): + shutil.rmtree(baseDir+'/wfendpoints') setConfigParam(baseDir,'registrationsRemaining',str(maxRegistrations)) @@ -1206,7 +1216,7 @@ if args.testdata: createPerson(baseDir,nickname,domain,port,httpPrefix,True,'likewhateveryouwantscoob') setSkillLevel(baseDir,nickname,domain,'testing',60) setSkillLevel(baseDir,nickname,domain,'typing',50) - setRole(baseDir,nickname,domain,'epicyon','tester') + setRole(baseDir,nickname,domain,'instance','admin') setRole(baseDir,nickname,domain,'epicyon','hacker') setRole(baseDir,nickname,domain,'someproject','assistant') setAvailability(baseDir,nickname,domain,'busy') @@ -1251,6 +1261,7 @@ if args.testdata: followPerson(baseDir,nickname,domain,'drokk',domainFull,federationList,False) followerOfPerson(baseDir,nickname,domain,'drokk',domainFull,federationList,False) followerOfPerson(baseDir,nickname,domain,'maxboardroom',domainFull,federationList,False) + setConfigParam(baseDir,'admin',nickname) runDaemon(instanceId,args.client,baseDir, \ domain,port,httpPrefix, \ diff --git a/webinterface.py b/webinterface.py index c7183178a..dc3031d92 100644 --- a/webinterface.py +++ b/webinterface.py @@ -288,7 +288,8 @@ def htmlLogin(baseDir: str) -> str: loginForm+=htmlFooter() return loginForm -def htmlTermsOfService(baseDir: str) -> str: +def htmlTermsOfService(baseDir: str,httpPrefix: str,domainFull: str) -> str: + adminNickname = getConfigParam(baseDir,'admin') if not os.path.isfile(baseDir+'/accounts/tos.txt'): copyfile(baseDir+'/default_tos.txt',baseDir+'/accounts/tos.txt') if os.path.isfile(baseDir+'/img/login-background.png'): @@ -306,6 +307,9 @@ def htmlTermsOfService(baseDir: str) -> str: TOSForm=htmlHeader(termsCSS) TOSForm+='
'+TOSText+'
' + if adminNickname: + adminActor=httpPrefix+'://'+domainFull+'/users/'+adminNickname + TOSForm+='

Administered by '+adminNickname+'

' TOSForm+=htmlFooter() return TOSForm