forked from indymedia/epicyon
More webapp modules
parent
3662105259
commit
087b7b65c6
10
daemon.py
10
daemon.py
|
@ -117,9 +117,9 @@ from webapp_utils import setBlogAddress
|
||||||
from webapp_utils import getBlogAddress
|
from webapp_utils import getBlogAddress
|
||||||
from webapp_calendar import htmlCalendarDeleteConfirm
|
from webapp_calendar import htmlCalendarDeleteConfirm
|
||||||
from webapp_calendar import htmlCalendar
|
from webapp_calendar import htmlCalendar
|
||||||
|
from webapp_about import htmlAbout
|
||||||
from webapp import htmlFollowingList
|
from webapp import htmlFollowingList
|
||||||
from webapp import htmlDeletePost
|
from webapp import htmlDeletePost
|
||||||
from webapp import htmlAbout
|
|
||||||
from webapp import htmlRemoveSharedItem
|
from webapp import htmlRemoveSharedItem
|
||||||
from webapp import htmlUnblockConfirm
|
from webapp import htmlUnblockConfirm
|
||||||
from webapp_person_options import htmlPersonOptions
|
from webapp_person_options import htmlPersonOptions
|
||||||
|
@ -133,15 +133,15 @@ from webapp_timeline import htmlInboxMedia
|
||||||
from webapp_timeline import htmlInboxBlogs
|
from webapp_timeline import htmlInboxBlogs
|
||||||
from webapp_timeline import htmlInboxNews
|
from webapp_timeline import htmlInboxNews
|
||||||
from webapp_timeline import htmlOutbox
|
from webapp_timeline import htmlOutbox
|
||||||
from webapp_timeline import htmlModeration
|
from webapp_moderation import htmlModeration
|
||||||
|
from webapp_moderation import htmlModerationInfo
|
||||||
from webapp_create_post import htmlNewPost
|
from webapp_create_post import htmlNewPost
|
||||||
from webapp_login import htmlLogin
|
from webapp_login import htmlLogin
|
||||||
from webapp_login import htmlGetLoginCredentials
|
from webapp_login import htmlGetLoginCredentials
|
||||||
from webapp import htmlSuspended
|
from webapp_suspended import htmlSuspended
|
||||||
|
from webapp_tos import htmlTermsOfService
|
||||||
from webapp import htmlFollowConfirm
|
from webapp import htmlFollowConfirm
|
||||||
from webapp import htmlUnfollowConfirm
|
from webapp import htmlUnfollowConfirm
|
||||||
from webapp import htmlTermsOfService
|
|
||||||
from webapp import htmlModerationInfo
|
|
||||||
from webapp import htmlHashtagBlocked
|
from webapp import htmlHashtagBlocked
|
||||||
from webapp_post import htmlPostReplies
|
from webapp_post import htmlPostReplies
|
||||||
from webapp_post import htmlIndividualPost
|
from webapp_post import htmlIndividualPost
|
||||||
|
|
177
webapp.py
177
webapp.py
|
@ -13,7 +13,6 @@ from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
|
||||||
from shares import getValidSharedItemID
|
from shares import getValidSharedItemID
|
||||||
from webapp_utils import getAltPath
|
from webapp_utils import getAltPath
|
||||||
from webapp_utils import getIconsDir
|
from webapp_utils import getIconsDir
|
||||||
|
@ -48,163 +47,6 @@ def htmlFollowingList(cssCache: {}, baseDir: str,
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def htmlModerationInfo(cssCache: {}, translate: {},
|
|
||||||
baseDir: str, httpPrefix: str) -> str:
|
|
||||||
msgStr1 = \
|
|
||||||
'These are globally blocked for all accounts on this instance'
|
|
||||||
msgStr2 = \
|
|
||||||
'Any blocks or suspensions made by moderators will be shown here.'
|
|
||||||
infoForm = ''
|
|
||||||
cssFilename = baseDir + '/epicyon-profile.css'
|
|
||||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
|
||||||
cssFilename = baseDir + '/epicyon.css'
|
|
||||||
|
|
||||||
infoCSS = getCSS(baseDir, cssFilename, cssCache)
|
|
||||||
if infoCSS:
|
|
||||||
if httpPrefix != 'https':
|
|
||||||
infoCSS = infoCSS.replace('https://',
|
|
||||||
httpPrefix + '://')
|
|
||||||
infoForm = htmlHeader(cssFilename, infoCSS)
|
|
||||||
|
|
||||||
infoForm += \
|
|
||||||
'<center><h1>' + \
|
|
||||||
translate['Moderation Information'] + \
|
|
||||||
'</h1></center>'
|
|
||||||
|
|
||||||
infoShown = False
|
|
||||||
suspendedFilename = baseDir + '/accounts/suspended.txt'
|
|
||||||
if os.path.isfile(suspendedFilename):
|
|
||||||
with open(suspendedFilename, "r") as f:
|
|
||||||
suspendedStr = f.read()
|
|
||||||
infoForm += '<div class="container">'
|
|
||||||
infoForm += ' <br><b>' + \
|
|
||||||
translate['Suspended accounts'] + '</b>'
|
|
||||||
infoForm += ' <br>' + \
|
|
||||||
translate['These are currently suspended']
|
|
||||||
infoForm += \
|
|
||||||
' <textarea id="message" ' + \
|
|
||||||
'name="suspended" style="height:200px">' + \
|
|
||||||
suspendedStr + '</textarea>'
|
|
||||||
infoForm += '</div>'
|
|
||||||
infoShown = True
|
|
||||||
|
|
||||||
blockingFilename = baseDir + '/accounts/blocking.txt'
|
|
||||||
if os.path.isfile(blockingFilename):
|
|
||||||
with open(blockingFilename, "r") as f:
|
|
||||||
blockedStr = f.read()
|
|
||||||
infoForm += '<div class="container">'
|
|
||||||
infoForm += \
|
|
||||||
' <br><b>' + \
|
|
||||||
translate['Blocked accounts and hashtags'] + '</b>'
|
|
||||||
infoForm += \
|
|
||||||
' <br>' + \
|
|
||||||
translate[msgStr1]
|
|
||||||
infoForm += \
|
|
||||||
' <textarea id="message" ' + \
|
|
||||||
'name="blocked" style="height:700px">' + \
|
|
||||||
blockedStr + '</textarea>'
|
|
||||||
infoForm += '</div>'
|
|
||||||
infoShown = True
|
|
||||||
if not infoShown:
|
|
||||||
infoForm += \
|
|
||||||
'<center><p>' + \
|
|
||||||
translate[msgStr2] + \
|
|
||||||
'</p></center>'
|
|
||||||
infoForm += htmlFooter()
|
|
||||||
return infoForm
|
|
||||||
|
|
||||||
|
|
||||||
def htmlTermsOfService(cssCache: {}, baseDir: str,
|
|
||||||
httpPrefix: str, domainFull: str) -> str:
|
|
||||||
"""Show the terms of service screen
|
|
||||||
"""
|
|
||||||
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 + '/accounts/login-background-custom.jpg'):
|
|
||||||
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
|
||||||
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
|
||||||
baseDir + '/accounts/login-background.jpg')
|
|
||||||
|
|
||||||
TOSText = 'Terms of Service go here.'
|
|
||||||
if os.path.isfile(baseDir + '/accounts/tos.txt'):
|
|
||||||
with open(baseDir + '/accounts/tos.txt', 'r') as file:
|
|
||||||
TOSText = file.read()
|
|
||||||
|
|
||||||
TOSForm = ''
|
|
||||||
cssFilename = baseDir + '/epicyon-profile.css'
|
|
||||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
|
||||||
cssFilename = baseDir + '/epicyon.css'
|
|
||||||
|
|
||||||
termsCSS = getCSS(baseDir, cssFilename, cssCache)
|
|
||||||
if termsCSS:
|
|
||||||
if httpPrefix != 'https':
|
|
||||||
termsCSS = termsCSS.replace('https://', httpPrefix+'://')
|
|
||||||
|
|
||||||
TOSForm = htmlHeader(cssFilename, termsCSS)
|
|
||||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
|
||||||
if adminNickname:
|
|
||||||
adminActor = httpPrefix + '://' + domainFull + \
|
|
||||||
'/users/' + adminNickname
|
|
||||||
TOSForm += \
|
|
||||||
'<div class="container"><center>\n' + \
|
|
||||||
'<p class="administeredby">Administered by <a href="' + \
|
|
||||||
adminActor + '">' + adminNickname + '</a></p>\n' + \
|
|
||||||
'</center></div>\n'
|
|
||||||
TOSForm += htmlFooter()
|
|
||||||
return TOSForm
|
|
||||||
|
|
||||||
|
|
||||||
def htmlAbout(cssCache: {}, baseDir: str, httpPrefix: str,
|
|
||||||
domainFull: str, onionDomain: 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 + '/accounts/login-background-custom.jpg'):
|
|
||||||
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
|
||||||
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
|
||||||
baseDir + '/accounts/login-background.jpg')
|
|
||||||
|
|
||||||
aboutText = 'Information about this instance goes here.'
|
|
||||||
if os.path.isfile(baseDir + '/accounts/about.txt'):
|
|
||||||
with open(baseDir + '/accounts/about.txt', 'r') as aboutFile:
|
|
||||||
aboutText = aboutFile.read()
|
|
||||||
|
|
||||||
aboutForm = ''
|
|
||||||
cssFilename = baseDir + '/epicyon-profile.css'
|
|
||||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
|
||||||
cssFilename = baseDir + '/epicyon.css'
|
|
||||||
|
|
||||||
aboutCSS = getCSS(baseDir, cssFilename, cssCache)
|
|
||||||
if aboutCSS:
|
|
||||||
if httpPrefix != 'http':
|
|
||||||
aboutCSS = aboutCSS.replace('https://',
|
|
||||||
httpPrefix + '://')
|
|
||||||
|
|
||||||
aboutForm = htmlHeader(cssFilename, aboutCSS)
|
|
||||||
aboutForm += '<div class="container">' + aboutText + '</div>'
|
|
||||||
if onionDomain:
|
|
||||||
aboutForm += \
|
|
||||||
'<div class="container"><center>\n' + \
|
|
||||||
'<p class="administeredby">' + \
|
|
||||||
'http://' + onionDomain + '</p>\n</center></div>\n'
|
|
||||||
if adminNickname:
|
|
||||||
adminActor = '/users/' + adminNickname
|
|
||||||
aboutForm += \
|
|
||||||
'<div class="container"><center>\n' + \
|
|
||||||
'<p class="administeredby">Administered by <a href="' + \
|
|
||||||
adminActor + '">' + adminNickname + '</a></p>\n' + \
|
|
||||||
'</center></div>\n'
|
|
||||||
aboutForm += htmlFooter()
|
|
||||||
return aboutForm
|
|
||||||
|
|
||||||
|
|
||||||
def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
|
def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
|
||||||
"""Show the screen for a blocked hashtag
|
"""Show the screen for a blocked hashtag
|
||||||
"""
|
"""
|
||||||
|
@ -228,25 +70,6 @@ def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
|
||||||
return blockedHashtagForm
|
return blockedHashtagForm
|
||||||
|
|
||||||
|
|
||||||
def htmlSuspended(cssCache: {}, baseDir: str) -> str:
|
|
||||||
"""Show the screen for suspended accounts
|
|
||||||
"""
|
|
||||||
suspendedForm = ''
|
|
||||||
cssFilename = baseDir + '/epicyon-suspended.css'
|
|
||||||
if os.path.isfile(baseDir + '/suspended.css'):
|
|
||||||
cssFilename = baseDir + '/suspended.css'
|
|
||||||
|
|
||||||
suspendedCSS = getCSS(baseDir, cssFilename, cssCache)
|
|
||||||
if suspendedCSS:
|
|
||||||
suspendedForm = htmlHeader(cssFilename, suspendedCSS)
|
|
||||||
suspendedForm += '<div><center>\n'
|
|
||||||
suspendedForm += ' <p class="screentitle">Account Suspended</p>\n'
|
|
||||||
suspendedForm += ' <p>See <a href="/terms">Terms of Service</a></p>\n'
|
|
||||||
suspendedForm += '</center></div>\n'
|
|
||||||
suspendedForm += htmlFooter()
|
|
||||||
return suspendedForm
|
|
||||||
|
|
||||||
|
|
||||||
def htmlRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
|
def htmlRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
|
||||||
actor: str, shareName: str,
|
actor: str, shareName: str,
|
||||||
callingDomain: str) -> str:
|
callingDomain: str) -> str:
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
__filename__ = "webapp_about.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.1.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@freedombone.net"
|
||||||
|
__status__ = "Production"
|
||||||
|
|
||||||
|
import os
|
||||||
|
from shutil import copyfile
|
||||||
|
from utils import getCSS
|
||||||
|
from utils import getConfigParam
|
||||||
|
from webapp_utils import htmlHeader
|
||||||
|
from webapp_utils import htmlFooter
|
||||||
|
|
||||||
|
|
||||||
|
def htmlAbout(cssCache: {}, baseDir: str, httpPrefix: str,
|
||||||
|
domainFull: str, onionDomain: 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 + '/accounts/login-background-custom.jpg'):
|
||||||
|
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
||||||
|
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
||||||
|
baseDir + '/accounts/login-background.jpg')
|
||||||
|
|
||||||
|
aboutText = 'Information about this instance goes here.'
|
||||||
|
if os.path.isfile(baseDir + '/accounts/about.txt'):
|
||||||
|
with open(baseDir + '/accounts/about.txt', 'r') as aboutFile:
|
||||||
|
aboutText = aboutFile.read()
|
||||||
|
|
||||||
|
aboutForm = ''
|
||||||
|
cssFilename = baseDir + '/epicyon-profile.css'
|
||||||
|
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||||
|
cssFilename = baseDir + '/epicyon.css'
|
||||||
|
|
||||||
|
aboutCSS = getCSS(baseDir, cssFilename, cssCache)
|
||||||
|
if aboutCSS:
|
||||||
|
if httpPrefix != 'http':
|
||||||
|
aboutCSS = aboutCSS.replace('https://',
|
||||||
|
httpPrefix + '://')
|
||||||
|
|
||||||
|
aboutForm = htmlHeader(cssFilename, aboutCSS)
|
||||||
|
aboutForm += '<div class="container">' + aboutText + '</div>'
|
||||||
|
if onionDomain:
|
||||||
|
aboutForm += \
|
||||||
|
'<div class="container"><center>\n' + \
|
||||||
|
'<p class="administeredby">' + \
|
||||||
|
'http://' + onionDomain + '</p>\n</center></div>\n'
|
||||||
|
if adminNickname:
|
||||||
|
adminActor = '/users/' + adminNickname
|
||||||
|
aboutForm += \
|
||||||
|
'<div class="container"><center>\n' + \
|
||||||
|
'<p class="administeredby">Administered by <a href="' + \
|
||||||
|
adminActor + '">' + adminNickname + '</a></p>\n' + \
|
||||||
|
'</center></div>\n'
|
||||||
|
aboutForm += htmlFooter()
|
||||||
|
return aboutForm
|
|
@ -0,0 +1,111 @@
|
||||||
|
__filename__ = "webapp_moderation.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.1.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@freedombone.net"
|
||||||
|
__status__ = "Production"
|
||||||
|
|
||||||
|
import os
|
||||||
|
from utils import getCSS
|
||||||
|
from webapp_timeline import htmlTimeline
|
||||||
|
from webapp_utils import htmlHeader
|
||||||
|
from webapp_utils import htmlFooter
|
||||||
|
|
||||||
|
|
||||||
|
def htmlModeration(cssCache: {}, defaultTimeline: str,
|
||||||
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
||||||
|
session, baseDir: str, wfRequest: {}, personCache: {},
|
||||||
|
nickname: str, domain: str, port: int, inboxJson: {},
|
||||||
|
allowDeletion: bool,
|
||||||
|
httpPrefix: str, projectVersion: str,
|
||||||
|
YTReplacementDomain: str,
|
||||||
|
showPublishedDateOnly: bool,
|
||||||
|
newswire: {}, positiveVoting: bool,
|
||||||
|
showPublishAsIcon: bool,
|
||||||
|
fullWidthTimelineButtonHeader: bool,
|
||||||
|
iconsAsButtons: bool,
|
||||||
|
rssIconAtTop: bool,
|
||||||
|
publishButtonAtTop: bool,
|
||||||
|
authorized: bool) -> str:
|
||||||
|
"""Show the moderation feed as html
|
||||||
|
This is what you see when selecting the "mod" timeline
|
||||||
|
"""
|
||||||
|
return htmlTimeline(cssCache, defaultTimeline,
|
||||||
|
recentPostsCache, maxRecentPosts,
|
||||||
|
translate, pageNumber,
|
||||||
|
itemsPerPage, session, baseDir, wfRequest, personCache,
|
||||||
|
nickname, domain, port, inboxJson, 'moderation',
|
||||||
|
allowDeletion, httpPrefix, projectVersion, True, False,
|
||||||
|
YTReplacementDomain, showPublishedDateOnly,
|
||||||
|
newswire, False, False, positiveVoting,
|
||||||
|
showPublishAsIcon, fullWidthTimelineButtonHeader,
|
||||||
|
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
|
||||||
|
authorized)
|
||||||
|
|
||||||
|
|
||||||
|
def htmlModerationInfo(cssCache: {}, translate: {},
|
||||||
|
baseDir: str, httpPrefix: str) -> str:
|
||||||
|
msgStr1 = \
|
||||||
|
'These are globally blocked for all accounts on this instance'
|
||||||
|
msgStr2 = \
|
||||||
|
'Any blocks or suspensions made by moderators will be shown here.'
|
||||||
|
infoForm = ''
|
||||||
|
cssFilename = baseDir + '/epicyon-profile.css'
|
||||||
|
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||||
|
cssFilename = baseDir + '/epicyon.css'
|
||||||
|
|
||||||
|
infoCSS = getCSS(baseDir, cssFilename, cssCache)
|
||||||
|
if infoCSS:
|
||||||
|
if httpPrefix != 'https':
|
||||||
|
infoCSS = infoCSS.replace('https://',
|
||||||
|
httpPrefix + '://')
|
||||||
|
infoForm = htmlHeader(cssFilename, infoCSS)
|
||||||
|
|
||||||
|
infoForm += \
|
||||||
|
'<center><h1>' + \
|
||||||
|
translate['Moderation Information'] + \
|
||||||
|
'</h1></center>'
|
||||||
|
|
||||||
|
infoShown = False
|
||||||
|
suspendedFilename = baseDir + '/accounts/suspended.txt'
|
||||||
|
if os.path.isfile(suspendedFilename):
|
||||||
|
with open(suspendedFilename, "r") as f:
|
||||||
|
suspendedStr = f.read()
|
||||||
|
infoForm += '<div class="container">'
|
||||||
|
infoForm += ' <br><b>' + \
|
||||||
|
translate['Suspended accounts'] + '</b>'
|
||||||
|
infoForm += ' <br>' + \
|
||||||
|
translate['These are currently suspended']
|
||||||
|
infoForm += \
|
||||||
|
' <textarea id="message" ' + \
|
||||||
|
'name="suspended" style="height:200px">' + \
|
||||||
|
suspendedStr + '</textarea>'
|
||||||
|
infoForm += '</div>'
|
||||||
|
infoShown = True
|
||||||
|
|
||||||
|
blockingFilename = baseDir + '/accounts/blocking.txt'
|
||||||
|
if os.path.isfile(blockingFilename):
|
||||||
|
with open(blockingFilename, "r") as f:
|
||||||
|
blockedStr = f.read()
|
||||||
|
infoForm += '<div class="container">'
|
||||||
|
infoForm += \
|
||||||
|
' <br><b>' + \
|
||||||
|
translate['Blocked accounts and hashtags'] + '</b>'
|
||||||
|
infoForm += \
|
||||||
|
' <br>' + \
|
||||||
|
translate[msgStr1]
|
||||||
|
infoForm += \
|
||||||
|
' <textarea id="message" ' + \
|
||||||
|
'name="blocked" style="height:700px">' + \
|
||||||
|
blockedStr + '</textarea>'
|
||||||
|
infoForm += '</div>'
|
||||||
|
infoShown = True
|
||||||
|
if not infoShown:
|
||||||
|
infoForm += \
|
||||||
|
'<center><p>' + \
|
||||||
|
translate[msgStr2] + \
|
||||||
|
'</p></center>'
|
||||||
|
infoForm += htmlFooter()
|
||||||
|
return infoForm
|
|
@ -0,0 +1,31 @@
|
||||||
|
__filename__ = "webapp_suspended.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.1.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@freedombone.net"
|
||||||
|
__status__ = "Production"
|
||||||
|
|
||||||
|
import os
|
||||||
|
from utils import getCSS
|
||||||
|
from webapp_utils import htmlHeader
|
||||||
|
from webapp_utils import htmlFooter
|
||||||
|
|
||||||
|
|
||||||
|
def htmlSuspended(cssCache: {}, baseDir: str) -> str:
|
||||||
|
"""Show the screen for suspended accounts
|
||||||
|
"""
|
||||||
|
suspendedForm = ''
|
||||||
|
cssFilename = baseDir + '/epicyon-suspended.css'
|
||||||
|
if os.path.isfile(baseDir + '/suspended.css'):
|
||||||
|
cssFilename = baseDir + '/suspended.css'
|
||||||
|
|
||||||
|
suspendedCSS = getCSS(baseDir, cssFilename, cssCache)
|
||||||
|
if suspendedCSS:
|
||||||
|
suspendedForm = htmlHeader(cssFilename, suspendedCSS)
|
||||||
|
suspendedForm += '<div><center>\n'
|
||||||
|
suspendedForm += ' <p class="screentitle">Account Suspended</p>\n'
|
||||||
|
suspendedForm += ' <p>See <a href="/terms">Terms of Service</a></p>\n'
|
||||||
|
suspendedForm += '</center></div>\n'
|
||||||
|
suspendedForm += htmlFooter()
|
||||||
|
return suspendedForm
|
|
@ -1346,37 +1346,6 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
|
||||||
authorized)
|
authorized)
|
||||||
|
|
||||||
|
|
||||||
def htmlModeration(cssCache: {}, defaultTimeline: str,
|
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
|
||||||
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
||||||
session, baseDir: str, wfRequest: {}, personCache: {},
|
|
||||||
nickname: str, domain: str, port: int, inboxJson: {},
|
|
||||||
allowDeletion: bool,
|
|
||||||
httpPrefix: str, projectVersion: str,
|
|
||||||
YTReplacementDomain: str,
|
|
||||||
showPublishedDateOnly: bool,
|
|
||||||
newswire: {}, positiveVoting: bool,
|
|
||||||
showPublishAsIcon: bool,
|
|
||||||
fullWidthTimelineButtonHeader: bool,
|
|
||||||
iconsAsButtons: bool,
|
|
||||||
rssIconAtTop: bool,
|
|
||||||
publishButtonAtTop: bool,
|
|
||||||
authorized: bool) -> str:
|
|
||||||
"""Show the moderation feed as html
|
|
||||||
"""
|
|
||||||
return htmlTimeline(cssCache, defaultTimeline,
|
|
||||||
recentPostsCache, maxRecentPosts,
|
|
||||||
translate, pageNumber,
|
|
||||||
itemsPerPage, session, baseDir, wfRequest, personCache,
|
|
||||||
nickname, domain, port, inboxJson, 'moderation',
|
|
||||||
allowDeletion, httpPrefix, projectVersion, True, False,
|
|
||||||
YTReplacementDomain, showPublishedDateOnly,
|
|
||||||
newswire, False, False, positiveVoting,
|
|
||||||
showPublishAsIcon, fullWidthTimelineButtonHeader,
|
|
||||||
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
|
|
||||||
authorized)
|
|
||||||
|
|
||||||
|
|
||||||
def htmlOutbox(cssCache: {}, defaultTimeline: str,
|
def htmlOutbox(cssCache: {}, defaultTimeline: str,
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
translate: {}, pageNumber: int, itemsPerPage: int,
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
__filename__ = "webapp_tos.py"
|
||||||
|
__author__ = "Bob Mottram"
|
||||||
|
__license__ = "AGPL3+"
|
||||||
|
__version__ = "1.1.0"
|
||||||
|
__maintainer__ = "Bob Mottram"
|
||||||
|
__email__ = "bob@freedombone.net"
|
||||||
|
__status__ = "Production"
|
||||||
|
|
||||||
|
import os
|
||||||
|
from shutil import copyfile
|
||||||
|
from utils import getCSS
|
||||||
|
from utils import getConfigParam
|
||||||
|
from webapp_utils import htmlHeader
|
||||||
|
from webapp_utils import htmlFooter
|
||||||
|
|
||||||
|
|
||||||
|
def htmlTermsOfService(cssCache: {}, baseDir: str,
|
||||||
|
httpPrefix: str, domainFull: str) -> str:
|
||||||
|
"""Show the terms of service screen
|
||||||
|
"""
|
||||||
|
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 + '/accounts/login-background-custom.jpg'):
|
||||||
|
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
||||||
|
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
||||||
|
baseDir + '/accounts/login-background.jpg')
|
||||||
|
|
||||||
|
TOSText = 'Terms of Service go here.'
|
||||||
|
if os.path.isfile(baseDir + '/accounts/tos.txt'):
|
||||||
|
with open(baseDir + '/accounts/tos.txt', 'r') as file:
|
||||||
|
TOSText = file.read()
|
||||||
|
|
||||||
|
TOSForm = ''
|
||||||
|
cssFilename = baseDir + '/epicyon-profile.css'
|
||||||
|
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||||
|
cssFilename = baseDir + '/epicyon.css'
|
||||||
|
|
||||||
|
termsCSS = getCSS(baseDir, cssFilename, cssCache)
|
||||||
|
if termsCSS:
|
||||||
|
if httpPrefix != 'https':
|
||||||
|
termsCSS = termsCSS.replace('https://', httpPrefix+'://')
|
||||||
|
|
||||||
|
TOSForm = htmlHeader(cssFilename, termsCSS)
|
||||||
|
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||||
|
if adminNickname:
|
||||||
|
adminActor = httpPrefix + '://' + domainFull + \
|
||||||
|
'/users/' + adminNickname
|
||||||
|
TOSForm += \
|
||||||
|
'<div class="container"><center>\n' + \
|
||||||
|
'<p class="administeredby">Administered by <a href="' + \
|
||||||
|
adminActor + '">' + adminNickname + '</a></p>\n' + \
|
||||||
|
'</center></div>\n'
|
||||||
|
TOSForm += htmlFooter()
|
||||||
|
return TOSForm
|
Loading…
Reference in New Issue