mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
7b92186deb
commit
e1de415809
10
posts.py
10
posts.py
|
|
@ -31,6 +31,7 @@ from session import postImage
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from httpsig import createSignedHeader
|
from httpsig import createSignedHeader
|
||||||
from siteactive import siteIsActive
|
from siteactive import siteIsActive
|
||||||
|
from utils import rejectPostId
|
||||||
from utils import removeInvalidChars
|
from utils import removeInvalidChars
|
||||||
from utils import fileLastModified
|
from utils import fileLastModified
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
|
|
@ -3884,14 +3885,7 @@ def _rejectAnnounce(announceFilename: str,
|
||||||
announcePostId: str):
|
announcePostId: str):
|
||||||
"""Marks an announce as rejected
|
"""Marks an announce as rejected
|
||||||
"""
|
"""
|
||||||
# reject the announce activity
|
rejectPostId(baseDir, nickname, domain, announcePostId)
|
||||||
announcePostFilename = \
|
|
||||||
locatePost(baseDir, nickname, domain, announcePostId)
|
|
||||||
if announcePostFilename:
|
|
||||||
rejectAnnounceFile = open(announcePostFilename + '.reject', "w+")
|
|
||||||
if rejectAnnounceFile:
|
|
||||||
rejectAnnounceFile.write('\n')
|
|
||||||
rejectAnnounceFile.close()
|
|
||||||
|
|
||||||
# reject the post referenced by the announce activity object
|
# reject the post referenced by the announce activity object
|
||||||
if not os.path.isfile(announceFilename + '.reject'):
|
if not os.path.isfile(announceFilename + '.reject'):
|
||||||
|
|
|
||||||
13
utils.py
13
utils.py
|
|
@ -2034,3 +2034,16 @@ def camelCaseSplit(text: str) -> str:
|
||||||
for word in matches:
|
for word in matches:
|
||||||
resultStr += word.group(0) + ' '
|
resultStr += word.group(0) + ' '
|
||||||
return resultStr.strip()
|
return resultStr.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def rejectPostId(baseDir: str, nickname: str, domain: str,
|
||||||
|
postId: str) -> None:
|
||||||
|
""" Marks the given post as rejected
|
||||||
|
"""
|
||||||
|
postFilename = locatePost(baseDir, nickname, domain, postId)
|
||||||
|
if not postFilename:
|
||||||
|
return
|
||||||
|
rejectFile = open(postFilename + '.reject', "w+")
|
||||||
|
if rejectFile:
|
||||||
|
rejectFile.write('\n')
|
||||||
|
rejectFile.close()
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from posts import getPersonBox
|
||||||
from posts import isDM
|
from posts import isDM
|
||||||
from posts import downloadAnnounce
|
from posts import downloadAnnounce
|
||||||
from posts import populateRepliesJson
|
from posts import populateRepliesJson
|
||||||
|
from utils import rejectPostId
|
||||||
from utils import isRecentPost
|
from utils import isRecentPost
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
|
|
@ -1291,14 +1292,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
allowLocalNetworkAccess)
|
allowLocalNetworkAccess)
|
||||||
if not postJsonAnnounce:
|
if not postJsonAnnounce:
|
||||||
# if the announce could not be downloaded then mark it as rejected
|
# if the announce could not be downloaded then mark it as rejected
|
||||||
announceFilename = \
|
rejectPostId(baseDir, nickname, domain, postJsonObject['id'])
|
||||||
locatePost(baseDir, nickname, domain,
|
|
||||||
postJsonObject['id'])
|
|
||||||
if announceFilename:
|
|
||||||
rejectFile = open(announceFilename + '.reject', "w+")
|
|
||||||
if rejectFile:
|
|
||||||
rejectFile.write('\n')
|
|
||||||
rejectFile.close()
|
|
||||||
return ''
|
return ''
|
||||||
postJsonObject = postJsonAnnounce
|
postJsonObject = postJsonAnnounce
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue