mirror of https://gitlab.com/bashrc2/epicyon
Spaces
parent
25d0cd8c65
commit
b4783c510d
2
auth.py
2
auth.py
|
@ -126,7 +126,7 @@ def authorizeBasic(baseDir: str, path: str, authHeader: str,
|
||||||
') does not match the one in the Authorization header (' +
|
') does not match the one in the Authorization header (' +
|
||||||
nickname + ')')
|
nickname + ')')
|
||||||
return False
|
return False
|
||||||
passwordFile = baseDir+'/accounts/passwords'
|
passwordFile = baseDir + '/accounts/passwords'
|
||||||
if not os.path.isfile(passwordFile):
|
if not os.path.isfile(passwordFile):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: passwords file missing')
|
print('DEBUG: passwords file missing')
|
||||||
|
|
2
cache.py
2
cache.py
|
@ -68,7 +68,7 @@ def storePersonInCache(baseDir: str, personUrl: str,
|
||||||
# store to file
|
# store to file
|
||||||
if not allowWriteToFile:
|
if not allowWriteToFile:
|
||||||
return
|
return
|
||||||
if os.path.isdir(baseDir+'/cache/actors'):
|
if os.path.isdir(baseDir + '/cache/actors'):
|
||||||
cacheFilename = baseDir + '/cache/actors/' + \
|
cacheFilename = baseDir + '/cache/actors/' + \
|
||||||
personUrl.replace('/', '#')+'.json'
|
personUrl.replace('/', '#')+'.json'
|
||||||
if not os.path.isfile(cacheFilename):
|
if not os.path.isfile(cacheFilename):
|
||||||
|
|
|
@ -1532,7 +1532,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# This produces a deterministic token based
|
# This produces a deterministic token based
|
||||||
# on nick+password+salt
|
# on nick+password+salt
|
||||||
saltFilename = \
|
saltFilename = \
|
||||||
baseDir+'/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
loginNickname + '@' + domain + '/.salt'
|
loginNickname + '@' + domain + '/.salt'
|
||||||
salt = createPassword(32)
|
salt = createPassword(32)
|
||||||
if os.path.isfile(saltFilename):
|
if os.path.isfile(saltFilename):
|
||||||
|
@ -1555,7 +1555,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.tokens[loginNickname] = token
|
self.server.tokens[loginNickname] = token
|
||||||
loginHandle = loginNickname + '@' + domain
|
loginHandle = loginNickname + '@' + domain
|
||||||
tokenFilename = \
|
tokenFilename = \
|
||||||
baseDir+'/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
loginHandle + '/.token'
|
loginHandle + '/.token'
|
||||||
try:
|
try:
|
||||||
with open(tokenFilename, 'w+') as fp:
|
with open(tokenFilename, 'w+') as fp:
|
||||||
|
|
2
inbox.py
2
inbox.py
|
@ -189,7 +189,7 @@ def validInbox(baseDir: str, nickname: str, domain: str) -> bool:
|
||||||
"""
|
"""
|
||||||
if ':' in domain:
|
if ':' in domain:
|
||||||
domain = domain.split(':')[0]
|
domain = domain.split(':')[0]
|
||||||
inboxDir = baseDir+'/accounts/' + nickname + '@' + domain + '/inbox'
|
inboxDir = baseDir + '/accounts/' + nickname + '@' + domain + '/inbox'
|
||||||
if not os.path.isdir(inboxDir):
|
if not os.path.isdir(inboxDir):
|
||||||
return True
|
return True
|
||||||
for subdir, dirs, files in os.walk(inboxDir):
|
for subdir, dirs, files in os.walk(inboxDir):
|
||||||
|
|
10
shares.py
10
shares.py
|
@ -264,8 +264,8 @@ def getSharesFeedForPerson(baseDir: str,
|
||||||
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
||||||
shares = {
|
shares = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'first': idStr+'/shares?page=1',
|
'first': idStr + '/shares?page=1',
|
||||||
'id': idStr+'/shares',
|
'id': idStr + '/shares',
|
||||||
'totalItems': str(noOfShares),
|
'totalItems': str(noOfShares),
|
||||||
'type': 'OrderedCollection'
|
'type': 'OrderedCollection'
|
||||||
}
|
}
|
||||||
|
@ -278,9 +278,9 @@ def getSharesFeedForPerson(baseDir: str,
|
||||||
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
||||||
shares = {
|
shares = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': idStr+'/shares?page='+str(pageNumber),
|
'id': idStr + '/shares?page=' + str(pageNumber),
|
||||||
'orderedItems': [],
|
'orderedItems': [],
|
||||||
'partOf': idStr+'/shares',
|
'partOf': idStr + '/shares',
|
||||||
'totalItems': 0,
|
'totalItems': 0,
|
||||||
'type': 'OrderedCollectionPage'
|
'type': 'OrderedCollectionPage'
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ def sendShareViaServer(baseDir, session,
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Add',
|
'type': 'Add',
|
||||||
'actor': actor,
|
'actor': actor,
|
||||||
'target': actor+'/shares',
|
'target': actor + '/shares',
|
||||||
'object': {
|
'object': {
|
||||||
"type": "Offer",
|
"type": "Offer",
|
||||||
"displayName": displayName,
|
"displayName": displayName,
|
||||||
|
|
|
@ -1242,7 +1242,7 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
||||||
galleryStr += \
|
galleryStr += \
|
||||||
' ' + replyStr + announceStr + \
|
' ' + replyStr + announceStr + \
|
||||||
likeStr + bookmarkStr + \
|
likeStr + bookmarkStr + \
|
||||||
deleteStr + muteStr+'\n'
|
deleteStr + muteStr + '\n'
|
||||||
galleryStr += ' </div>\n'
|
galleryStr += ' </div>\n'
|
||||||
galleryStr += ' <div class="mediaavatar">\n'
|
galleryStr += ' <div class="mediaavatar">\n'
|
||||||
galleryStr += ' ' + avatarLink + '\n'
|
galleryStr += ' ' + avatarLink + '\n'
|
||||||
|
|
Loading…
Reference in New Issue