diff --git a/daemon.py b/daemon.py
index 8525442b..9aaf85cd 100644
--- a/daemon.py
+++ b/daemon.py
@@ -117,9 +117,9 @@ from webapp_utils import setBlogAddress
from webapp_utils import getBlogAddress
from webapp_calendar import htmlCalendarDeleteConfirm
from webapp_calendar import htmlCalendar
+from webapp_about import htmlAbout
from webapp import htmlFollowingList
from webapp import htmlDeletePost
-from webapp import htmlAbout
from webapp import htmlRemoveSharedItem
from webapp import htmlUnblockConfirm
from webapp_person_options import htmlPersonOptions
@@ -133,15 +133,15 @@ from webapp_timeline import htmlInboxMedia
from webapp_timeline import htmlInboxBlogs
from webapp_timeline import htmlInboxNews
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_login import htmlLogin
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 htmlUnfollowConfirm
-from webapp import htmlTermsOfService
-from webapp import htmlModerationInfo
from webapp import htmlHashtagBlocked
from webapp_post import htmlPostReplies
from webapp_post import htmlIndividualPost
diff --git a/webapp.py b/webapp.py
index b395b0be..02061882 100644
--- a/webapp.py
+++ b/webapp.py
@@ -13,7 +13,6 @@ from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import locatePost
from utils import loadJson
-from utils import getConfigParam
from shares import getValidSharedItemID
from webapp_utils import getAltPath
from webapp_utils import getIconsDir
@@ -48,163 +47,6 @@ def htmlFollowingList(cssCache: {}, baseDir: str,
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 += \
- '
' + \
- translate['Moderation Information'] + \
- '
'
-
- infoShown = False
- suspendedFilename = baseDir + '/accounts/suspended.txt'
- if os.path.isfile(suspendedFilename):
- with open(suspendedFilename, "r") as f:
- suspendedStr = f.read()
- infoForm += ''
- infoForm += '
' + \
- translate['Suspended accounts'] + ''
- infoForm += '
' + \
- translate['These are currently suspended']
- infoForm += \
- ' '
- infoForm += '
'
- infoShown = True
-
- blockingFilename = baseDir + '/accounts/blocking.txt'
- if os.path.isfile(blockingFilename):
- with open(blockingFilename, "r") as f:
- blockedStr = f.read()
- infoForm += ''
- infoForm += \
- '
' + \
- translate['Blocked accounts and hashtags'] + ''
- infoForm += \
- '
' + \
- translate[msgStr1]
- infoForm += \
- ' '
- infoForm += '
'
- infoShown = True
- if not infoShown:
- infoForm += \
- '' + \
- translate[msgStr2] + \
- '
'
- 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 += '' + TOSText + '
\n'
- if adminNickname:
- adminActor = httpPrefix + '://' + domainFull + \
- '/users/' + adminNickname
- TOSForm += \
- '\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 += '' + aboutText + '
'
- if onionDomain:
- aboutForm += \
- '\n' + \
- '' + \
- 'http://' + onionDomain + '
\n \n'
- if adminNickname:
- adminActor = '/users/' + adminNickname
- aboutForm += \
- '\n'
- aboutForm += htmlFooter()
- return aboutForm
-
-
def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
"""Show the screen for a blocked hashtag
"""
@@ -228,25 +70,6 @@ def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
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 += '\n'
- suspendedForm += ' Account Suspended
\n'
- suspendedForm += ' See Terms of Service
\n'
- suspendedForm += ' \n'
- suspendedForm += htmlFooter()
- return suspendedForm
-
-
def htmlRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
actor: str, shareName: str,
callingDomain: str) -> str:
diff --git a/webapp_about.py b/webapp_about.py
new file mode 100644
index 00000000..72b52239
--- /dev/null
+++ b/webapp_about.py
@@ -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 += '' + aboutText + '
'
+ if onionDomain:
+ aboutForm += \
+ '\n' + \
+ '' + \
+ 'http://' + onionDomain + '
\n \n'
+ if adminNickname:
+ adminActor = '/users/' + adminNickname
+ aboutForm += \
+ '\n'
+ aboutForm += htmlFooter()
+ return aboutForm
diff --git a/webapp_moderation.py b/webapp_moderation.py
new file mode 100644
index 00000000..a3ec5429
--- /dev/null
+++ b/webapp_moderation.py
@@ -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 += \
+ '' + \
+ translate['Moderation Information'] + \
+ '
'
+
+ infoShown = False
+ suspendedFilename = baseDir + '/accounts/suspended.txt'
+ if os.path.isfile(suspendedFilename):
+ with open(suspendedFilename, "r") as f:
+ suspendedStr = f.read()
+ infoForm += ''
+ infoForm += '
' + \
+ translate['Suspended accounts'] + ''
+ infoForm += '
' + \
+ translate['These are currently suspended']
+ infoForm += \
+ ' '
+ infoForm += '
'
+ infoShown = True
+
+ blockingFilename = baseDir + '/accounts/blocking.txt'
+ if os.path.isfile(blockingFilename):
+ with open(blockingFilename, "r") as f:
+ blockedStr = f.read()
+ infoForm += ''
+ infoForm += \
+ '
' + \
+ translate['Blocked accounts and hashtags'] + ''
+ infoForm += \
+ '
' + \
+ translate[msgStr1]
+ infoForm += \
+ ' '
+ infoForm += '
'
+ infoShown = True
+ if not infoShown:
+ infoForm += \
+ '' + \
+ translate[msgStr2] + \
+ '
'
+ infoForm += htmlFooter()
+ return infoForm
diff --git a/webapp_suspended.py b/webapp_suspended.py
new file mode 100644
index 00000000..cbcc1a23
--- /dev/null
+++ b/webapp_suspended.py
@@ -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 += '\n'
+ suspendedForm += ' Account Suspended
\n'
+ suspendedForm += ' See Terms of Service
\n'
+ suspendedForm += ' \n'
+ suspendedForm += htmlFooter()
+ return suspendedForm
diff --git a/webapp_timeline.py b/webapp_timeline.py
index 9711814c..80f2f17d 100644
--- a/webapp_timeline.py
+++ b/webapp_timeline.py
@@ -1346,37 +1346,6 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
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,
recentPostsCache: {}, maxRecentPosts: int,
translate: {}, pageNumber: int, itemsPerPage: int,
diff --git a/webapp_tos.py b/webapp_tos.py
new file mode 100644
index 00000000..707a29d4
--- /dev/null
+++ b/webapp_tos.py
@@ -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 += '' + TOSText + '
\n'
+ if adminNickname:
+ adminActor = httpPrefix + '://' + domainFull + \
+ '/users/' + adminNickname
+ TOSForm += \
+ '\n'
+ TOSForm += htmlFooter()
+ return TOSForm