__filename__ = "webinterface.py" __author__ = "Bob Mottram" __license__ = "AGPL3+" __version__ = "0.0.1" __maintainer__ = "Bob Mottram" __email__ = "bob@freedombone.net" __status__ = "Production" import json from person import personBoxJson from utils import getNicknameFromActor from utils import getDomainFromActor def htmlHeader(css=None,lang='en') -> str: if not css: htmlStr= \ '\n' \ '\n' \ ' \n' \ ' \n' \ '
\n' else: htmlStr= \ '\n' \ '\n' \ ' \n' \ ' \n' \ ' \n' return htmlStr def htmlFooter() -> str: htmlStr= \ ' \n' \ '\n' return htmlStr def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool,ocapAlways: bool,profileJson: {}) -> str: """Show the profile page as html """ nickname=profileJson['name'] if not nickname: return "" preferredName=profileJson['preferredUsername'] domain,port=getDomainFromActor(profileJson['id']) if not domain: return "" domainFull=domain if port: domainFull=domain+':'+str(port) profileDescription=profileJson['publicKey']['summary'] profileDescription='A test description' profileStr= \ '@'+nickname+'@'+domainFull+'
' \ ''+profileDescription+'
' \ ''+titleStr+'
'+ \ postJsonObject['object']['content']+'\n'+ \ attachmentStr+ \ ''+postJsonObject['object']['published']+'\n'+ \ '