main
Bob Mottram 2020-10-13 10:58:06 +01:00
parent bbd27656d2
commit 95146b15eb
2 changed files with 31 additions and 26 deletions

View File

@ -8288,11 +8288,6 @@ class PubServer(BaseHTTPRequestHandler):
return False return False
def do_GET(self): def do_GET(self):
# don't allow access to system actors
if self.path == '/users/news' or self.path == '/users/inbox':
self._400()
return
callingDomain = self.server.domainFull callingDomain = self.server.domainFull
if self.headers.get('Host'): if self.headers.get('Host'):
callingDomain = self.headers['Host'] callingDomain = self.headers['Host']

View File

@ -3224,6 +3224,14 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
return timelineStr return timelineStr
def isSystemAccount(nickname: str) -> bool:
"""Returns true if the given nickname is a system account
"""
if nickname == 'news' or nickname == 'inbox':
return True
return False
def htmlProfile(defaultTimeline: str, def htmlProfile(defaultTimeline: str,
recentPostsCache: {}, maxRecentPosts: int, recentPostsCache: {}, maxRecentPosts: int,
translate: {}, projectVersion: str, translate: {}, projectVersion: str,
@ -3296,7 +3304,7 @@ def htmlProfile(defaultTimeline: str,
PGPfingerprint or emailAddress: PGPfingerprint or emailAddress:
donateSection = '<div class="container">\n' donateSection = '<div class="container">\n'
donateSection += ' <center>\n' donateSection += ' <center>\n'
if donateUrl: if donateUrl and not isSystemAccount(nickname):
donateSection += \ donateSection += \
' <p><a href="' + donateUrl + \ ' <p><a href="' + donateUrl + \
'"><button class="donateButton">' + translate['Donate'] + \ '"><button class="donateButton">' + translate['Donate'] + \
@ -3444,26 +3452,28 @@ def htmlProfile(defaultTimeline: str,
' <a href="' + usersPath + '#buttonheader"><button class="' + \ ' <a href="' + usersPath + '#buttonheader"><button class="' + \
postsButton + '"><span>' + translate['Posts'] + \ postsButton + '"><span>' + translate['Posts'] + \
' </span></button></a>' ' </span></button></a>'
profileStr += \ if not isSystemAccount(nickname):
' <a href="' + usersPath + '/following#buttonheader">' + \ profileStr += \
'<button class="' + followingButton + '"><span>' + \ ' <a href="' + usersPath + '/following#buttonheader">' + \
translate['Following'] + ' </span></button></a>' '<button class="' + followingButton + '"><span>' + \
profileStr += \ translate['Following'] + ' </span></button></a>'
' <a href="' + usersPath + '/followers#buttonheader">' + \ profileStr += \
'<button class="' + followersButton + \ ' <a href="' + usersPath + '/followers#buttonheader">' + \
'"><span>' + translate['Followers'] + ' </span></button></a>' '<button class="' + followersButton + \
profileStr += \ '"><span>' + translate['Followers'] + ' </span></button></a>'
' <a href="' + usersPath + '/roles#buttonheader">' + \ profileStr += \
'<button class="' + rolesButton + '"><span>' + translate['Roles'] + \ ' <a href="' + usersPath + '/roles#buttonheader">' + \
' </span></button></a>' '<button class="' + rolesButton + '"><span>' + \
profileStr += \ translate['Roles'] + \
' <a href="' + usersPath + '/skills#buttonheader">' + \ ' </span></button></a>'
'<button class="' + skillsButton + '"><span>' + \ profileStr += \
translate['Skills'] + ' </span></button></a>' ' <a href="' + usersPath + '/skills#buttonheader">' + \
profileStr += \ '<button class="' + skillsButton + '"><span>' + \
' <a href="' + usersPath + '/shares#buttonheader">' + \ translate['Skills'] + ' </span></button></a>'
'<button class="' + sharesButton + '"><span>' + \ profileStr += \
translate['Shares'] + ' </span></button></a>' ' <a href="' + usersPath + '/shares#buttonheader">' + \
'<button class="' + sharesButton + '"><span>' + \
translate['Shares'] + ' </span></button></a>'
profileStr += editProfileStr + logoutStr profileStr += editProfileStr + logoutStr
profileStr += ' </center>' profileStr += ' </center>'
profileStr += '</div>' profileStr += '</div>'