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