mirror of https://gitlab.com/bashrc2/epicyon
Receiving likes on announces
parent
5804034ece
commit
b000e0aba9
|
@ -7402,6 +7402,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
domain, debug)
|
domain, debug)
|
||||||
likeUrl = announceLikeUrl
|
likeUrl = announceLikeUrl
|
||||||
likedPostFilename = announceLikedFilename
|
likedPostFilename = announceLikedFilename
|
||||||
|
likedPostJson = \
|
||||||
|
loadJson(likedPostFilename, 0, 1)
|
||||||
if debug:
|
if debug:
|
||||||
print('Updating likes for ' + likedPostFilename)
|
print('Updating likes for ' + likedPostFilename)
|
||||||
updateLikesCollection(recentPostsCache,
|
updateLikesCollection(recentPostsCache,
|
||||||
|
@ -7573,6 +7575,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
debug)
|
debug)
|
||||||
likeUrl = announceLikeUrl
|
likeUrl = announceLikeUrl
|
||||||
likedPostFilename = announceLikedFilename
|
likedPostFilename = announceLikedFilename
|
||||||
|
likedPostJson = \
|
||||||
|
loadJson(likedPostFilename, 0, 1)
|
||||||
if debug:
|
if debug:
|
||||||
print('Removing likes for ' + likedPostFilename)
|
print('Removing likes for ' + likedPostFilename)
|
||||||
undoLikesCollectionEntry(recentPostsCache,
|
undoLikesCollectionEntry(recentPostsCache,
|
||||||
|
|
175
inbox.py
175
inbox.py
|
@ -929,52 +929,73 @@ def _receiveLike(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: liked post found in inbox')
|
print('DEBUG: liked post found in inbox')
|
||||||
|
|
||||||
|
likeActor = messageJson['actor']
|
||||||
handleName = handle.split('@')[0]
|
handleName = handle.split('@')[0]
|
||||||
handleDom = handle.split('@')[1]
|
handleDom = handle.split('@')[1]
|
||||||
if not _alreadyLiked(baseDir,
|
if not _alreadyLiked(baseDir,
|
||||||
handleName, handleDom,
|
handleName, handleDom,
|
||||||
postLikedId,
|
postLikedId,
|
||||||
messageJson['actor']):
|
likeActor):
|
||||||
_likeNotify(baseDir, domain, onionDomain, handle,
|
_likeNotify(baseDir, domain, onionDomain, handle,
|
||||||
messageJson['actor'], postLikedId)
|
likeActor, postLikedId)
|
||||||
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
updateLikesCollection(recentPostsCache, baseDir, postFilename,
|
||||||
postLikedId, messageJson['actor'],
|
postLikedId, likeActor,
|
||||||
handleName, domain, debug)
|
handleName, domain, debug)
|
||||||
# regenerate the html
|
# regenerate the html
|
||||||
likedPostJson = loadJson(postFilename, 0, 1)
|
likedPostJson = loadJson(postFilename, 0, 1)
|
||||||
if likedPostJson:
|
if likedPostJson:
|
||||||
if debug:
|
if likedPostJson.get('type'):
|
||||||
cachedPostFilename = \
|
if likedPostJson['type'] == 'Announce' and \
|
||||||
getCachedPostFilename(baseDir, handleName, domain,
|
likedPostJson.get('object'):
|
||||||
likedPostJson)
|
if isinstance(likedPostJson['object'], str):
|
||||||
print('Liked post json: ' + str(likedPostJson))
|
announceLikeUrl = likedPostJson['object']
|
||||||
print('Liked post nickname: ' + handleName + ' ' + domain)
|
announceLikedFilename = \
|
||||||
print('Liked post cache: ' + str(cachedPostFilename))
|
locatePost(baseDir, handleName,
|
||||||
pageNumber = 1
|
domain, announceLikeUrl)
|
||||||
showPublishedDateOnly = False
|
if announceLikedFilename:
|
||||||
showIndividualPostIcons = True
|
postLikedId = announceLikeUrl
|
||||||
manuallyApproveFollowers = \
|
postFilename = announceLikedFilename
|
||||||
followerApprovalActive(baseDir, handleName, domain)
|
updateLikesCollection(recentPostsCache,
|
||||||
notDM = not isDM(likedPostJson)
|
baseDir,
|
||||||
individualPostAsHtml(signingPrivateKeyPem, False,
|
postFilename,
|
||||||
recentPostsCache, maxRecentPosts,
|
postLikedId,
|
||||||
translate, pageNumber, baseDir,
|
likeActor,
|
||||||
session, cachedWebfingers, personCache,
|
handleName,
|
||||||
handleName, domain, port, likedPostJson,
|
domain, debug)
|
||||||
None, True, allowDeletion,
|
likedPostJson = \
|
||||||
httpPrefix, __version__,
|
loadJson(postFilename, 0, 1)
|
||||||
'inbox',
|
if likedPostJson:
|
||||||
YTReplacementDomain,
|
if debug:
|
||||||
twitterReplacementDomain,
|
cachedPostFilename = \
|
||||||
showPublishedDateOnly,
|
getCachedPostFilename(baseDir, handleName, domain,
|
||||||
peertubeInstances,
|
likedPostJson)
|
||||||
allowLocalNetworkAccess,
|
print('Liked post json: ' + str(likedPostJson))
|
||||||
themeName, systemLanguage,
|
print('Liked post nickname: ' + handleName + ' ' + domain)
|
||||||
maxLikeCount, notDM,
|
print('Liked post cache: ' + str(cachedPostFilename))
|
||||||
showIndividualPostIcons,
|
pageNumber = 1
|
||||||
manuallyApproveFollowers,
|
showPublishedDateOnly = False
|
||||||
False, True, 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,
|
||||||
|
twitterReplacementDomain,
|
||||||
|
showPublishedDateOnly,
|
||||||
|
peertubeInstances,
|
||||||
|
allowLocalNetworkAccess,
|
||||||
|
themeName, systemLanguage,
|
||||||
|
maxLikeCount, notDM,
|
||||||
|
showIndividualPostIcons,
|
||||||
|
manuallyApproveFollowers,
|
||||||
|
False, True, False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -1030,43 +1051,61 @@ def _receiveUndoLike(recentPostsCache: {},
|
||||||
return True
|
return True
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: liked post found in inbox. Now undoing.')
|
print('DEBUG: liked post found in inbox. Now undoing.')
|
||||||
|
likeActor = messageJson['actor']
|
||||||
|
postLikedId = messageJson['object']
|
||||||
undoLikesCollectionEntry(recentPostsCache, baseDir, postFilename,
|
undoLikesCollectionEntry(recentPostsCache, baseDir, postFilename,
|
||||||
messageJson['object'],
|
postLikedId, likeActor, domain, debug)
|
||||||
messageJson['actor'], domain, debug)
|
|
||||||
# regenerate the html
|
# regenerate the html
|
||||||
likedPostJson = loadJson(postFilename, 0, 1)
|
likedPostJson = loadJson(postFilename, 0, 1)
|
||||||
if likedPostJson:
|
if likedPostJson:
|
||||||
if debug:
|
if likedPostJson.get('type'):
|
||||||
cachedPostFilename = \
|
if likedPostJson['type'] == 'Announce' and \
|
||||||
getCachedPostFilename(baseDir, handleName, domain,
|
likedPostJson.get('object'):
|
||||||
likedPostJson)
|
if isinstance(likedPostJson['object'], str):
|
||||||
print('Unliked post json: ' + str(likedPostJson))
|
announceLikeUrl = likedPostJson['object']
|
||||||
print('Unliked post nickname: ' + handleName + ' ' + domain)
|
announceLikedFilename = \
|
||||||
print('Unliked post cache: ' + str(cachedPostFilename))
|
locatePost(baseDir, handleName,
|
||||||
pageNumber = 1
|
domain, announceLikeUrl)
|
||||||
showPublishedDateOnly = False
|
if announceLikedFilename:
|
||||||
showIndividualPostIcons = True
|
postLikedId = announceLikeUrl
|
||||||
manuallyApproveFollowers = \
|
postFilename = announceLikedFilename
|
||||||
followerApprovalActive(baseDir, handleName, domain)
|
undoLikesCollectionEntry(recentPostsCache, baseDir,
|
||||||
notDM = not isDM(likedPostJson)
|
postFilename, postLikedId,
|
||||||
individualPostAsHtml(signingPrivateKeyPem, False,
|
likeActor, domain, debug)
|
||||||
recentPostsCache, maxRecentPosts,
|
likedPostJson = \
|
||||||
translate, pageNumber, baseDir,
|
loadJson(postFilename, 0, 1)
|
||||||
session, cachedWebfingers, personCache,
|
if likedPostJson:
|
||||||
handleName, domain, port, likedPostJson,
|
if debug:
|
||||||
None, True, allowDeletion,
|
cachedPostFilename = \
|
||||||
httpPrefix, __version__,
|
getCachedPostFilename(baseDir, handleName, domain,
|
||||||
'inbox',
|
likedPostJson)
|
||||||
YTReplacementDomain,
|
print('Unliked post json: ' + str(likedPostJson))
|
||||||
twitterReplacementDomain,
|
print('Unliked post nickname: ' + handleName + ' ' + domain)
|
||||||
showPublishedDateOnly,
|
print('Unliked post cache: ' + str(cachedPostFilename))
|
||||||
peertubeInstances,
|
pageNumber = 1
|
||||||
allowLocalNetworkAccess,
|
showPublishedDateOnly = False
|
||||||
themeName, systemLanguage,
|
showIndividualPostIcons = True
|
||||||
maxLikeCount, notDM,
|
manuallyApproveFollowers = \
|
||||||
showIndividualPostIcons,
|
followerApprovalActive(baseDir, handleName, domain)
|
||||||
manuallyApproveFollowers,
|
notDM = not isDM(likedPostJson)
|
||||||
False, True, False)
|
individualPostAsHtml(signingPrivateKeyPem, False,
|
||||||
|
recentPostsCache, maxRecentPosts,
|
||||||
|
translate, pageNumber, baseDir,
|
||||||
|
session, cachedWebfingers, personCache,
|
||||||
|
handleName, domain, port, likedPostJson,
|
||||||
|
None, True, allowDeletion,
|
||||||
|
httpPrefix, __version__,
|
||||||
|
'inbox',
|
||||||
|
YTReplacementDomain,
|
||||||
|
twitterReplacementDomain,
|
||||||
|
showPublishedDateOnly,
|
||||||
|
peertubeInstances,
|
||||||
|
allowLocalNetworkAccess,
|
||||||
|
themeName, systemLanguage,
|
||||||
|
maxLikeCount, notDM,
|
||||||
|
showIndividualPostIcons,
|
||||||
|
manuallyApproveFollowers,
|
||||||
|
False, True, False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue