mirror of https://gitlab.com/bashrc2/epicyon
Update html post cache as new posts arrive
parent
6052729665
commit
1fc5750174
|
@ -4825,7 +4825,7 @@ def runDaemon(projectVersion, \
|
||||||
domain,port,useTor,httpd.federationList, \
|
domain,port,useTor,httpd.federationList, \
|
||||||
httpd.ocapAlways,maxReplies, \
|
httpd.ocapAlways,maxReplies, \
|
||||||
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
||||||
allowDeletion,debug,maxMentions, \
|
allowDeletion,debug,maxMentions,httpd.translate, \
|
||||||
httpd.acceptedCaps),daemon=True)
|
httpd.acceptedCaps),daemon=True)
|
||||||
if not unitTest:
|
if not unitTest:
|
||||||
httpd.thrWatchdog= \
|
httpd.thrWatchdog= \
|
||||||
|
|
34
inbox.py
34
inbox.py
|
@ -47,6 +47,28 @@ from posts import downloadAnnounce
|
||||||
from posts import isDM
|
from posts import isDM
|
||||||
from posts import isReply
|
from posts import isReply
|
||||||
from posts import sendSignedJson
|
from posts import sendSignedJson
|
||||||
|
from webinterface import individualPostAsHtml
|
||||||
|
from webinterface import getIconsDir
|
||||||
|
|
||||||
|
def inboxStorePostToHtmlCache(translate: {}, \
|
||||||
|
baseDir: str,httpPrefix: str, \
|
||||||
|
session,wfRequest: {},personCache: {}, \
|
||||||
|
nickname: str,domain: str,port: int, \
|
||||||
|
postJsonObject: {}, \
|
||||||
|
allowDeletion: bool) -> None:
|
||||||
|
"""Converts the json post into html and stores it in a cache
|
||||||
|
This enables the post to be quickly displayed later
|
||||||
|
"""
|
||||||
|
pageNumber=1
|
||||||
|
showAvatarOptions=True
|
||||||
|
avatarUrl=None
|
||||||
|
individualPostAsHtml(getIconsDir(baseDir),translate,pageNumber, \
|
||||||
|
baseDir,session,wfRequest,personCache, \
|
||||||
|
nickname,domain,port,item,avatarUrl,True, \
|
||||||
|
allowDeletion, \
|
||||||
|
httpPrefix,__version__,boxName, \
|
||||||
|
not isDM(postJsonObject), \
|
||||||
|
True,True,False,True)
|
||||||
|
|
||||||
def validInbox(baseDir: str,nickname: str,domain: str) -> bool:
|
def validInbox(baseDir: str,nickname: str,domain: str) -> bool:
|
||||||
"""Checks whether files were correctly saved to the inbox
|
"""Checks whether files were correctly saved to the inbox
|
||||||
|
@ -1489,7 +1511,7 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
|
||||||
acceptedCaps: [], \
|
acceptedCaps: [], \
|
||||||
queueFilename :str,destinationFilename :str, \
|
queueFilename :str,destinationFilename :str, \
|
||||||
maxReplies: int,allowDeletion: bool, \
|
maxReplies: int,allowDeletion: bool, \
|
||||||
maxMentions: int) -> bool:
|
maxMentions: int,translate: {}) -> bool:
|
||||||
""" Anything which needs to be done after capabilities checks have passed
|
""" Anything which needs to be done after capabilities checks have passed
|
||||||
"""
|
"""
|
||||||
actor=keyId
|
actor=keyId
|
||||||
|
@ -1614,6 +1636,11 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
|
||||||
|
|
||||||
inboxUpdateCalendar(baseDir,handle,postJsonObject)
|
inboxUpdateCalendar(baseDir,handle,postJsonObject)
|
||||||
|
|
||||||
|
inboxStorePostToHtmlCache(translate,baseDir,httpPrefix, \
|
||||||
|
session,cachedWebfingers,personCache, \
|
||||||
|
handle.split('@')[0],domain,port, \
|
||||||
|
postJsonObject,allowDeletion)
|
||||||
|
|
||||||
# send the post out to group members
|
# send the post out to group members
|
||||||
if isGroup:
|
if isGroup:
|
||||||
sendToGroupMembers(session,baseDir,handle,port,postJsonObject, \
|
sendToGroupMembers(session,baseDir,handle,port,postJsonObject, \
|
||||||
|
@ -1662,6 +1689,7 @@ def runInboxQueue(projectVersion: str, \
|
||||||
ocapAlways: bool,maxReplies: int, \
|
ocapAlways: bool,maxReplies: int, \
|
||||||
domainMaxPostsPerDay: int,accountMaxPostsPerDay: int, \
|
domainMaxPostsPerDay: int,accountMaxPostsPerDay: int, \
|
||||||
allowDeletion: bool,debug: bool,maxMentions: int, \
|
allowDeletion: bool,debug: bool,maxMentions: int, \
|
||||||
|
translate: {}, \
|
||||||
acceptedCaps=["inbox:write","objects:read"]) -> None:
|
acceptedCaps=["inbox:write","objects:read"]) -> None:
|
||||||
"""Processes received items and moves them to
|
"""Processes received items and moves them to
|
||||||
the appropriate directories
|
the appropriate directories
|
||||||
|
@ -2021,7 +2049,7 @@ def runInboxQueue(projectVersion: str, \
|
||||||
debug,acceptedCaps, \
|
debug,acceptedCaps, \
|
||||||
queueFilename,destination, \
|
queueFilename,destination, \
|
||||||
maxReplies,allowDeletion, \
|
maxReplies,allowDeletion, \
|
||||||
maxMentions)
|
maxMentions,translate)
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: object capabilities check has failed')
|
print('DEBUG: object capabilities check has failed')
|
||||||
|
@ -2039,7 +2067,7 @@ def runInboxQueue(projectVersion: str, \
|
||||||
debug,acceptedCaps, \
|
debug,acceptedCaps, \
|
||||||
queueFilename,destination, \
|
queueFilename,destination, \
|
||||||
maxReplies,allowDeletion, \
|
maxReplies,allowDeletion, \
|
||||||
maxMentions)
|
maxMentions,translate)
|
||||||
if debug:
|
if debug:
|
||||||
pprint(queueJson['post'])
|
pprint(queueJson['post'])
|
||||||
print('No capability list within post')
|
print('No capability list within post')
|
||||||
|
|
|
@ -1777,7 +1777,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
session,wfRequest: {},personCache: {}, \
|
session,wfRequest: {},personCache: {}, \
|
||||||
nickname: str,domain: str,port: int, \
|
nickname: str,domain: str,port: int, \
|
||||||
postJsonObject: {}, \
|
postJsonObject: {}, \
|
||||||
avatarUrl: str, showAvatarDropdown: bool,
|
avatarUrl: str, showAvatarOptions: bool,
|
||||||
allowDeletion: bool, \
|
allowDeletion: bool, \
|
||||||
httpPrefix: str, projectVersion: str, \
|
httpPrefix: str, projectVersion: str, \
|
||||||
boxName: str, \
|
boxName: str, \
|
||||||
|
@ -2030,7 +2030,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
' <img loading="lazy" src="'+avatarUrl+'" title="'+translate['Show profile']+'" alt="Avatar"'+avatarPosition+'/></a>' \
|
' <img loading="lazy" src="'+avatarUrl+'" title="'+translate['Show profile']+'" alt="Avatar"'+avatarPosition+'/></a>' \
|
||||||
' </div>'
|
' </div>'
|
||||||
|
|
||||||
if showAvatarDropdown and fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
if showAvatarOptions and fullDomain+'/users/'+nickname not in postJsonObject['actor']:
|
||||||
avatarImageInPost= \
|
avatarImageInPost= \
|
||||||
' <div class="timeline-avatar">' \
|
' <div class="timeline-avatar">' \
|
||||||
' <a href="/users/'+nickname+'?options='+postJsonObject['actor']+';'+str(pageNumber)+';'+avatarUrl+messageIdStr+'">' \
|
' <a href="/users/'+nickname+'?options='+postJsonObject['actor']+';'+str(pageNumber)+';'+avatarUrl+messageIdStr+'">' \
|
||||||
|
|
Loading…
Reference in New Issue