mirror of https://gitlab.com/bashrc2/epicyon
Send block activity from person options screen
parent
e1bb1b885e
commit
8e4b63e864
37
daemon.py
37
daemon.py
|
@ -2296,12 +2296,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# person options screen, block button
|
# person options screen, block button
|
||||||
# See htmlPersonOptions
|
# See htmlPersonOptions
|
||||||
if '&submitBlock=' in optionsConfirmParams:
|
if '&submitBlock=' in optionsConfirmParams:
|
||||||
if debug:
|
|
||||||
print('Adding block by ' + chooserNickname +
|
print('Adding block by ' + chooserNickname +
|
||||||
' of ' + optionsActor)
|
' of ' + optionsActor)
|
||||||
addBlock(baseDir, chooserNickname,
|
addBlock(baseDir, chooserNickname,
|
||||||
domain,
|
domain,
|
||||||
optionsNickname, optionsDomainFull)
|
optionsNickname, optionsDomainFull)
|
||||||
|
# send block activity
|
||||||
|
self._sendBlock(httpPrefix,
|
||||||
|
chooserNickname, domainFull,
|
||||||
|
optionsNickname, optionsDomainFull)
|
||||||
|
|
||||||
# person options screen, unblock button
|
# person options screen, unblock button
|
||||||
# See htmlPersonOptions
|
# See htmlPersonOptions
|
||||||
|
@ -2767,13 +2770,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if debug:
|
if debug:
|
||||||
print('You cannot block yourself!')
|
print('You cannot block yourself!')
|
||||||
else:
|
else:
|
||||||
if debug:
|
|
||||||
print('Adding block by ' + blockerNickname +
|
print('Adding block by ' + blockerNickname +
|
||||||
' of ' + blockingActor)
|
' of ' + blockingActor)
|
||||||
addBlock(baseDir, blockerNickname,
|
addBlock(baseDir, blockerNickname,
|
||||||
domain,
|
domain,
|
||||||
blockingNickname,
|
blockingNickname,
|
||||||
blockingDomainFull)
|
blockingDomainFull)
|
||||||
|
# send block activity
|
||||||
|
self._sendBlock(httpPrefix,
|
||||||
|
blockerNickname, domainFull,
|
||||||
|
blockingNickname, blockingDomainFull)
|
||||||
if callingDomain.endswith('.onion') and onionDomain:
|
if callingDomain.endswith('.onion') and onionDomain:
|
||||||
originPathStr = 'http://' + onionDomain + usersPath
|
originPathStr = 'http://' + onionDomain + usersPath
|
||||||
elif (callingDomain.endswith('.i2p') and i2pDomain):
|
elif (callingDomain.endswith('.i2p') and i2pDomain):
|
||||||
|
@ -10873,6 +10879,33 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
msglen, None, callingDomain, False)
|
msglen, None, callingDomain, False)
|
||||||
self._write(msg)
|
self._write(msg)
|
||||||
|
|
||||||
|
def _sendBlock(self, httpPrefix: str,
|
||||||
|
blockerNickname: str, blockerDomainFull: str,
|
||||||
|
blockingNickname: str, blockingDomainFull: str) -> bool:
|
||||||
|
if blockerDomainFull == blockingDomainFull:
|
||||||
|
if blockerNickname == blockingNickname:
|
||||||
|
# don't block self
|
||||||
|
return False
|
||||||
|
blockActor = \
|
||||||
|
httpPrefix + '://' + blockerDomainFull + '/users/' + \
|
||||||
|
blockerNickname
|
||||||
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
|
ccUrl = blockActor + '/followers'
|
||||||
|
|
||||||
|
blockedUrl = \
|
||||||
|
httpPrefix + '://' + blockingDomainFull + \
|
||||||
|
'/@' + blockingNickname
|
||||||
|
blockJson = {
|
||||||
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
'type': 'Block',
|
||||||
|
'actor': blockActor,
|
||||||
|
'object': blockedUrl,
|
||||||
|
'to': [toUrl],
|
||||||
|
'cc': [ccUrl]
|
||||||
|
}
|
||||||
|
self._postToOutbox(blockJson, self.server.projectVersion)
|
||||||
|
return True
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
callingDomain = self.server.domainFull
|
callingDomain = self.server.domainFull
|
||||||
if self.headers.get('Host'):
|
if self.headers.get('Host'):
|
||||||
|
|
Loading…
Reference in New Issue