mirror of https://gitlab.com/bashrc2/epicyon
Spaces
parent
b4783c510d
commit
80f43a728a
|
@ -38,7 +38,7 @@ def _createAcceptReject(baseDir: str, federationList: [],
|
|||
newAccept = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': acceptType,
|
||||
'actor': httpPrefix+'://' + domain + '/users/' + nickname,
|
||||
'actor': httpPrefix + '://' + domain + '/users/' + nickname,
|
||||
'to': [toUrl],
|
||||
'cc': [],
|
||||
'object': objectJson
|
||||
|
@ -120,9 +120,9 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {},
|
|||
print('DEBUG: unrecognized actor ' + thisActor)
|
||||
return
|
||||
else:
|
||||
if not '/' + acceptedDomain+'/users/' + nickname in thisActor:
|
||||
if not '/' + acceptedDomain + '/users/' + nickname in thisActor:
|
||||
if debug:
|
||||
print('Expected: /' + acceptedDomain+'/users/' + nickname)
|
||||
print('Expected: /' + acceptedDomain + '/users/' + nickname)
|
||||
print('Actual: ' + thisActor)
|
||||
print('DEBUG: unrecognized actor ' + thisActor)
|
||||
return
|
||||
|
@ -134,7 +134,7 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {},
|
|||
return
|
||||
followedDomainFull = followedDomain
|
||||
if port:
|
||||
followedDomainFull = followedDomain+':' + str(port)
|
||||
followedDomainFull = followedDomain + ':' + str(port)
|
||||
followedNickname = getNicknameFromActor(followedActor)
|
||||
if not followedNickname:
|
||||
print('DEBUG: no nickname found within Follow activity object ' +
|
||||
|
@ -168,7 +168,7 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {},
|
|||
else:
|
||||
if debug:
|
||||
print('DEBUG: Unable to create follow - ' +
|
||||
nickname + '@' + acceptedDomain+' -> ' +
|
||||
nickname + '@' + acceptedDomain + ' -> ' +
|
||||
followedNickname + '@' + followedDomain)
|
||||
|
||||
|
||||
|
|
|
@ -198,9 +198,10 @@ def sendAnnounceViaServer(baseDir: str, session,
|
|||
statusNumber, published = getStatusNumber()
|
||||
newAnnounceId = httpPrefix + '://' + fromDomainFull + '/users/' + \
|
||||
fromNickname + '/statuses/' + statusNumber
|
||||
actorStr = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
||||
newAnnounceJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'actor': httpPrefix+'://'+fromDomainFull+'/users/'+fromNickname,
|
||||
'actor': actorStr,
|
||||
'atomUri': newAnnounceId,
|
||||
'cc': [ccUrl],
|
||||
'id': newAnnounceId + '/activity',
|
||||
|
|
2
auth.py
2
auth.py
|
@ -134,7 +134,7 @@ def authorizeBasic(baseDir: str, path: str, authHeader: str,
|
|||
providedPassword = plain.split(':')[1]
|
||||
passfile = open(passwordFile, "r")
|
||||
for line in passfile:
|
||||
if line.startswith(nickname+':'):
|
||||
if line.startswith(nickname + ':'):
|
||||
storedPassword = \
|
||||
line.split(':')[1].replace('\n', '').replace('\r', '')
|
||||
success = _verifyPassword(storedPassword, providedPassword)
|
||||
|
|
|
@ -95,8 +95,8 @@ def sendAvailabilityViaServer(baseDir: str, session,
|
|||
|
||||
newAvailabilityJson = {
|
||||
'type': 'Availability',
|
||||
'actor': httpPrefix+'://'+domainFull+'/users/'+nickname,
|
||||
'object': '"'+status+'"',
|
||||
'actor': httpPrefix + '://' + domainFull + '/users/' + nickname,
|
||||
'object': '"' + status + '"',
|
||||
'to': [toUrl],
|
||||
'cc': [ccUrl]
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ def bookmark(recentPostsCache: {},
|
|||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'Bookmark',
|
||||
'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname,
|
||||
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
||||
'object': objectUrl
|
||||
}
|
||||
if ccList:
|
||||
|
@ -302,10 +302,10 @@ def undoBookmark(recentPostsCache: {},
|
|||
newUndoBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'Undo',
|
||||
'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname,
|
||||
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
||||
'object': {
|
||||
'type': 'Bookmark',
|
||||
'actor': httpPrefix+'://'+fullDomain+'/users/'+nickname,
|
||||
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
||||
'object': objectUrl
|
||||
}
|
||||
}
|
||||
|
|
6
cache.py
6
cache.py
|
@ -20,7 +20,7 @@ def _removePersonFromCache(baseDir: str, personUrl: str,
|
|||
"""Removes an actor from the cache
|
||||
"""
|
||||
cacheFilename = baseDir + '/cache/actors/' + \
|
||||
personUrl.replace('/', '#')+'.json'
|
||||
personUrl.replace('/', '#') + '.json'
|
||||
if os.path.isfile(cacheFilename):
|
||||
try:
|
||||
os.remove(cacheFilename)
|
||||
|
@ -70,7 +70,7 @@ def storePersonInCache(baseDir: str, personUrl: str,
|
|||
return
|
||||
if os.path.isdir(baseDir + '/cache/actors'):
|
||||
cacheFilename = baseDir + '/cache/actors/' + \
|
||||
personUrl.replace('/', '#')+'.json'
|
||||
personUrl.replace('/', '#') + '.json'
|
||||
if not os.path.isfile(cacheFilename):
|
||||
saveJson(personJson, cacheFilename)
|
||||
|
||||
|
@ -84,7 +84,7 @@ def getPersonFromCache(baseDir: str, personUrl: str, personCache: {},
|
|||
if not personCache.get(personUrl):
|
||||
# does the person exist as a cached file?
|
||||
cacheFilename = baseDir + '/cache/actors/' + \
|
||||
personUrl.replace('/', '#')+'.json'
|
||||
personUrl.replace('/', '#') + '.json'
|
||||
actorFilename = getFileCaseInsensitive(cacheFilename)
|
||||
if actorFilename:
|
||||
personJson = loadJson(actorFilename)
|
||||
|
|
|
@ -306,7 +306,7 @@ def _addMusicTag(content: str, tag: str) -> str:
|
|||
musicSites = ('soundcloud.com', 'bandcamp.com')
|
||||
musicSiteFound = False
|
||||
for site in musicSites:
|
||||
if site+'/' in content:
|
||||
if site + '/' in content:
|
||||
musicSiteFound = True
|
||||
break
|
||||
if not musicSiteFound:
|
||||
|
@ -458,7 +458,7 @@ def _addEmoji(baseDir: str, wordStr: str,
|
|||
'type': 'Image',
|
||||
'url': emojiUrl
|
||||
},
|
||||
'name': ':'+emoji+':',
|
||||
'name': ':' + emoji + ':',
|
||||
"updated": fileLastModified(emojiFilename),
|
||||
"id": emojiUrl.replace('.png', ''),
|
||||
'type': 'Emoji'
|
||||
|
@ -820,7 +820,7 @@ def addHtmlTags(baseDir: str, httpPrefix: str,
|
|||
continue
|
||||
elif ':' in wordStr:
|
||||
wordStr2 = wordStr.split(':')[1]
|
||||
# print('TAG: emoji located - '+wordStr)
|
||||
# print('TAG: emoji located - ' + wordStr)
|
||||
if not emojiDict:
|
||||
# emoji.json is generated so that it can be customized and
|
||||
# the changes will be retained even if default_emoji.json
|
||||
|
@ -830,7 +830,7 @@ def addHtmlTags(baseDir: str, httpPrefix: str,
|
|||
baseDir + '/emoji/emoji.json')
|
||||
emojiDict = loadJson(baseDir + '/emoji/emoji.json')
|
||||
|
||||
# print('TAG: looking up emoji for :'+wordStr2+':')
|
||||
# print('TAG: looking up emoji for :' + wordStr2 + ':')
|
||||
_addEmoji(baseDir, ':' + wordStr2 + ':', httpPrefix,
|
||||
originalDomain, replaceEmoji, hashtags,
|
||||
emojiDict)
|
||||
|
|
|
@ -1092,7 +1092,7 @@ if args.message:
|
|||
toDomain = 'public'
|
||||
toPort = port
|
||||
|
||||
# ccUrl=httpPrefix+'://'+domain+'/users/'+nickname+'/followers'
|
||||
# ccUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/followers'
|
||||
ccUrl = None
|
||||
sendMessage = args.message
|
||||
followersOnly = args.followersonly
|
||||
|
|
2
inbox.py
2
inbox.py
|
@ -506,7 +506,7 @@ def _inboxPostRecipientsAdd(baseDir: str, httpPrefix: str, toList: [],
|
|||
if domainMatch in recipient:
|
||||
# get the handle for the local account
|
||||
nickname = recipient.split(domainMatch)[1]
|
||||
handle = nickname+'@'+domain
|
||||
handle = nickname + '@' + domain
|
||||
if os.path.isdir(baseDir + '/accounts/' + handle):
|
||||
recipientsDict[handle] = None
|
||||
else:
|
||||
|
|
|
@ -131,7 +131,7 @@ def setProfileImage(baseDir: str, httpPrefix: str, nickname: str, domain: str,
|
|||
personJson[iconFilenameBase]['mediaType'] = mediaType
|
||||
personJson[iconFilenameBase]['url'] = \
|
||||
httpPrefix + '://' + fullDomain + '/users/' + \
|
||||
nickname + '/'+iconFilename
|
||||
nickname + '/' + iconFilename
|
||||
saveJson(personJson, personFilename)
|
||||
|
||||
cmd = \
|
||||
|
|
12
posts.py
12
posts.py
|
@ -1060,7 +1060,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
|||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
||||
'/statuses/' + statusNumber + '/replies'
|
||||
newPostUrl = \
|
||||
httpPrefix + '://' + domain + '/@' + nickname + '/'+statusNumber
|
||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||
newPostAttributedTo = \
|
||||
httpPrefix + '://' + domain + '/users/' + nickname
|
||||
newPost = {
|
||||
|
@ -1120,7 +1120,7 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
|||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
||||
'/statuses/' + statusNumber + '/replies'
|
||||
newPostUrl = \
|
||||
httpPrefix + '://' + domain + '/@' + nickname+'/' + statusNumber
|
||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||
newPost = {
|
||||
"@context": postContext,
|
||||
'id': newPostId,
|
||||
|
@ -2896,7 +2896,7 @@ def createModeration(baseDir: str, nickname: str, domain: str, port: int,
|
|||
pageNumber = 1
|
||||
|
||||
pageStr = '?page=' + str(pageNumber)
|
||||
boxUrl = httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname
|
||||
boxUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/' + boxname
|
||||
boxHeader = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': boxUrl + '?page=true',
|
||||
|
@ -3849,8 +3849,8 @@ def populateRepliesJson(baseDir: str, nickname: str, domain: str,
|
|||
searchFilename = \
|
||||
baseDir + \
|
||||
'/accounts/' + nickname + '@' + \
|
||||
domain+'/' + \
|
||||
boxname+'/' + \
|
||||
domain + '/' + \
|
||||
boxname + '/' + \
|
||||
messageId2.replace('/', '#') + '.json'
|
||||
if os.path.isfile(searchFilename):
|
||||
if authorized or \
|
||||
|
@ -3877,7 +3877,7 @@ def populateRepliesJson(baseDir: str, nickname: str, domain: str,
|
|||
searchFilename = \
|
||||
baseDir + \
|
||||
'/accounts/inbox@' + \
|
||||
domain+'/inbox/' + \
|
||||
domain + '/inbox/' + \
|
||||
messageId2.replace('/', '#') + '.json'
|
||||
if os.path.isfile(searchFilename):
|
||||
if authorized or \
|
||||
|
|
4
tests.py
4
tests.py
|
@ -2045,7 +2045,7 @@ def _testAddEmoji():
|
|||
tags.append(tag)
|
||||
content = contentModified
|
||||
contentModified = replaceEmojiFromTags(content, tags, 'content')
|
||||
# print('contentModified: '+contentModified)
|
||||
# print('contentModified: ' + contentModified)
|
||||
assert contentModified == '<p>Emoji 🍋 🍓 🍌</p>'
|
||||
|
||||
os.chdir(baseDirOriginal)
|
||||
|
@ -2124,7 +2124,7 @@ def _testRecentPostsCache():
|
|||
htmlStr = '<html></html>'
|
||||
for i in range(5):
|
||||
postJsonObject = {
|
||||
"id": "https://somesite.whatever/users/someuser/statuses/"+str(i)
|
||||
"id": "https://somesite.whatever/users/someuser/statuses/" + str(i)
|
||||
}
|
||||
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
||||
postJsonObject, htmlStr)
|
||||
|
|
6
utils.py
6
utils.py
|
@ -1563,10 +1563,10 @@ def getCachedPostFilename(baseDir: str, nickname: str, domain: str,
|
|||
"""
|
||||
cachedPostDir = getCachedPostDirectory(baseDir, nickname, domain)
|
||||
if not os.path.isdir(cachedPostDir):
|
||||
# print('ERROR: invalid html cache directory '+cachedPostDir)
|
||||
# print('ERROR: invalid html cache directory ' + cachedPostDir)
|
||||
return None
|
||||
if '@' not in cachedPostDir:
|
||||
# print('ERROR: invalid html cache directory '+cachedPostDir)
|
||||
# print('ERROR: invalid html cache directory ' + cachedPostDir)
|
||||
return None
|
||||
cachedPostId = removeIdEnding(postJsonObject['id'])
|
||||
cachedPostFilename = cachedPostDir + '/' + cachedPostId.replace('/', '#')
|
||||
|
@ -1866,7 +1866,7 @@ def undoLikesCollectionEntry(recentPostsCache: {},
|
|||
if not postJsonObject.get('object'):
|
||||
if debug:
|
||||
pprint(postJsonObject)
|
||||
print('DEBUG: post '+objectUrl+' has no object')
|
||||
print('DEBUG: post ' + objectUrl + ' has no object')
|
||||
return
|
||||
if not isinstance(postJsonObject['object'], dict):
|
||||
return
|
||||
|
|
|
@ -116,7 +116,7 @@ def headerButtonsTimeline(defaultTimeline: str,
|
|||
tlStr += \
|
||||
'<a href="' + usersPath + \
|
||||
'/inbox" tabindex="-1"><button class="' + \
|
||||
inboxButton+'"><span>' + translate['Inbox'] + \
|
||||
inboxButton + '"><span>' + translate['Inbox'] + \
|
||||
'</span></button></a>'
|
||||
|
||||
if not featuresHeader:
|
||||
|
|
|
@ -534,7 +534,7 @@ def htmlProfile(rssIconAtTop: bool,
|
|||
if xmppAddress:
|
||||
donateSection += \
|
||||
'<p>' + translate['XMPP'] + ': <a href="xmpp:' + \
|
||||
xmppAddress + '">'+xmppAddress + '</a></p>\n'
|
||||
xmppAddress + '">' + xmppAddress + '</a></p>\n'
|
||||
if matrixAddress:
|
||||
donateSection += \
|
||||
'<p>' + translate['Matrix'] + ': ' + matrixAddress + '</p>\n'
|
||||
|
@ -1675,7 +1675,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
translate['Matrix'] + '</label><br>\n'
|
||||
editProfileForm += \
|
||||
' <input type="text" name="matrixAddress" value="' + \
|
||||
matrixAddress+'">\n'
|
||||
matrixAddress + '">\n'
|
||||
|
||||
editProfileForm += '<label class="labels">SSB</label><br>\n'
|
||||
editProfileForm += \
|
||||
|
|
Loading…
Reference in New Issue