Less indentation

main
Bob Mottram 2021-07-07 12:31:43 +01:00
parent e65ad3bcc2
commit f6355632ec
1 changed files with 78 additions and 104 deletions

View File

@ -7700,21 +7700,25 @@ class PubServer(BaseHTTPRequestHandler):
if '/' not in namedStatus:
# show actor
nickname = namedStatus
else:
return False
postSections = namedStatus.split('/')
if len(postSections) == 2:
if len(postSections) != 2:
return False
nickname = postSections[0]
statusNumber = postSections[1]
if len(statusNumber) > 10 and statusNumber.isdigit():
if len(statusNumber) <= 10 or not statusNumber.isdigit():
return False
postFilename = \
baseDir + '/accounts/' + \
nickname + '@' + \
domain + '/outbox/' + \
httpPrefix + ':##' + \
domainFull + '#users#' + \
nickname + '#statuses#' + \
statusNumber + '.json'
if os.path.isfile(postFilename):
baseDir + '/accounts/' + nickname + '@' + domain + '/outbox/' + \
httpPrefix + ':##' + domainFull + '#users#' + nickname + \
'#statuses#' + statusNumber + '.json'
if not os.path.isfile(postFilename):
self._404()
self.server.GETbusy = False
return True
postJsonObject = loadJson(postFilename)
loadedPost = False
if postJsonObject:
@ -7733,51 +7737,26 @@ class PubServer(BaseHTTPRequestHandler):
return True
removePostInteractions(pjo, True)
if self._requestHTTP():
recentPostsCache = \
self.server.recentPostsCache
maxRecentPosts = \
self.server.maxRecentPosts
translate = \
self.server.translate
cachedWebfingers = \
self.server.cachedWebfingers
personCache = \
self.server.personCache
projectVersion = \
self.server.projectVersion
ytDomain = \
self.server.YTReplacementDomain
showPublishedDateOnly = \
self.server.showPublishedDateOnly
peertubeInstances = \
self.server.peertubeInstances
cssCache = self.server.cssCache
allowLocalNetworkAccess = \
self.server.allowLocalNetworkAccess
themeName = \
self.server.themeName
msg = \
htmlIndividualPost(cssCache,
recentPostsCache,
maxRecentPosts,
translate,
htmlIndividualPost(self.server.cssCache,
self.server.recentPostsCache,
self.server.maxRecentPosts,
self.server.translate,
self.server.baseDir,
self.server.session,
cachedWebfingers,
personCache,
nickname,
domain,
port,
self.server.cachedWebfingers,
self.server.personCache,
nickname, domain, port,
authorized,
postJsonObject,
httpPrefix,
projectVersion,
self.server.projectVersion,
likedBy,
ytDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
themeName)
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.themeName)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7800,11 +7779,6 @@ class PubServer(BaseHTTPRequestHandler):
'new post done',
'individual post shown')
return True
else:
self._404()
self.server.GETbusy = False
return True
return False
def _showIndividualPost(self, authorized: bool,
callingDomain: str, path: str,