mirror of https://gitlab.com/bashrc2/epicyon
Move follow deny to its own method
parent
ca2db38b95
commit
3847c10731
87
daemon.py
87
daemon.py
|
@ -4276,6 +4276,46 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'follow approve shown')
|
'follow approve shown')
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
|
|
||||||
|
def _followDenyButton(self, callingDomain: str, path: str,
|
||||||
|
cookie: str,
|
||||||
|
baseDir: str, httpPrefix: str,
|
||||||
|
domain: str, domainFull: str, port: int,
|
||||||
|
onionDomain: str, i2pDomain: str,
|
||||||
|
GETstartTime, GETtimings: {},
|
||||||
|
proxyType: str, debug: bool):
|
||||||
|
"""Follow deny button was pressed
|
||||||
|
"""
|
||||||
|
originPathStr = path.split('/followdeny=')[0]
|
||||||
|
followerNickname = originPathStr.replace('/users/', '')
|
||||||
|
followingHandle = path.split('/followdeny=')[1]
|
||||||
|
if '@' in followingHandle:
|
||||||
|
manualDenyFollowRequest(self.server.session,
|
||||||
|
baseDir, httpPrefix,
|
||||||
|
followerNickname,
|
||||||
|
domain, port,
|
||||||
|
followingHandle,
|
||||||
|
self.server.federationList,
|
||||||
|
self.server.sendThreads,
|
||||||
|
self.server.postLog,
|
||||||
|
self.server.cachedWebfingers,
|
||||||
|
self.server.personCache,
|
||||||
|
debug,
|
||||||
|
self.server.projectVersion)
|
||||||
|
originPathStrAbsolute = \
|
||||||
|
httpPrefix + '://' + domainFull + originPathStr
|
||||||
|
if callingDomain.endswith('.onion') and onionDomain:
|
||||||
|
originPathStrAbsolute = \
|
||||||
|
'http://' + onionDomain + originPathStr
|
||||||
|
elif callingDomain.endswith('.i2p') and i2pDomain:
|
||||||
|
originPathStrAbsolute = \
|
||||||
|
'http://' + i2pDomain + originPathStr
|
||||||
|
self._redirect_headers(originPathStrAbsolute,
|
||||||
|
cookie, callingDomain)
|
||||||
|
self.server.GETbusy = False
|
||||||
|
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
||||||
|
'follow approve done',
|
||||||
|
'follow deny shown')
|
||||||
|
|
||||||
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'):
|
||||||
|
@ -5518,41 +5558,18 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# deny a follow request from the web interface
|
# deny a follow request from the web interface
|
||||||
if authorized and '/followdeny=' in self.path and \
|
if authorized and '/followdeny=' in self.path and \
|
||||||
self.path.startswith('/users/'):
|
self.path.startswith('/users/'):
|
||||||
originPathStr = self.path.split('/followdeny=')[0]
|
self._followDenyButton(callingDomain, self.path,
|
||||||
followerNickname = originPathStr.replace('/users/', '')
|
cookie,
|
||||||
followingHandle = self.path.split('/followdeny=')[1]
|
self.server.baseDir,
|
||||||
if '@' in followingHandle:
|
self.server.httpPrefix,
|
||||||
manualDenyFollowRequest(self.server.session,
|
self.server.domain,
|
||||||
self.server.baseDir,
|
self.server.domainFull,
|
||||||
self.server.httpPrefix,
|
self.server.port,
|
||||||
followerNickname,
|
self.server.onionDomain,
|
||||||
self.server.domain,
|
self.server.i2pDomain,
|
||||||
self.server.port,
|
GETstartTime, GETtimings,
|
||||||
followingHandle,
|
self.server.proxyType,
|
||||||
self.server.federationList,
|
self.server.debug)
|
||||||
self.server.sendThreads,
|
|
||||||
self.server.postLog,
|
|
||||||
self.server.cachedWebfingers,
|
|
||||||
self.server.personCache,
|
|
||||||
self.server.debug,
|
|
||||||
self.server.projectVersion)
|
|
||||||
originPathStrAbsolute = \
|
|
||||||
self.server.httpPrefix + '://' + \
|
|
||||||
self.server.domainFull + originPathStr
|
|
||||||
if callingDomain.endswith('.onion') and \
|
|
||||||
self.server.onionDomain:
|
|
||||||
originPathStrAbsolute = 'http://' + \
|
|
||||||
self.server.onionDomain + originPathStr
|
|
||||||
elif (callingDomain.endswith('.i2p') and
|
|
||||||
self.server.i2pDomain):
|
|
||||||
originPathStrAbsolute = 'http://' + \
|
|
||||||
self.server.i2pDomain + originPathStr
|
|
||||||
self._redirect_headers(originPathStrAbsolute,
|
|
||||||
cookie, callingDomain)
|
|
||||||
self.server.GETbusy = False
|
|
||||||
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
|
||||||
'follow approve done',
|
|
||||||
'follow deny shown')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
||||||
|
|
Loading…
Reference in New Issue