2020-11-10 10:25:21 +00:00
|
|
|
__filename__ = "webapp_about.py"
|
|
|
|
__author__ = "Bob Mottram"
|
|
|
|
__license__ = "AGPL3+"
|
2021-01-26 10:07:42 +00:00
|
|
|
__version__ = "1.2.0"
|
2020-11-10 10:25:21 +00:00
|
|
|
__maintainer__ = "Bob Mottram"
|
2021-09-10 16:14:50 +00:00
|
|
|
__email__ = "bob@libreserver.org"
|
2020-11-10 10:25:21 +00:00
|
|
|
__status__ = "Production"
|
2021-06-15 15:08:12 +00:00
|
|
|
__module_group__ = "Web Interface"
|
2020-11-10 10:25:21 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
from shutil import copyfile
|
2021-12-26 14:08:58 +00:00
|
|
|
from utils import get_config_param
|
2021-05-14 11:56:23 +00:00
|
|
|
from webapp_utils import htmlHeaderWithWebsiteMarkup
|
2020-11-10 10:25:21 +00:00
|
|
|
from webapp_utils import htmlFooter
|
2021-06-25 14:38:31 +00:00
|
|
|
from markdown import markdownToHtml
|
2020-11-10 10:25:21 +00:00
|
|
|
|
|
|
|
|
2021-12-25 17:09:22 +00:00
|
|
|
def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
2021-12-26 10:00:46 +00:00
|
|
|
domain_full: str, onion_domain: str, translate: {},
|
2021-12-25 23:03:28 +00:00
|
|
|
system_language: str) -> str:
|
2020-11-10 10:25:21 +00:00
|
|
|
"""Show the about screen
|
|
|
|
"""
|
2021-12-26 14:08:58 +00:00
|
|
|
adminNickname = get_config_param(base_dir, 'admin')
|
2021-12-25 16:17:53 +00:00
|
|
|
if not os.path.isfile(base_dir + '/accounts/about.md'):
|
|
|
|
copyfile(base_dir + '/default_about.md',
|
|
|
|
base_dir + '/accounts/about.md')
|
2020-11-10 10:25:21 +00:00
|
|
|
|
2021-12-25 16:17:53 +00:00
|
|
|
if os.path.isfile(base_dir + '/accounts/login-background-custom.jpg'):
|
|
|
|
if not os.path.isfile(base_dir + '/accounts/login-background.jpg'):
|
|
|
|
copyfile(base_dir + '/accounts/login-background-custom.jpg',
|
|
|
|
base_dir + '/accounts/login-background.jpg')
|
2020-11-10 10:25:21 +00:00
|
|
|
|
|
|
|
aboutText = 'Information about this instance goes here.'
|
2021-12-25 16:17:53 +00:00
|
|
|
if os.path.isfile(base_dir + '/accounts/about.md'):
|
|
|
|
with open(base_dir + '/accounts/about.md', 'r') as aboutFile:
|
2021-06-21 22:52:04 +00:00
|
|
|
aboutText = markdownToHtml(aboutFile.read())
|
2020-11-10 10:25:21 +00:00
|
|
|
|
|
|
|
aboutForm = ''
|
2021-12-25 16:17:53 +00:00
|
|
|
cssFilename = base_dir + '/epicyon-profile.css'
|
|
|
|
if os.path.isfile(base_dir + '/epicyon.css'):
|
|
|
|
cssFilename = base_dir + '/epicyon.css'
|
2020-11-10 10:25:21 +00:00
|
|
|
|
2021-01-11 19:46:21 +00:00
|
|
|
instanceTitle = \
|
2021-12-26 14:08:58 +00:00
|
|
|
get_config_param(base_dir, 'instanceTitle')
|
2021-05-14 11:56:23 +00:00
|
|
|
aboutForm = \
|
|
|
|
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
|
2021-12-26 10:00:46 +00:00
|
|
|
http_prefix, domain_full,
|
2021-12-25 23:03:28 +00:00
|
|
|
system_language)
|
2020-11-12 17:05:38 +00:00
|
|
|
aboutForm += '<div class="container">' + aboutText + '</div>'
|
2021-12-25 20:43:43 +00:00
|
|
|
if onion_domain:
|
2020-11-12 17:05:38 +00:00
|
|
|
aboutForm += \
|
|
|
|
'<div class="container"><center>\n' + \
|
|
|
|
'<p class="administeredby">' + \
|
2021-12-25 20:43:43 +00:00
|
|
|
'http://' + onion_domain + '</p>\n</center></div>\n'
|
2020-11-12 17:05:38 +00:00
|
|
|
if adminNickname:
|
|
|
|
adminActor = '/users/' + adminNickname
|
|
|
|
aboutForm += \
|
|
|
|
'<div class="container"><center>\n' + \
|
2021-01-25 20:37:27 +00:00
|
|
|
'<p class="administeredby">' + \
|
|
|
|
translate['Administered by'] + ' <a href="' + \
|
|
|
|
adminActor + '">' + adminNickname + '</a>. ' + \
|
|
|
|
translate['Version'] + ' ' + __version__ + \
|
|
|
|
'</p>\n</center></div>\n'
|
2020-11-12 17:05:38 +00:00
|
|
|
aboutForm += htmlFooter()
|
2020-11-10 10:25:21 +00:00
|
|
|
return aboutForm
|