mirror of https://gitlab.com/bashrc2/epicyon
Generate html for incoming likes
parent
e97dc8c8ce
commit
8c49696bd0
63
inbox.py
63
inbox.py
|
@ -51,6 +51,7 @@ from categories import getHashtagCategories
|
||||||
from categories import setHashtagCategory
|
from categories import setHashtagCategory
|
||||||
from httpsig import verifyPostHeaders
|
from httpsig import verifyPostHeaders
|
||||||
from session import createSession
|
from session import createSession
|
||||||
|
from follow import followerApprovalActive
|
||||||
from follow import isFollowingActor
|
from follow import isFollowingActor
|
||||||
from follow import receiveFollowRequest
|
from follow import receiveFollowRequest
|
||||||
from follow import getFollowersOfActor
|
from follow import getFollowersOfActor
|
||||||
|
@ -180,6 +181,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
if boxname != 'outbox':
|
if boxname != 'outbox':
|
||||||
boxname = 'inbox'
|
boxname = 'inbox'
|
||||||
|
|
||||||
|
notDM = not isDM(postJsonObject)
|
||||||
individualPostAsHtml(signingPrivateKeyPem,
|
individualPostAsHtml(signingPrivateKeyPem,
|
||||||
True, recentPostsCache, maxRecentPosts,
|
True, recentPostsCache, maxRecentPosts,
|
||||||
translate, pageNumber,
|
translate, pageNumber,
|
||||||
|
@ -191,8 +193,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances, allowLocalNetworkAccess,
|
peertubeInstances, allowLocalNetworkAccess,
|
||||||
themeName, systemLanguage, maxLikeCount,
|
themeName, systemLanguage, maxLikeCount,
|
||||||
not isDM(postJsonObject),
|
notDM, True, True, False, True)
|
||||||
True, True, False, True)
|
|
||||||
|
|
||||||
|
|
||||||
def validInbox(baseDir: str, nickname: str, domain: str) -> bool:
|
def validInbox(baseDir: str, nickname: str, domain: str) -> bool:
|
||||||
|
@ -914,7 +915,15 @@ def _receiveLike(recentPostsCache: {},
|
||||||
onionDomain: str,
|
onionDomain: str,
|
||||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||||
personCache: {}, messageJson: {}, federationList: [],
|
personCache: {}, messageJson: {}, federationList: [],
|
||||||
debug: bool) -> bool:
|
debug: bool,
|
||||||
|
signingPrivateKeyPem: str,
|
||||||
|
maxRecentPosts: int, translate: {},
|
||||||
|
allowDeletion: bool,
|
||||||
|
YTReplacementDomain: str,
|
||||||
|
peertubeInstances: [],
|
||||||
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str, systemLanguage: str,
|
||||||
|
maxLikeCount: int) -> bool:
|
||||||
"""Receives a Like activity within the POST section of HTTPServer
|
"""Receives a Like activity within the POST section of HTTPServer
|
||||||
"""
|
"""
|
||||||
if messageJson['type'] != 'Like':
|
if messageJson['type'] != 'Like':
|
||||||
|
@ -971,6 +980,41 @@ def _receiveLike(recentPostsCache: {},
|
||||||
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
||||||
postLikedId, messageJson['actor'],
|
postLikedId, messageJson['actor'],
|
||||||
handleName, domain, debug)
|
handleName, domain, debug)
|
||||||
|
# regenerate the html
|
||||||
|
likedPostJson = loadJson(postFilename, 0, 1)
|
||||||
|
if likedPostJson:
|
||||||
|
if debug:
|
||||||
|
cachedPostFilename = \
|
||||||
|
getCachedPostFilename(baseDir, handleName, domain,
|
||||||
|
likedPostJson)
|
||||||
|
print('Liked post json: ' + str(likedPostJson))
|
||||||
|
print('Liked post nickname: ' + handleName + ' ' + domain)
|
||||||
|
print('Liked post cache: ' + str(cachedPostFilename))
|
||||||
|
pageNumber = 1
|
||||||
|
showPublishedDateOnly = False
|
||||||
|
showIndividualPostIcons = True
|
||||||
|
manuallyApproveFollowers = \
|
||||||
|
followerApprovalActive(baseDir, handleName, domain)
|
||||||
|
notDM = not isDM(likedPostJson)
|
||||||
|
individualPostAsHtml(signingPrivateKeyPem, False,
|
||||||
|
recentPostsCache, maxRecentPosts,
|
||||||
|
translate, pageNumber, baseDir,
|
||||||
|
session, cachedWebfingers, personCache,
|
||||||
|
handleName, domain, port, likedPostJson,
|
||||||
|
None, True, allowDeletion,
|
||||||
|
httpPrefix, __version__,
|
||||||
|
'inbox', YTReplacementDomain,
|
||||||
|
showPublishedDateOnly,
|
||||||
|
peertubeInstances,
|
||||||
|
allowLocalNetworkAccess,
|
||||||
|
themeName, systemLanguage,
|
||||||
|
maxLikeCount, notDM,
|
||||||
|
showIndividualPostIcons,
|
||||||
|
manuallyApproveFollowers,
|
||||||
|
False, True, False)
|
||||||
|
else:
|
||||||
|
print('WARN: Liked post not found: ' + postFilename)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -1029,6 +1073,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
||||||
undoLikesCollectionEntry(recentPostsCache, baseDir, postFilename,
|
undoLikesCollectionEntry(recentPostsCache, baseDir, postFilename,
|
||||||
messageJson['object'],
|
messageJson['object'],
|
||||||
messageJson['actor'], domain, debug)
|
messageJson['actor'], domain, debug)
|
||||||
|
# TODO regenerate the html
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -2275,7 +2320,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
lastBounceMessage: [],
|
lastBounceMessage: [],
|
||||||
themeName: str, systemLanguage: str,
|
themeName: str, systemLanguage: str,
|
||||||
maxLikeCount: int, signingPrivateKeyPem: str) -> bool:
|
maxLikeCount: int,
|
||||||
|
signingPrivateKeyPem: str) -> bool:
|
||||||
""" Anything which needs to be done after initial checks have passed
|
""" Anything which needs to be done after initial checks have passed
|
||||||
"""
|
"""
|
||||||
actor = keyId
|
actor = keyId
|
||||||
|
@ -2297,7 +2343,14 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
personCache,
|
personCache,
|
||||||
messageJson,
|
messageJson,
|
||||||
federationList,
|
federationList,
|
||||||
debug):
|
debug, signingPrivateKeyPem,
|
||||||
|
maxRecentPosts, translate,
|
||||||
|
allowDeletion,
|
||||||
|
YTReplacementDomain,
|
||||||
|
peertubeInstances,
|
||||||
|
allowLocalNetworkAccess,
|
||||||
|
themeName, systemLanguage,
|
||||||
|
maxLikeCount):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Like accepted from ' + actor)
|
print('DEBUG: Like accepted from ' + actor)
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue