main
Bob Mottram 2021-11-03 11:25:26 +00:00
parent 4d042dbeca
commit 0fc18cc7dd
3 changed files with 14 additions and 10 deletions

View File

@ -238,6 +238,7 @@ from categories import updateHashtagCategories
from languages import getActorLanguages
from languages import setActorLanguages
from like import updateLikesCollection
from utils import getNewPostEndpoints
from utils import malformedCiphertext
from utils import hasActor
from utils import setReplyIntervalHours
@ -11893,10 +11894,7 @@ class PubServer(BaseHTTPRequestHandler):
isNewPostEndpoint = False
if '/users/' in path and '/new' in path:
# Various types of new post in the web interface
newPostEnd = ('newpost', 'newblog', 'newunlisted',
'newfollowers', 'newdm', 'newreminder',
'newreport', 'newquestion',
'newshare', 'newwanted')
newPostEnd = getNewPostEndpoints()
for postType in newPostEnd:
if path.endswith('/' + postType):
isNewPostEndpoint = True

View File

@ -3145,3 +3145,12 @@ def hasObjectString(postJsonObject: {}, debug: bool) -> bool:
if debug:
print('No object field within post ' + postJsonObject['id'])
return False
def getNewPostEndpoints() -> []:
"""Returns a list of endpoints for new posts
"""
return (
'newpost', 'newblog', 'newunlisted', 'newfollowers', 'newdm',
'newreminder', 'newreport', 'newquestion', 'newshare', 'newwanted'
)

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Web Interface"
import os
from utils import getNewPostEndpoints
from utils import isPublicPostFromUrl
from utils import getNicknameFromActor
from utils import getDomainFromActor
@ -289,14 +290,10 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
if '?' in path:
path = path.split('?')[0]
newPostEndpoints = (
'/newreport', '/newpost', '/newblog', '/newshare',
'/newunlisted', '/newwanted', '/newreminder',
'/newfollowers', '/newdm'
)
newPostEndpoints = getNewPostEndpoints()
pathBase = path
for newPostReplace in newPostEndpoints:
pathBase = pathBase.replace(newPostReplace, '')
pathBase = pathBase.replace('/' + newPostReplace, '')
newPostImageSection = ' <div class="container">'
newPostImageSection += \