mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
d38d36ecdb
commit
f5330c7682
28
daemon.py
28
daemon.py
|
@ -65,7 +65,6 @@ from person import removeAccount
|
|||
from person import canRemovePost
|
||||
from person import personSnooze
|
||||
from person import personUnsnooze
|
||||
from posts import getPersonKey
|
||||
from posts import isModerator
|
||||
from posts import mutePost
|
||||
from posts import unmutePost
|
||||
|
@ -590,33 +589,6 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.send_header('ETag', etag)
|
||||
self.end_headers()
|
||||
|
||||
def _set_headers_with_sig(self, fileFormat: str, length: int,
|
||||
baseDir: str, path: str,
|
||||
domain: str, domainFull: str, port: int,
|
||||
httpPrefix: str,
|
||||
callingDomain: str, debug: bool,
|
||||
jsonStr: str) -> None:
|
||||
self._set_headers_base(fileFormat, length, None, callingDomain)
|
||||
nickname = path.split('/users/')[1]
|
||||
if '/' in nickname:
|
||||
nickname = nickname.split('/')[0]
|
||||
privateKeyPem = \
|
||||
getPersonKey(nickname, domain, baseDir, 'private', debug)
|
||||
if len(privateKeyPem) > 0:
|
||||
boxPath = '/inbox'
|
||||
signatureHeaderJson = \
|
||||
createSignedHeader(privateKeyPem, nickname,
|
||||
domain, port,
|
||||
callingDomain, port,
|
||||
boxPath,
|
||||
httpPrefix, True, jsonStr)
|
||||
print('@ detected signatureHeaderJson: ' + str(signatureHeaderJson))
|
||||
for headerName, headerItem in signatureHeaderJson.items():
|
||||
self.send_header(headerName, headerItem)
|
||||
self.send_header('User-Agent', 'Epicyon/' + __version__ +
|
||||
'; +' + httpPrefix + '://' + domainFull + '/')
|
||||
self.end_headers()
|
||||
|
||||
def _set_headers_etag(self, mediaFilename: str, fileFormat: str,
|
||||
data, cookie: str, callingDomain: str) -> None:
|
||||
datalen = len(data)
|
||||
|
|
8
posts.py
8
posts.py
|
@ -118,8 +118,8 @@ def noOfFollowersOnDomain(baseDir: str, handle: str,
|
|||
return ctr
|
||||
|
||||
|
||||
def getPersonKey(nickname: str, domain: str, baseDir: str, keyType='public',
|
||||
debug=False):
|
||||
def _getPersonKey(nickname: str, domain: str, baseDir: str, keyType='public',
|
||||
debug=False):
|
||||
"""Returns the public or private key of a person
|
||||
"""
|
||||
handle = nickname + '@' + domain
|
||||
|
@ -1837,7 +1837,7 @@ def sendPost(projectVersion: str,
|
|||
None, None, None, None, None)
|
||||
|
||||
# get the senders private key
|
||||
privateKeyPem = getPersonKey(nickname, domain, baseDir, 'private')
|
||||
privateKeyPem = _getPersonKey(nickname, domain, baseDir, 'private')
|
||||
if len(privateKeyPem) == 0:
|
||||
return 6
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ def sendSignedJson(postJsonObject: {}, session, baseDir: str,
|
|||
# sharedInbox is optional
|
||||
|
||||
# get the senders private key
|
||||
privateKeyPem = getPersonKey(nickname, domain, baseDir, 'private', debug)
|
||||
privateKeyPem = _getPersonKey(nickname, domain, baseDir, 'private', debug)
|
||||
if len(privateKeyPem) == 0:
|
||||
if debug:
|
||||
print('DEBUG: Private key not found for ' +
|
||||
|
|
Loading…
Reference in New Issue