mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
4d042dbeca
commit
0fc18cc7dd
|
@ -238,6 +238,7 @@ from categories import updateHashtagCategories
|
||||||
from languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from languages import setActorLanguages
|
from languages import setActorLanguages
|
||||||
from like import updateLikesCollection
|
from like import updateLikesCollection
|
||||||
|
from utils import getNewPostEndpoints
|
||||||
from utils import malformedCiphertext
|
from utils import malformedCiphertext
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from utils import setReplyIntervalHours
|
from utils import setReplyIntervalHours
|
||||||
|
@ -11893,10 +11894,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
isNewPostEndpoint = False
|
isNewPostEndpoint = False
|
||||||
if '/users/' in path and '/new' in path:
|
if '/users/' in path and '/new' in path:
|
||||||
# Various types of new post in the web interface
|
# Various types of new post in the web interface
|
||||||
newPostEnd = ('newpost', 'newblog', 'newunlisted',
|
newPostEnd = getNewPostEndpoints()
|
||||||
'newfollowers', 'newdm', 'newreminder',
|
|
||||||
'newreport', 'newquestion',
|
|
||||||
'newshare', 'newwanted')
|
|
||||||
for postType in newPostEnd:
|
for postType in newPostEnd:
|
||||||
if path.endswith('/' + postType):
|
if path.endswith('/' + postType):
|
||||||
isNewPostEndpoint = True
|
isNewPostEndpoint = True
|
||||||
|
|
9
utils.py
9
utils.py
|
@ -3145,3 +3145,12 @@ def hasObjectString(postJsonObject: {}, debug: bool) -> bool:
|
||||||
if debug:
|
if debug:
|
||||||
print('No object field within post ' + postJsonObject['id'])
|
print('No object field within post ' + postJsonObject['id'])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def getNewPostEndpoints() -> []:
|
||||||
|
"""Returns a list of endpoints for new posts
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
'newpost', 'newblog', 'newunlisted', 'newfollowers', 'newdm',
|
||||||
|
'newreminder', 'newreport', 'newquestion', 'newshare', 'newwanted'
|
||||||
|
)
|
||||||
|
|
|
@ -8,6 +8,7 @@ __status__ = "Production"
|
||||||
__module_group__ = "Web Interface"
|
__module_group__ = "Web Interface"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from utils import getNewPostEndpoints
|
||||||
from utils import isPublicPostFromUrl
|
from utils import isPublicPostFromUrl
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
|
@ -289,14 +290,10 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
|
|
||||||
if '?' in path:
|
if '?' in path:
|
||||||
path = path.split('?')[0]
|
path = path.split('?')[0]
|
||||||
newPostEndpoints = (
|
newPostEndpoints = getNewPostEndpoints()
|
||||||
'/newreport', '/newpost', '/newblog', '/newshare',
|
|
||||||
'/newunlisted', '/newwanted', '/newreminder',
|
|
||||||
'/newfollowers', '/newdm'
|
|
||||||
)
|
|
||||||
pathBase = path
|
pathBase = path
|
||||||
for newPostReplace in newPostEndpoints:
|
for newPostReplace in newPostEndpoints:
|
||||||
pathBase = pathBase.replace(newPostReplace, '')
|
pathBase = pathBase.replace('/' + newPostReplace, '')
|
||||||
|
|
||||||
newPostImageSection = ' <div class="container">'
|
newPostImageSection = ' <div class="container">'
|
||||||
newPostImageSection += \
|
newPostImageSection += \
|
||||||
|
|
Loading…
Reference in New Issue