mirror of https://gitlab.com/bashrc2/epicyon
Private announces
parent
ad7dfa1d3c
commit
f8370a4e23
|
@ -270,8 +270,7 @@ def createAnnounce(session,baseDir: str,federationList: [], \
|
||||||
if announceNickname and announceDomain:
|
if announceNickname and announceDomain:
|
||||||
sendSignedJson(newAnnounce,session,baseDir, \
|
sendSignedJson(newAnnounce,session,baseDir, \
|
||||||
nickname,domain,port, \
|
nickname,domain,port, \
|
||||||
announceNickname,announceDomain,announcePort, \
|
announceNickname,announceDomain,announcePort,None, \
|
||||||
'https://www.w3.org/ns/activitystreams#Public', \
|
|
||||||
httpPrefix,True,clientToServer,federationList, \
|
httpPrefix,True,clientToServer,federationList, \
|
||||||
sendThreads,postLog,cachedWebfingers,personCache, \
|
sendThreads,postLog,cachedWebfingers,personCache, \
|
||||||
debug,projectVersion)
|
debug,projectVersion)
|
||||||
|
|
36
daemon.py
36
daemon.py
|
@ -1522,10 +1522,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
self._benchmarkGETtimings(GETstartTime,GETtimings,31)
|
self._benchmarkGETtimings(GETstartTime,GETtimings,31)
|
||||||
|
|
||||||
|
repeatPrivate=False
|
||||||
|
if htmlGET and '?repeatprivate=' in self.path:
|
||||||
|
repeatPrivate=True
|
||||||
# announce/repeat from the web interface
|
# announce/repeat from the web interface
|
||||||
if htmlGET and '?repeat=' in self.path:
|
if htmlGET and '?repeat=' in self.path:
|
||||||
pageNumber=1
|
pageNumber=1
|
||||||
repeatUrl=self.path.split('?repeat=')[1]
|
if not repeatPrivate:
|
||||||
|
repeatUrl=self.path.split('?repeat=')[1]
|
||||||
|
else:
|
||||||
|
repeatUrl=self.path.split('?repeatprivate=')[1]
|
||||||
if '?' in repeatUrl:
|
if '?' in repeatUrl:
|
||||||
repeatUrl=repeatUrl.split('?')[0]
|
repeatUrl=repeatUrl.split('?')[0]
|
||||||
timelineBookmark=''
|
timelineBookmark=''
|
||||||
|
@ -1545,7 +1551,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
timelineStr=self.path.split('?tl=')[1]
|
timelineStr=self.path.split('?tl=')[1]
|
||||||
if '?' in timelineStr:
|
if '?' in timelineStr:
|
||||||
timelineStr=timelineStr.split('?')[0]
|
timelineStr=timelineStr.split('?')[0]
|
||||||
actor=self.path.split('?repeat=')[0]
|
if not repeatPrivate:
|
||||||
|
actor=self.path.split('?repeat=')[0]
|
||||||
|
else:
|
||||||
|
actor=self.path.split('?repeatprivate=')[0]
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
|
@ -1558,13 +1567,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.session= \
|
self.server.session= \
|
||||||
createSession(self.server.useTor)
|
createSession(self.server.useTor)
|
||||||
self.server.actorRepeat=self.path.split('?actor=')[1]
|
self.server.actorRepeat=self.path.split('?actor=')[1]
|
||||||
|
announceToStr=self.server.httpPrefix+'://'+self.server.domain+'/users/'+self.postToNickname+'/followers'
|
||||||
|
if not repeatPrivate:
|
||||||
|
announceToStr='https://www.w3.org/ns/activitystreams#Public'
|
||||||
announceJson= \
|
announceJson= \
|
||||||
createAnnounce(self.server.session, \
|
createAnnounce(self.server.session, \
|
||||||
self.server.baseDir, \
|
self.server.baseDir, \
|
||||||
self.server.federationList, \
|
self.server.federationList, \
|
||||||
self.postToNickname, \
|
self.postToNickname, \
|
||||||
self.server.domain,self.server.port, \
|
self.server.domain,self.server.port, \
|
||||||
'https://www.w3.org/ns/activitystreams#Public', \
|
announceToStr, \
|
||||||
None,self.server.httpPrefix, \
|
None,self.server.httpPrefix, \
|
||||||
repeatUrl,False,False, \
|
repeatUrl,False,False, \
|
||||||
self.server.sendThreads, \
|
self.server.sendThreads, \
|
||||||
|
@ -1584,10 +1596,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
self._benchmarkGETtimings(GETstartTime,GETtimings,32)
|
self._benchmarkGETtimings(GETstartTime,GETtimings,32)
|
||||||
|
|
||||||
|
unrepeatPrivate=False
|
||||||
|
if htmlGET and '?unrepeatprivate=' in self.path:
|
||||||
|
unrepeatPrivate=True
|
||||||
# undo an announce/repeat from the web interface
|
# undo an announce/repeat from the web interface
|
||||||
if htmlGET and '?unrepeat=' in self.path:
|
if htmlGET and '?unrepeat=' in self.path:
|
||||||
pageNumber=1
|
pageNumber=1
|
||||||
repeatUrl=self.path.split('?unrepeat=')[1]
|
if not unrepeatPrivate:
|
||||||
|
repeatUrl=self.path.split('?unrepeat=')[1]
|
||||||
|
else:
|
||||||
|
repeatUrl=self.path.split('?unrepeatprivate=')[1]
|
||||||
if '?' in repeatUrl:
|
if '?' in repeatUrl:
|
||||||
repeatUrl=repeatUrl.split('?')[0]
|
repeatUrl=repeatUrl.split('?')[0]
|
||||||
timelineBookmark=''
|
timelineBookmark=''
|
||||||
|
@ -1607,7 +1625,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
timelineStr=self.path.split('?tl=')[1]
|
timelineStr=self.path.split('?tl=')[1]
|
||||||
if '?' in timelineStr:
|
if '?' in timelineStr:
|
||||||
timelineStr=timelineStr.split('?')[0]
|
timelineStr=timelineStr.split('?')[0]
|
||||||
actor=self.path.split('?unrepeat=')[0]
|
if not unrepeatPrivate:
|
||||||
|
actor=self.path.split('?unrepeat=')[0]
|
||||||
|
else:
|
||||||
|
actor=self.path.split('?unrepeatprivate=')[0]
|
||||||
self.postToNickname=getNicknameFromActor(actor)
|
self.postToNickname=getNicknameFromActor(actor)
|
||||||
if not self.postToNickname:
|
if not self.postToNickname:
|
||||||
print('WARN: unable to find nickname in '+actor)
|
print('WARN: unable to find nickname in '+actor)
|
||||||
|
@ -1622,17 +1643,18 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
undoAnnounceActor= \
|
undoAnnounceActor= \
|
||||||
self.server.httpPrefix+'://'+self.server.domainFull+ \
|
self.server.httpPrefix+'://'+self.server.domainFull+ \
|
||||||
'/users/'+self.postToNickname
|
'/users/'+self.postToNickname
|
||||||
|
unRepeatToStr='https://www.w3.org/ns/activitystreams#Public'
|
||||||
newUndoAnnounce = {
|
newUndoAnnounce = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'actor': undoAnnounceActor,
|
'actor': undoAnnounceActor,
|
||||||
'type': 'Undo',
|
'type': 'Undo',
|
||||||
'cc': [undoAnnounceActor+'/followers'],
|
'cc': [undoAnnounceActor+'/followers'],
|
||||||
'to': ['https://www.w3.org/ns/activitystreams#Public'],
|
'to': [unRepeatToStr],
|
||||||
'object': {
|
'object': {
|
||||||
'actor': undoAnnounceActor,
|
'actor': undoAnnounceActor,
|
||||||
'cc': [undoAnnounceActor+'/followers'],
|
'cc': [undoAnnounceActor+'/followers'],
|
||||||
'object': repeatUrl,
|
'object': repeatUrl,
|
||||||
'to': ['https://www.w3.org/ns/activitystreams#Public'],
|
'to': [unRepeatToStr],
|
||||||
'type': 'Announce'
|
'type': 'Announce'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2247,13 +2247,15 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
|
|
||||||
# If this is the inbox timeline then don't show the repeat icon on any DMs
|
# If this is the inbox timeline then don't show the repeat icon on any DMs
|
||||||
showRepeatIcon=showRepeats
|
showRepeatIcon=showRepeats
|
||||||
|
isPublicRepeat=False
|
||||||
showDMicon=False
|
showDMicon=False
|
||||||
if showRepeats:
|
if showRepeats:
|
||||||
if isDM(postJsonObject):
|
if isDM(postJsonObject):
|
||||||
showDMicon=True
|
showDMicon=True
|
||||||
else:
|
else:
|
||||||
|
showRepeatIcon=False
|
||||||
if not isPublicPost(postJsonObject):
|
if not isPublicPost(postJsonObject):
|
||||||
showRepeatIcon=False
|
isPublicRepeat=True
|
||||||
|
|
||||||
titleStr=''
|
titleStr=''
|
||||||
galleryStr=''
|
galleryStr=''
|
||||||
|
@ -2326,7 +2328,7 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
replyToLink+=pageNumberParam
|
replyToLink+=pageNumberParam
|
||||||
|
|
||||||
replyStr=''
|
replyStr=''
|
||||||
if showRepeatIcon:
|
if isPublicRepeat:
|
||||||
replyStr+= \
|
replyStr+= \
|
||||||
'<a href="/users/'+nickname+'?replyto='+replyToLink+ \
|
'<a href="/users/'+nickname+'?replyto='+replyToLink+ \
|
||||||
'?actor='+postJsonObject['actor']+ \
|
'?actor='+postJsonObject['actor']+ \
|
||||||
|
@ -2350,10 +2352,13 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
|
||||||
# don't allow announce/repeat of your own posts
|
# don't allow announce/repeat of your own posts
|
||||||
announceIcon='repeat_inactive.png'
|
announceIcon='repeat_inactive.png'
|
||||||
announceLink='repeat'
|
announceLink='repeat'
|
||||||
|
if not isPublicRepeat:
|
||||||
|
announceLink='repeatprivate'
|
||||||
announceTitle=translate['Repeat this post']
|
announceTitle=translate['Repeat this post']
|
||||||
if announcedByPerson(postJsonObject,nickname,fullDomain):
|
if announcedByPerson(postJsonObject,nickname,fullDomain):
|
||||||
announceIcon='repeat.png'
|
announceIcon='repeat.png'
|
||||||
announceLink='unrepeat'
|
if not isPublicRepeat:
|
||||||
|
announceLink='unrepeatprivate'
|
||||||
announceTitle=translate['Undo the repeat']
|
announceTitle=translate['Undo the repeat']
|
||||||
announceStr= \
|
announceStr= \
|
||||||
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+pageNumberParam+ \
|
'<a href="/users/'+nickname+'?'+announceLink+'='+postJsonObject['object']['id']+pageNumberParam+ \
|
||||||
|
|
Loading…
Reference in New Issue