mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
acc780e780
commit
49e7432076
|
@ -25,7 +25,7 @@ from utils import hasObjectStringType
|
|||
|
||||
def _createAcceptReject(base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
toUrl: str, ccUrl: str, httpPrefix: str,
|
||||
toUrl: str, ccUrl: str, http_prefix: str,
|
||||
objectJson: {}, acceptType: str) -> {}:
|
||||
"""Accepts or rejects something (eg. a follow request or offer)
|
||||
Typically toUrl will be https://www.w3.org/ns/activitystreams#Public
|
||||
|
@ -44,7 +44,7 @@ def _createAcceptReject(base_dir: str, federationList: [],
|
|||
newAccept = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': acceptType,
|
||||
'actor': localActorUrl(httpPrefix, nickname, domain),
|
||||
'actor': localActorUrl(http_prefix, nickname, domain),
|
||||
'to': [toUrl],
|
||||
'cc': [],
|
||||
'object': objectJson
|
||||
|
@ -57,22 +57,22 @@ def _createAcceptReject(base_dir: str, federationList: [],
|
|||
|
||||
def createAccept(base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
toUrl: str, ccUrl: str, httpPrefix: str,
|
||||
toUrl: str, ccUrl: str, http_prefix: str,
|
||||
objectJson: {}) -> {}:
|
||||
return _createAcceptReject(base_dir, federationList,
|
||||
nickname, domain, port,
|
||||
toUrl, ccUrl, httpPrefix,
|
||||
toUrl, ccUrl, http_prefix,
|
||||
objectJson, 'Accept')
|
||||
|
||||
|
||||
def createReject(base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
toUrl: str, ccUrl: str, httpPrefix: str,
|
||||
toUrl: str, ccUrl: str, http_prefix: str,
|
||||
objectJson: {}) -> {}:
|
||||
return _createAcceptReject(base_dir, federationList,
|
||||
nickname, domain, port,
|
||||
toUrl, ccUrl,
|
||||
httpPrefix, objectJson, 'Reject')
|
||||
http_prefix, objectJson, 'Reject')
|
||||
|
||||
|
||||
def _acceptFollow(base_dir: str, domain: str, messageJson: {},
|
||||
|
@ -182,7 +182,7 @@ def _acceptFollow(base_dir: str, domain: str, messageJson: {},
|
|||
|
||||
|
||||
def receiveAcceptReject(session, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool) -> bool:
|
||||
|
|
40
announce.py
40
announce.py
|
@ -117,7 +117,7 @@ def announcedByPerson(isAnnounced: bool, postActor: str,
|
|||
|
||||
def createAnnounce(session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
toUrl: str, ccUrl: str, httpPrefix: str,
|
||||
toUrl: str, ccUrl: str, http_prefix: str,
|
||||
objectUrl: str, saveToFile: bool,
|
||||
clientToServer: bool,
|
||||
sendThreads: [], postLog: [],
|
||||
|
@ -137,13 +137,13 @@ def createAnnounce(session, base_dir: str, federationList: [],
|
|||
fullDomain = getFullDomain(domain, port)
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
newAnnounceId = httpPrefix + '://' + fullDomain + \
|
||||
newAnnounceId = http_prefix + '://' + fullDomain + \
|
||||
'/users/' + nickname + '/statuses/' + statusNumber
|
||||
atomUriStr = localActorUrl(httpPrefix, nickname, fullDomain) + \
|
||||
atomUriStr = localActorUrl(http_prefix, nickname, fullDomain) + \
|
||||
'/statuses/' + statusNumber
|
||||
newAnnounce = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'atomUri': atomUriStr,
|
||||
'cc': [],
|
||||
'id': newAnnounceId + '/activity',
|
||||
|
@ -178,7 +178,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
|
|||
sendSignedJson(newAnnounce, session, base_dir,
|
||||
nickname, domain, port,
|
||||
announceNickname, announceDomain, announcePort, None,
|
||||
httpPrefix, True, clientToServer, federationList,
|
||||
http_prefix, True, clientToServer, federationList,
|
||||
sendThreads, postLog, cachedWebfingers, personCache,
|
||||
debug, projectVersion, None, groupAccount,
|
||||
signingPrivateKeyPem, 639633)
|
||||
|
@ -187,7 +187,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
|
|||
|
||||
|
||||
def announcePublic(session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
objectUrl: str, clientToServer: bool,
|
||||
sendThreads: [], postLog: [],
|
||||
personCache: {}, cachedWebfingers: {},
|
||||
|
@ -198,10 +198,10 @@ def announcePublic(session, base_dir: str, federationList: [],
|
|||
fromDomain = getFullDomain(domain, port)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = localActorUrl(httpPrefix, nickname, fromDomain) + '/followers'
|
||||
ccUrl = localActorUrl(http_prefix, nickname, fromDomain) + '/followers'
|
||||
return createAnnounce(session, base_dir, federationList,
|
||||
nickname, domain, port,
|
||||
toUrl, ccUrl, httpPrefix,
|
||||
toUrl, ccUrl, http_prefix,
|
||||
objectUrl, True, clientToServer,
|
||||
sendThreads, postLog,
|
||||
personCache, cachedWebfingers,
|
||||
|
@ -212,7 +212,7 @@ def announcePublic(session, base_dir: str, federationList: [],
|
|||
def sendAnnounceViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, repeatObjectUrl: str,
|
||||
http_prefix: str, repeatObjectUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -225,7 +225,7 @@ def sendAnnounceViaServer(base_dir: str, session,
|
|||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
actorStr = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actorStr = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
ccUrl = actorStr + '/followers'
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
@ -242,10 +242,10 @@ def sendAnnounceViaServer(base_dir: str, session,
|
|||
'type': 'Announce'
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -268,7 +268,7 @@ def sendAnnounceViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
fromNickname, fromDomain,
|
||||
postToBox, 73528)
|
||||
|
||||
|
@ -289,7 +289,7 @@ def sendAnnounceViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, fromDomainFull,
|
||||
postResult = postJson(http_prefix, fromDomainFull,
|
||||
session, newAnnounceJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -305,7 +305,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
undoPostJsonObject: {},
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, repeatObjectUrl: str,
|
||||
http_prefix: str, repeatObjectUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -317,7 +317,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
handle = replaceUsersWithAt(actor)
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
@ -330,7 +330,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
}
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -353,7 +353,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
nickname, domain,
|
||||
postToBox, 73528)
|
||||
|
||||
|
@ -374,7 +374,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, domainFull,
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
session, unAnnounceJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -387,7 +387,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
|
||||
|
||||
def outboxUndoAnnounce(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When an undo announce is received by the outbox from c2s
|
||||
|
|
|
@ -79,7 +79,7 @@ def outboxAvailability(base_dir: str, nickname: str, messageJson: {},
|
|||
def sendAvailabilityViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
status: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
|
@ -92,7 +92,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
||||
toUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
toUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
ccUrl = toUrl + '/followers'
|
||||
|
||||
newAvailabilityJson = {
|
||||
|
@ -103,10 +103,10 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -128,7 +128,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, nickname,
|
||||
http_prefix, nickname,
|
||||
domain, postToBox, 57262)
|
||||
|
||||
if not inboxUrl:
|
||||
|
@ -148,7 +148,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, domainFull,
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
session, newAvailabilityJson, [],
|
||||
inboxUrl, headers, 30, True)
|
||||
if not postResult:
|
||||
|
|
20
blocking.py
20
blocking.py
|
@ -414,7 +414,7 @@ def isBlocked(base_dir: str, nickname: str, domain: str,
|
|||
return False
|
||||
|
||||
|
||||
def outboxBlock(base_dir: str, httpPrefix: str,
|
||||
def outboxBlock(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> bool:
|
||||
""" When a block request is received by the outbox from c2s
|
||||
|
@ -463,7 +463,7 @@ def outboxBlock(base_dir: str, httpPrefix: str,
|
|||
return True
|
||||
|
||||
|
||||
def outboxUndoBlock(base_dir: str, httpPrefix: str,
|
||||
def outboxUndoBlock(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When an undo block request is received by the outbox from c2s
|
||||
|
@ -520,7 +520,7 @@ def outboxUndoBlock(base_dir: str, httpPrefix: str,
|
|||
|
||||
|
||||
def mutePost(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, postId: str, recentPostsCache: {},
|
||||
http_prefix: str, postId: str, recentPostsCache: {},
|
||||
debug: bool) -> None:
|
||||
""" Mutes the given post
|
||||
"""
|
||||
|
@ -544,7 +544,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
alsoUpdatePostId = removeIdEnding(postJsonObject['object'])
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
if postJsonObj.get('conversation'):
|
||||
muteConversation(base_dir, nickname, domain,
|
||||
|
@ -653,7 +653,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
|
||||
|
||||
def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, postId: str, recentPostsCache: {},
|
||||
http_prefix: str, postId: str, recentPostsCache: {},
|
||||
debug: bool) -> None:
|
||||
""" Unmutes the given post
|
||||
"""
|
||||
|
@ -688,7 +688,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
|
||||
if postJsonObj.get('ignores'):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
totalItems = 0
|
||||
if postJsonObj['ignores'].get('totalItems'):
|
||||
totalItems = postJsonObj['ignores']['totalItems']
|
||||
|
@ -768,7 +768,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
alsoUpdatePostId + ' removed referenced html')
|
||||
|
||||
|
||||
def outboxMute(base_dir: str, httpPrefix: str,
|
||||
def outboxMute(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool,
|
||||
recentPostsCache: {}) -> None:
|
||||
|
@ -810,14 +810,14 @@ def outboxMute(base_dir: str, httpPrefix: str,
|
|||
return
|
||||
|
||||
mutePost(base_dir, nickname, domain, port,
|
||||
httpPrefix, messageJson['object'], recentPostsCache,
|
||||
http_prefix, messageJson['object'], recentPostsCache,
|
||||
debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: post muted via c2s - ' + postFilename)
|
||||
|
||||
|
||||
def outboxUndoMute(base_dir: str, httpPrefix: str,
|
||||
def outboxUndoMute(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool,
|
||||
recentPostsCache: {}) -> None:
|
||||
|
@ -866,7 +866,7 @@ def outboxUndoMute(base_dir: str, httpPrefix: str,
|
|||
return
|
||||
|
||||
unmutePost(base_dir, nickname, domain, port,
|
||||
httpPrefix, messageJson['object']['object'],
|
||||
http_prefix, messageJson['object']['object'],
|
||||
recentPostsCache, debug)
|
||||
|
||||
if debug:
|
||||
|
|
76
blog.py
76
blog.py
|
@ -39,7 +39,7 @@ from newswire import rss2Footer
|
|||
from cache import getPersonFromCache
|
||||
|
||||
|
||||
def _noOfBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
||||
def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postId: str, depth=0) -> int:
|
||||
"""Returns the number of replies on the post
|
||||
|
@ -84,7 +84,7 @@ def _noOfBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
|||
if locatePost(base_dir, nickname, domain, replyPostId):
|
||||
replyPostId = replyPostId.replace('.replies', '')
|
||||
replies += \
|
||||
1 + _noOfBlogReplies(base_dir, httpPrefix, translate,
|
||||
1 + _noOfBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
replyPostId, depth+1)
|
||||
else:
|
||||
|
@ -109,7 +109,7 @@ def _noOfBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
|||
return replies
|
||||
|
||||
|
||||
def _getBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
||||
def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postId: str, depth=0) -> str:
|
||||
"""Returns a string containing html blog posts
|
||||
|
@ -169,7 +169,7 @@ def _getBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
|||
repliesStr += postFile.read() + '\n'
|
||||
except OSError:
|
||||
print('EX: unable to read blog replies ' + postFilename)
|
||||
rply = _getBlogReplies(base_dir, httpPrefix, translate,
|
||||
rply = _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
replyPostId, depth+1)
|
||||
if rply not in repliesStr:
|
||||
|
@ -186,7 +186,7 @@ def _getBlogReplies(base_dir: str, httpPrefix: str, translate: {},
|
|||
|
||||
|
||||
def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
|
@ -234,7 +234,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
postJsonObject['object']['published'].split('T')[0]
|
||||
if handle:
|
||||
if handle.startswith(nickname + '@' + domain):
|
||||
blogStr += ' <a href="' + httpPrefix + '://' + \
|
||||
blogStr += ' <a href="' + http_prefix + '://' + \
|
||||
domainFull + \
|
||||
'/users/' + nickname + '">' + handle + '</a>'
|
||||
linkedAuthor = True
|
||||
|
@ -264,7 +264,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
if attachmentStr:
|
||||
blogStr += '<br><center>' + attachmentStr + '</center>'
|
||||
|
||||
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actorJson = \
|
||||
getPersonFromCache(base_dir, personUrl, personCache, False)
|
||||
languagesUnderstood = []
|
||||
|
@ -309,11 +309,11 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
|
||||
if not linkedAuthor:
|
||||
blogStr += '<p class="about"><a class="about" href="' + \
|
||||
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
'">' + translate['About the author'] + \
|
||||
'</a></p>\n'
|
||||
|
||||
replies = _noOfBlogReplies(base_dir, httpPrefix, translate,
|
||||
replies = _noOfBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject['object']['id'])
|
||||
|
||||
|
@ -332,11 +332,11 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
else:
|
||||
blogStr += blogSeparator + '<h1>' + translate['Replies'] + '</h1>\n'
|
||||
if not titleStr:
|
||||
blogStr += _getBlogReplies(base_dir, httpPrefix, translate,
|
||||
blogStr += _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject['object']['id'])
|
||||
else:
|
||||
blogRepliesStr = _getBlogReplies(base_dir, httpPrefix, translate,
|
||||
blogRepliesStr = _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject['object']['id'])
|
||||
blogStr += blogRepliesStr.replace('>' + titleStr + '<', '')
|
||||
|
@ -345,7 +345,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
|
||||
|
||||
def _htmlBlogPostRSS2(authorized: bool,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
|
@ -378,7 +378,7 @@ def _htmlBlogPostRSS2(authorized: bool,
|
|||
|
||||
|
||||
def _htmlBlogPostRSS3(authorized: bool,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
|
@ -436,7 +436,7 @@ def _getSnippetFromBlogContent(postJsonObject: {}, systemLanguage: str) -> str:
|
|||
|
||||
|
||||
def htmlBlogPost(session, authorized: bool,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {},
|
||||
peertubeInstances: [],
|
||||
|
@ -461,14 +461,14 @@ def htmlBlogPost(session, authorized: bool,
|
|||
url = postJsonObject['object']['url']
|
||||
snippet = _getSnippetFromBlogContent(postJsonObject, systemLanguage)
|
||||
blogStr = htmlHeaderWithBlogMarkup(cssFilename, instanceTitle,
|
||||
httpPrefix, domainFull, nickname,
|
||||
http_prefix, domainFull, nickname,
|
||||
systemLanguage, published, modified,
|
||||
title, snippet, translate, url,
|
||||
contentLicenseUrl)
|
||||
_htmlBlogRemoveCwButton(blogStr, translate)
|
||||
|
||||
blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, postJsonObject,
|
||||
None, False,
|
||||
|
@ -478,14 +478,14 @@ def htmlBlogPost(session, authorized: bool,
|
|||
# show rss links
|
||||
blogStr += '<p class="rssfeed">'
|
||||
|
||||
blogStr += '<a href="' + httpPrefix + '://' + \
|
||||
blogStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + '/rss.xml">'
|
||||
blogStr += '<img style="width:3%;min-width:50px" ' + \
|
||||
'loading="lazy" alt="RSS 2.0" ' + \
|
||||
'title="RSS 2.0" src="/' + \
|
||||
'icons/logorss.png" /></a>'
|
||||
|
||||
# blogStr += '<a href="' + httpPrefix + '://' + \
|
||||
# blogStr += '<a href="' + http_prefix + '://' + \
|
||||
# domainFull + '/blog/' + nickname + '/rss.txt">'
|
||||
# blogStr += '<img style="width:3%;min-width:50px" ' + \
|
||||
# 'loading="lazy" alt="RSS 3.0" ' + \
|
||||
|
@ -498,7 +498,7 @@ def htmlBlogPost(session, authorized: bool,
|
|||
|
||||
|
||||
def htmlBlogPage(authorized: bool, session,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
noOfItems: int, pageNumber: int,
|
||||
peertubeInstances: [], systemLanguage: str,
|
||||
|
@ -524,7 +524,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
|
||||
timelineJson = createBlogsTimeline(session, base_dir,
|
||||
nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, False,
|
||||
pageNumber)
|
||||
|
||||
|
@ -538,7 +538,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
navigateStr = '<p>'
|
||||
if pageNumber > 1:
|
||||
# show previous button
|
||||
navigateStr += '<a href="' + httpPrefix + '://' + \
|
||||
navigateStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + \
|
||||
nickname + '?page=' + str(pageNumber-1) + '">' + \
|
||||
'<img loading="lazy" alt="<" title="<" ' + \
|
||||
|
@ -546,7 +546,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
'/prev.png" class="buttonprev"/></a>\n'
|
||||
if len(timelineJson['orderedItems']) >= noOfItems:
|
||||
# show next button
|
||||
navigateStr += '<a href="' + httpPrefix + '://' + \
|
||||
navigateStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + \
|
||||
'?page=' + str(pageNumber + 1) + '">' + \
|
||||
'<img loading="lazy" alt=">" title=">" ' + \
|
||||
|
@ -560,7 +560,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
continue
|
||||
|
||||
blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
None, True,
|
||||
|
@ -574,13 +574,13 @@ def htmlBlogPage(authorized: bool, session,
|
|||
# show rss link
|
||||
blogStr += '<p class="rssfeed">'
|
||||
|
||||
blogStr += '<a href="' + httpPrefix + '://' + \
|
||||
blogStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + '/rss.xml">'
|
||||
blogStr += '<img loading="lazy" alt="RSS 2.0" ' + \
|
||||
'title="RSS 2.0" src="/' + \
|
||||
'icons/logorss.png" /></a>'
|
||||
|
||||
# blogStr += '<a href="' + httpPrefix + '://' + \
|
||||
# blogStr += '<a href="' + http_prefix + '://' + \
|
||||
# domainFull + '/blog/' + nickname + '/rss.txt">'
|
||||
# blogStr += '<img loading="lazy" alt="RSS 3.0" ' + \
|
||||
# 'title="RSS 3.0" src="/' + \
|
||||
|
@ -591,7 +591,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
|
||||
|
||||
def htmlBlogPageRSS2(authorized: bool, session,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
noOfItems: int, pageNumber: int,
|
||||
includeHeader: bool, systemLanguage: str) -> str:
|
||||
|
@ -605,7 +605,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
|
||||
blogRSS2 = ''
|
||||
if includeHeader:
|
||||
blogRSS2 = rss2Header(httpPrefix, nickname, domainFull,
|
||||
blogRSS2 = rss2Header(http_prefix, nickname, domainFull,
|
||||
'Blog', translate)
|
||||
|
||||
blogsIndex = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||
|
@ -617,7 +617,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
|
||||
timelineJson = createBlogsTimeline(session, base_dir,
|
||||
nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, False,
|
||||
pageNumber)
|
||||
|
||||
|
@ -634,7 +634,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
|
||||
blogRSS2 += \
|
||||
_htmlBlogPostRSS2(authorized, base_dir,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
None, True, systemLanguage)
|
||||
|
@ -646,7 +646,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
|
||||
|
||||
def htmlBlogPageRSS3(authorized: bool, session,
|
||||
base_dir: str, httpPrefix: str, translate: {},
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
noOfItems: int, pageNumber: int,
|
||||
systemLanguage: str) -> str:
|
||||
|
@ -666,7 +666,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
|
|||
|
||||
timelineJson = createBlogsTimeline(session, base_dir,
|
||||
nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, False,
|
||||
pageNumber)
|
||||
|
||||
|
@ -680,7 +680,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
|
|||
|
||||
blogRSS3 += \
|
||||
_htmlBlogPostRSS3(authorized, base_dir,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
None, True,
|
||||
|
@ -721,7 +721,7 @@ def _singleBlogAccountNickname(base_dir: str) -> str:
|
|||
|
||||
|
||||
def htmlBlogView(authorized: bool,
|
||||
session, base_dir: str, httpPrefix: str,
|
||||
session, base_dir: str, http_prefix: str,
|
||||
translate: {}, domain: str, port: int,
|
||||
noOfItems: int,
|
||||
peertubeInstances: [], systemLanguage: str,
|
||||
|
@ -741,7 +741,7 @@ def htmlBlogView(authorized: bool,
|
|||
nickname = _singleBlogAccountNickname(base_dir)
|
||||
if nickname:
|
||||
return htmlBlogPage(authorized, session,
|
||||
base_dir, httpPrefix, translate,
|
||||
base_dir, http_prefix, translate,
|
||||
nickname, domain, port,
|
||||
noOfItems, 1, peertubeInstances,
|
||||
systemLanguage, personCache, debug)
|
||||
|
@ -757,7 +757,7 @@ def htmlBlogView(authorized: bool,
|
|||
if os.path.isfile(blogsIndex):
|
||||
blogStr += '<p class="blogaccount">'
|
||||
blogStr += '<a href="' + \
|
||||
httpPrefix + '://' + domainFull + '/blog/' + \
|
||||
http_prefix + '://' + domainFull + '/blog/' + \
|
||||
acct.split('@')[0] + '">' + acct + '</a>'
|
||||
blogStr += '</p>'
|
||||
break
|
||||
|
@ -766,7 +766,7 @@ def htmlBlogView(authorized: bool,
|
|||
|
||||
|
||||
def htmlEditBlog(mediaInstance: bool, translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
path: str,
|
||||
pageNumber: int,
|
||||
nickname: str, domain: str,
|
||||
|
@ -911,7 +911,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
|
|||
|
||||
|
||||
def pathContainsBlogLink(base_dir: str,
|
||||
httpPrefix: str, domain: str,
|
||||
http_prefix: str, domain: str,
|
||||
domainFull: str, path: str) -> (str, str):
|
||||
"""If the path contains a blog entry then return its filename
|
||||
"""
|
||||
|
@ -935,7 +935,7 @@ def pathContainsBlogLink(base_dir: str,
|
|||
return None, None
|
||||
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
||||
return None, None
|
||||
messageId = localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||
messageId = localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
'/statuses/' + userEnding2[1]
|
||||
return locatePost(base_dir, nickname, domain, messageId), nickname
|
||||
|
||||
|
|
38
bookmarks.py
38
bookmarks.py
|
@ -249,7 +249,7 @@ def updateBookmarksCollection(recentPostsCache: {},
|
|||
def bookmark(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
ccList: [], httpPrefix: str,
|
||||
ccList: [], http_prefix: str,
|
||||
objectUrl: str, actorBookmarked: str,
|
||||
clientToServer: bool,
|
||||
sendThreads: [], postLog: [],
|
||||
|
@ -268,7 +268,7 @@ def bookmark(recentPostsCache: {},
|
|||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'Bookmark',
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'object': objectUrl
|
||||
}
|
||||
if ccList:
|
||||
|
@ -308,7 +308,7 @@ def bookmark(recentPostsCache: {},
|
|||
def undoBookmark(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
ccList: [], httpPrefix: str,
|
||||
ccList: [], http_prefix: str,
|
||||
objectUrl: str, actorBookmarked: str,
|
||||
clientToServer: bool,
|
||||
sendThreads: [], postLog: [],
|
||||
|
@ -327,10 +327,10 @@ def undoBookmark(recentPostsCache: {},
|
|||
newUndoBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'Undo',
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'object': {
|
||||
'type': 'Bookmark',
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'object': objectUrl
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ def undoBookmark(recentPostsCache: {},
|
|||
def sendBookmarkViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, fromPort: int,
|
||||
httpPrefix: str, bookmarkUrl: str,
|
||||
http_prefix: str, bookmarkUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -383,7 +383,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
|
||||
domainFull = getFullDomain(domain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -398,10 +398,10 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
"target": actor + "/tlbookmarks"
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -423,7 +423,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
nickname, domain,
|
||||
postToBox, 58391)
|
||||
|
||||
|
@ -444,7 +444,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, domainFull,
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
session, newBookmarkJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -461,7 +461,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
def sendUndoBookmarkViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, fromPort: int,
|
||||
httpPrefix: str, bookmarkUrl: str,
|
||||
http_prefix: str, bookmarkUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -473,7 +473,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
|
||||
domainFull = getFullDomain(domain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -488,10 +488,10 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
"target": actor + "/tlbookmarks"
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -513,7 +513,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
nickname, domain,
|
||||
postToBox, 52594)
|
||||
|
||||
|
@ -534,7 +534,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, domainFull,
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
session, newBookmarkJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -549,7 +549,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
|
||||
|
||||
def outboxBookmark(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When a bookmark request is received by the outbox from c2s
|
||||
|
@ -605,7 +605,7 @@ def outboxBookmark(recentPostsCache: {},
|
|||
|
||||
|
||||
def outboxUndoBookmark(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When an undo bookmark request is received by the outbox from c2s
|
||||
|
|
8
cache.py
8
cache.py
|
@ -33,7 +33,7 @@ def _removePersonFromCache(base_dir: str, personUrl: str,
|
|||
|
||||
|
||||
def checkForChangedActor(session, base_dir: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
personUrl: str, avatarUrl: str, personCache: {},
|
||||
timeoutSec: int):
|
||||
"""Checks if the avatar url exists and if not then
|
||||
|
@ -45,7 +45,7 @@ def checkForChangedActor(session, base_dir: str,
|
|||
return
|
||||
if domainFull in avatarUrl:
|
||||
return
|
||||
if urlExists(session, avatarUrl, timeoutSec, httpPrefix, domainFull):
|
||||
if urlExists(session, avatarUrl, timeoutSec, http_prefix, domainFull):
|
||||
return
|
||||
_removePersonFromCache(base_dir, personUrl, personCache)
|
||||
|
||||
|
@ -138,7 +138,7 @@ def getWebfingerFromCache(handle: str, cachedWebfingers: {}) -> {}:
|
|||
|
||||
def getPersonPubKey(base_dir: str, session, personUrl: str,
|
||||
personCache: {}, debug: bool,
|
||||
projectVersion: str, httpPrefix: str,
|
||||
projectVersion: str, http_prefix: str,
|
||||
domain: str, onionDomain: str,
|
||||
signingPrivateKeyPem: str) -> str:
|
||||
if not personUrl:
|
||||
|
@ -168,7 +168,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str,
|
|||
personJson = \
|
||||
getJson(signingPrivateKeyPem,
|
||||
session, personUrl, asHeader, None, debug,
|
||||
projectVersion, httpPrefix, personDomain)
|
||||
projectVersion, http_prefix, personDomain)
|
||||
if not personJson:
|
||||
return None
|
||||
pubKey = None
|
||||
|
|
36
content.py
36
content.py
|
@ -483,7 +483,7 @@ def validHashTag(hashtag: str) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def _addHashTags(wordStr: str, httpPrefix: str, domain: str,
|
||||
def _addHashTags(wordStr: str, http_prefix: str, domain: str,
|
||||
replaceHashTags: {}, postHashtags: {}) -> bool:
|
||||
"""Detects hashtags and adds them to the replacements dict
|
||||
Also updates the hashtags list to be added to the post
|
||||
|
@ -493,7 +493,7 @@ def _addHashTags(wordStr: str, httpPrefix: str, domain: str,
|
|||
hashtag = wordStr[1:]
|
||||
if not validHashTag(hashtag):
|
||||
return False
|
||||
hashtagUrl = httpPrefix + "://" + domain + "/tags/" + hashtag
|
||||
hashtagUrl = http_prefix + "://" + domain + "/tags/" + hashtag
|
||||
postHashtags[hashtag] = {
|
||||
'href': hashtagUrl,
|
||||
'name': '#' + hashtag,
|
||||
|
@ -506,7 +506,7 @@ def _addHashTags(wordStr: str, httpPrefix: str, domain: str,
|
|||
|
||||
|
||||
def _addEmoji(base_dir: str, wordStr: str,
|
||||
httpPrefix: str, domain: str,
|
||||
http_prefix: str, domain: str,
|
||||
replaceEmoji: {}, postTags: {},
|
||||
emojiDict: {}) -> bool:
|
||||
"""Detects Emoji and adds them to the replacements dict
|
||||
|
@ -531,7 +531,7 @@ def _addEmoji(base_dir: str, wordStr: str,
|
|||
emojiFilename = base_dir + '/emoji/' + emojiDict[emoji] + '.png'
|
||||
if not os.path.isfile(emojiFilename):
|
||||
return False
|
||||
emojiUrl = httpPrefix + "://" + domain + \
|
||||
emojiUrl = http_prefix + "://" + domain + \
|
||||
"/emoji/" + emojiDict[emoji] + '.png'
|
||||
postTags[emoji] = {
|
||||
'icon': {
|
||||
|
@ -556,7 +556,7 @@ def tagExists(tagType: str, tagName: str, tags: {}) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
||||
def _addMention(wordStr: str, http_prefix: str, following: str, petnames: str,
|
||||
replaceMentions: {}, recipients: [], tags: {}) -> bool:
|
||||
"""Detects mentions and adds them to the replacements dict and
|
||||
recipients list
|
||||
|
@ -574,7 +574,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
if possibleNickname == followNick:
|
||||
followStr = follow.replace('\n', '').replace('\r', '')
|
||||
replaceDomain = followStr.split('@')[1]
|
||||
recipientActor = httpPrefix + "://" + \
|
||||
recipientActor = http_prefix + "://" + \
|
||||
replaceDomain + "/@" + possibleNickname
|
||||
if recipientActor not in recipients:
|
||||
recipients.append(recipientActor)
|
||||
|
@ -584,7 +584,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
'type': 'Mention'
|
||||
}
|
||||
replaceMentions[wordStr] = \
|
||||
"<span class=\"h-card\"><a href=\"" + httpPrefix + \
|
||||
"<span class=\"h-card\"><a href=\"" + http_prefix + \
|
||||
"://" + replaceDomain + "/@" + possibleNickname + \
|
||||
"\" class=\"u-url mention\">@<span>" + possibleNickname + \
|
||||
"</span></a></span>"
|
||||
|
@ -601,7 +601,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
followStr = follow.replace('\n', '').replace('\r', '')
|
||||
replaceNickname = followStr.split('@')[0]
|
||||
replaceDomain = followStr.split('@')[1]
|
||||
recipientActor = httpPrefix + "://" + \
|
||||
recipientActor = http_prefix + "://" + \
|
||||
replaceDomain + "/@" + replaceNickname
|
||||
if recipientActor not in recipients:
|
||||
recipients.append(recipientActor)
|
||||
|
@ -611,7 +611,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
'type': 'Mention'
|
||||
}
|
||||
replaceMentions[wordStr] = \
|
||||
"<span class=\"h-card\"><a href=\"" + httpPrefix + \
|
||||
"<span class=\"h-card\"><a href=\"" + http_prefix + \
|
||||
"://" + replaceDomain + "/@" + replaceNickname + \
|
||||
"\" class=\"u-url mention\">@<span>" + \
|
||||
replaceNickname + "</span></a></span>"
|
||||
|
@ -633,7 +633,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
for follow in following:
|
||||
if follow.replace('\n', '').replace('\r', '') != possibleHandle:
|
||||
continue
|
||||
recipientActor = httpPrefix + "://" + \
|
||||
recipientActor = http_prefix + "://" + \
|
||||
possibleDomain + "/@" + possibleNickname
|
||||
if recipientActor not in recipients:
|
||||
recipients.append(recipientActor)
|
||||
|
@ -643,7 +643,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
'type': 'Mention'
|
||||
}
|
||||
replaceMentions[wordStr] = \
|
||||
"<span class=\"h-card\"><a href=\"" + httpPrefix + \
|
||||
"<span class=\"h-card\"><a href=\"" + http_prefix + \
|
||||
"://" + possibleDomain + "/@" + possibleNickname + \
|
||||
"\" class=\"u-url mention\">@<span>" + possibleNickname + \
|
||||
"</span></a></span>"
|
||||
|
@ -651,7 +651,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
# @nick@domain
|
||||
if not (possibleDomain == 'localhost' or '.' in possibleDomain):
|
||||
return False
|
||||
recipientActor = httpPrefix + "://" + \
|
||||
recipientActor = http_prefix + "://" + \
|
||||
possibleDomain + "/@" + possibleNickname
|
||||
if recipientActor not in recipients:
|
||||
recipients.append(recipientActor)
|
||||
|
@ -661,7 +661,7 @@ def _addMention(wordStr: str, httpPrefix: str, following: str, petnames: str,
|
|||
'type': 'Mention'
|
||||
}
|
||||
replaceMentions[wordStr] = \
|
||||
"<span class=\"h-card\"><a href=\"" + httpPrefix + \
|
||||
"<span class=\"h-card\"><a href=\"" + http_prefix + \
|
||||
"://" + possibleDomain + "/@" + possibleNickname + \
|
||||
"\" class=\"u-url mention\">@<span>" + possibleNickname + \
|
||||
"</span></a></span>"
|
||||
|
@ -817,7 +817,7 @@ def _autoTag(base_dir: str, nickname: str, domain: str,
|
|||
appendTags.append('#' + tagName)
|
||||
|
||||
|
||||
def addHtmlTags(base_dir: str, httpPrefix: str,
|
||||
def addHtmlTags(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, content: str,
|
||||
recipients: [], hashtags: {},
|
||||
isJsonContent: bool = False) -> str:
|
||||
|
@ -887,7 +887,7 @@ def addHtmlTags(base_dir: str, httpPrefix: str,
|
|||
longWordsList.append(wordStr)
|
||||
firstChar = wordStr[0]
|
||||
if firstChar == '@':
|
||||
if _addMention(wordStr, httpPrefix, following, petnames,
|
||||
if _addMention(wordStr, http_prefix, following, petnames,
|
||||
replaceMentions, recipients, hashtags):
|
||||
prevWordStr = ''
|
||||
continue
|
||||
|
@ -899,7 +899,7 @@ def addHtmlTags(base_dir: str, httpPrefix: str,
|
|||
wordStr = wordStr[:len(wordStr) - 1]
|
||||
break
|
||||
|
||||
if _addHashTags(wordStr, httpPrefix, originalDomain,
|
||||
if _addHashTags(wordStr, http_prefix, originalDomain,
|
||||
replaceHashTags, hashtags):
|
||||
prevWordStr = ''
|
||||
continue
|
||||
|
@ -923,7 +923,7 @@ def addHtmlTags(base_dir: str, httpPrefix: str,
|
|||
emojiDict = dict(emojiDict, **customEmojiDict)
|
||||
|
||||
# print('TAG: looking up emoji for :' + wordStr2 + ':')
|
||||
_addEmoji(base_dir, ':' + wordStr2 + ':', httpPrefix,
|
||||
_addEmoji(base_dir, ':' + wordStr2 + ':', http_prefix,
|
||||
originalDomain, replaceEmoji, hashtags,
|
||||
emojiDict)
|
||||
else:
|
||||
|
@ -942,7 +942,7 @@ def addHtmlTags(base_dir: str, httpPrefix: str,
|
|||
# add any auto generated tags
|
||||
for appended in appendTags:
|
||||
content = content + ' ' + appended
|
||||
_addHashTags(appended, httpPrefix, originalDomain,
|
||||
_addHashTags(appended, http_prefix, originalDomain,
|
||||
replaceHashTags, hashtags)
|
||||
|
||||
# replace words with their html versions
|
||||
|
|
18
delete.py
18
delete.py
|
@ -29,7 +29,7 @@ from posts import getPersonBox
|
|||
def sendDeleteViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, deleteObjectUrl: str,
|
||||
http_prefix: str, deleteObjectUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -41,7 +41,7 @@ def sendDeleteViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -54,11 +54,11 @@ def sendDeleteViaServer(base_dir: str, session,
|
|||
'type': 'Delete'
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -78,7 +78,7 @@ def sendDeleteViaServer(base_dir: str, session,
|
|||
fromPersonId, sharedInbox, avatarUrl,
|
||||
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
|
||||
base_dir, session, wfRequest, personCache,
|
||||
projectVersion, httpPrefix, fromNickname,
|
||||
projectVersion, http_prefix, fromNickname,
|
||||
fromDomain, postToBox, 53036)
|
||||
|
||||
if not inboxUrl:
|
||||
|
@ -99,7 +99,7 @@ def sendDeleteViaServer(base_dir: str, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, newDeleteJson, [], inboxUrl, headers, 3, True)
|
||||
if not postResult:
|
||||
if debug:
|
||||
|
@ -112,7 +112,7 @@ def sendDeleteViaServer(base_dir: str, session,
|
|||
return newDeleteJson
|
||||
|
||||
|
||||
def outboxDelete(base_dir: str, httpPrefix: str,
|
||||
def outboxDelete(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
messageJson: {}, debug: bool,
|
||||
allowDeletion: bool,
|
||||
|
@ -131,7 +131,7 @@ def outboxDelete(base_dir: str, httpPrefix: str,
|
|||
return
|
||||
if debug:
|
||||
print('DEBUG: c2s delete request arrived in outbox')
|
||||
deletePrefix = httpPrefix + '://' + domain
|
||||
deletePrefix = http_prefix + '://' + domain
|
||||
if (not allowDeletion and
|
||||
(not messageJson['object'].startswith(deletePrefix) or
|
||||
not messageJson['actor'].startswith(deletePrefix))):
|
||||
|
@ -168,7 +168,7 @@ def outboxDelete(base_dir: str, httpPrefix: str,
|
|||
print('DEBUG: c2s delete post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return True
|
||||
deletePost(base_dir, httpPrefix, deleteNickname, deleteDomain,
|
||||
deletePost(base_dir, http_prefix, deleteNickname, deleteDomain,
|
||||
postFilename, debug, recentPostsCache)
|
||||
if debug:
|
||||
print('DEBUG: post deleted via c2s - ' + postFilename)
|
||||
|
|
|
@ -413,7 +413,7 @@ def _sayCommand(content: str, sayStr: str, screenreader: str,
|
|||
|
||||
def _desktopReplyToPost(session, postId: str,
|
||||
base_dir: str, nickname: str, password: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, subject: str,
|
||||
screenreader: str, systemLanguage: str,
|
||||
|
@ -469,7 +469,7 @@ def _desktopReplyToPost(session, postId: str,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
toNickname, toDomain, toPort, ccUrl,
|
||||
httpPrefix, replyMessage, followersOnly,
|
||||
http_prefix, replyMessage, followersOnly,
|
||||
commentsEnabled, attach, mediaType,
|
||||
attachedImageDescription, city,
|
||||
cachedWebfingers, personCache, isArticle,
|
||||
|
@ -485,7 +485,7 @@ def _desktopReplyToPost(session, postId: str,
|
|||
|
||||
def _desktopNewPost(session,
|
||||
base_dir: str, nickname: str, password: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool,
|
||||
screenreader: str, systemLanguage: str,
|
||||
|
@ -536,7 +536,7 @@ def _desktopNewPost(session,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
None, '#Public', port, ccUrl,
|
||||
httpPrefix, newMessage, followersOnly,
|
||||
http_prefix, newMessage, followersOnly,
|
||||
commentsEnabled, attach, mediaType,
|
||||
attachedImageDescription, city,
|
||||
cachedWebfingers, personCache, isArticle,
|
||||
|
@ -664,7 +664,7 @@ def _showRepliesOnPost(postJsonObject: {}, maxReplies: int) -> None:
|
|||
|
||||
|
||||
def _readLocalBoxPost(session, nickname: str, domain: str,
|
||||
httpPrefix: str, base_dir: str, boxName: str,
|
||||
http_prefix: str, base_dir: str, boxName: str,
|
||||
pageNumber: int, index: int, boxJson: {},
|
||||
systemLanguage: str,
|
||||
screenreader: str, espeak,
|
||||
|
@ -701,7 +701,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
twitterReplacementDomain = None
|
||||
postJsonObject2 = \
|
||||
downloadAnnounce(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
postJsonObject,
|
||||
__version__, translate,
|
||||
|
@ -832,7 +832,7 @@ def _desktopShowActor(base_dir: str, actorJson: {}, translate: {},
|
|||
|
||||
|
||||
def _desktopShowProfile(session, nickname: str, domain: str,
|
||||
httpPrefix: str, base_dir: str, boxName: str,
|
||||
http_prefix: str, base_dir: str, boxName: str,
|
||||
pageNumber: int, index: int, boxJson: {},
|
||||
systemLanguage: str,
|
||||
screenreader: str, espeak,
|
||||
|
@ -878,8 +878,8 @@ def _desktopShowProfile(session, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _desktopShowProfileFromHandle(session, nickname: str, domain: str,
|
||||
httpPrefix: str, base_dir: str, boxName: str,
|
||||
handle: str,
|
||||
http_prefix: str, base_dir: str,
|
||||
boxName: str, handle: str,
|
||||
systemLanguage: str,
|
||||
screenreader: str, espeak,
|
||||
translate: {}, yourActor: str,
|
||||
|
@ -1125,7 +1125,7 @@ def _desktopShowBox(indent: str,
|
|||
|
||||
def _desktopNewDM(session, toHandle: str,
|
||||
base_dir: str, nickname: str, password: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool,
|
||||
screenreader: str, systemLanguage: str,
|
||||
|
@ -1148,7 +1148,7 @@ def _desktopNewDM(session, toHandle: str,
|
|||
handle = handle.strip()
|
||||
_desktopNewDMbase(session, handle,
|
||||
base_dir, nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug,
|
||||
screenreader, systemLanguage,
|
||||
|
@ -1159,7 +1159,7 @@ def _desktopNewDM(session, toHandle: str,
|
|||
|
||||
def _desktopNewDMbase(session, toHandle: str,
|
||||
base_dir: str, nickname: str, password: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool,
|
||||
screenreader: str, systemLanguage: str,
|
||||
|
@ -1250,7 +1250,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
toNickname, toDomain, toPort, ccUrl,
|
||||
httpPrefix, newMessage, followersOnly,
|
||||
http_prefix, newMessage, followersOnly,
|
||||
commentsEnabled, attach, mediaType,
|
||||
attachedImageDescription, city,
|
||||
cachedWebfingers, personCache, isArticle,
|
||||
|
@ -1312,7 +1312,7 @@ def _desktopShowFollowing(followingJson: {}, translate: {},
|
|||
handleNickname + '@' + handleDomainFull)
|
||||
|
||||
|
||||
def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
||||
def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
password: str, screenreader: str,
|
||||
systemLanguage: str,
|
||||
|
@ -1407,7 +1407,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
systemLanguage, espeak)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
yourActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
yourActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actorJson = None
|
||||
|
||||
notifyJson = {
|
||||
|
@ -1430,7 +1430,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
systemLanguage, espeak)
|
||||
pgpPublicKeyUpload(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1441,7 +1441,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
getFollowRequestsViaServer(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, 1,
|
||||
http_prefix, 1,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1458,7 +1458,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
# monitor the inbox to generate notifications
|
||||
inboxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
'inbox', 1, debug,
|
||||
signingPrivateKeyPem)
|
||||
else:
|
||||
|
@ -1535,7 +1535,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
currTimeline = 'dm'
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1552,7 +1552,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
currTimeline = 'tlreplies'
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1570,7 +1570,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
currTimeline = 'tlbookmarks'
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1589,7 +1589,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
currTimeline = 'outbox'
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1616,7 +1616,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
prevTimelineFirstId = ''
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
currTimeline, pageNumber,
|
||||
debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1637,7 +1637,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
postIndex = int(postIndexStr)
|
||||
postJsonObject = \
|
||||
_readLocalBoxPost(session, nickname, domain,
|
||||
httpPrefix, base_dir, currTimeline,
|
||||
http_prefix, base_dir, currTimeline,
|
||||
pageNumber, postIndex, boxJson,
|
||||
systemLanguage, screenreader,
|
||||
espeak, translate, yourActor,
|
||||
|
@ -1659,7 +1659,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
if postJsonObject:
|
||||
actorJson = \
|
||||
_desktopShowProfile(session, nickname, domain,
|
||||
httpPrefix, base_dir,
|
||||
http_prefix, base_dir,
|
||||
currTimeline,
|
||||
pageNumber, postIndex,
|
||||
boxJson,
|
||||
|
@ -1677,7 +1677,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
_desktopClearScreen()
|
||||
_desktopShowBanner()
|
||||
_desktopShowProfileFromHandle(session, nickname, domain,
|
||||
httpPrefix, base_dir,
|
||||
http_prefix, base_dir,
|
||||
currTimeline, profileHandle,
|
||||
systemLanguage, screenreader,
|
||||
espeak, translate, yourActor,
|
||||
|
@ -1695,8 +1695,10 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
postIndex = int(postIndexStr)
|
||||
actorJson = \
|
||||
_desktopShowProfile(session, nickname, domain,
|
||||
httpPrefix, base_dir, currTimeline,
|
||||
pageNumber, postIndex, boxJson,
|
||||
http_prefix, base_dir,
|
||||
currTimeline,
|
||||
pageNumber, postIndex,
|
||||
boxJson,
|
||||
systemLanguage, screenreader,
|
||||
espeak, translate, yourActor,
|
||||
None, signingPrivateKeyPem)
|
||||
|
@ -1722,7 +1724,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sessionReply = createSession(proxyType)
|
||||
_desktopReplyToPost(sessionReply, postId,
|
||||
base_dir, nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug, subject,
|
||||
screenreader, systemLanguage,
|
||||
|
@ -1759,7 +1761,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
if toHandle:
|
||||
_desktopNewDM(sessionPost, toHandle,
|
||||
base_dir, nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug,
|
||||
screenreader, systemLanguage,
|
||||
|
@ -1771,7 +1773,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
# public post
|
||||
_desktopNewPost(sessionPost,
|
||||
base_dir, nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug,
|
||||
screenreader, systemLanguage,
|
||||
|
@ -1800,7 +1802,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sessionLike = createSession(proxyType)
|
||||
sendLikeViaServer(base_dir, sessionLike,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers, personCache,
|
||||
False, __version__,
|
||||
|
@ -1840,8 +1842,10 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendUndoMuteViaServer(base_dir, sessionMute,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, postJsonObject['id'],
|
||||
cachedWebfingers, personCache,
|
||||
http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
False, __version__,
|
||||
signingPrivateKeyPem)
|
||||
refreshTimeline = True
|
||||
|
@ -1870,7 +1874,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendMuteViaServer(base_dir, sessionMute,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, postJsonObject['id'],
|
||||
http_prefix, postJsonObject['id'],
|
||||
cachedWebfingers, personCache,
|
||||
False, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1910,7 +1914,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sessionbm = createSession(proxyType)
|
||||
sendUndoBookmarkViaServer(base_dir, sessionbm,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -1941,7 +1945,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sessionbm = createSession(proxyType)
|
||||
sendBookmarkViaServer(base_dir, sessionbm,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers, personCache,
|
||||
False, __version__,
|
||||
|
@ -1976,7 +1980,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendUndoBlockViaServer(base_dir, sessionBlock,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
blockActor,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -2000,7 +2004,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
blockDomain = blockHandle.split('@')[1]
|
||||
blockNickname = blockHandle.split('@')[0]
|
||||
blockActor = \
|
||||
localActorUrl(httpPrefix,
|
||||
localActorUrl(http_prefix,
|
||||
blockNickname, blockDomain)
|
||||
if currIndex > 0 and boxJson and not blockActor:
|
||||
postJsonObject = \
|
||||
|
@ -2022,7 +2026,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendBlockViaServer(base_dir, sessionBlock,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
blockActor,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -2051,7 +2055,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sessionUnlike = createSession(proxyType)
|
||||
sendUndoLikeViaServer(base_dir, sessionUnlike,
|
||||
nickname, password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers, personCache,
|
||||
False, __version__,
|
||||
|
@ -2083,7 +2087,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendAnnounceViaServer(base_dir, sessionAnnounce,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, postId,
|
||||
http_prefix, postId,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2117,7 +2121,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
postJsonObject,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, postId,
|
||||
http_prefix, postId,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
True, __version__,
|
||||
|
@ -2135,7 +2139,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
getFollowRequestsViaServer(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, currPage,
|
||||
http_prefix, currPage,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2155,7 +2159,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
getFollowingViaServer(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, currPage,
|
||||
http_prefix, currPage,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2176,7 +2180,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
getFollowersViaServer(base_dir, session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix, currPage,
|
||||
http_prefix, currPage,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2215,7 +2219,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
followNickname,
|
||||
followDomain,
|
||||
followPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
debug, __version__,
|
||||
|
@ -2250,7 +2254,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
followNickname,
|
||||
followDomain,
|
||||
followPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
debug, __version__,
|
||||
|
@ -2278,7 +2282,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
approveFollowRequestViaServer(base_dir, sessionApprove,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
approveHandle,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -2311,7 +2315,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
denyFollowRequestViaServer(base_dir, sessionDeny,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
denyHandle,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -2395,7 +2399,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
twitterReplacementDomain = None
|
||||
postJsonObject2 = \
|
||||
downloadAnnounce(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
postJsonObject,
|
||||
__version__, translate,
|
||||
|
@ -2484,7 +2488,7 @@ def runDesktopClient(base_dir: str, proxyType: str, httpPrefix: str,
|
|||
sendDeleteViaServer(base_dir, sessionrm,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
postJsonObject['id'],
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
|
|
@ -140,13 +140,13 @@ def E2EEaddDevice(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def E2EEdevicesCollection(base_dir: str, nickname: str, domain: str,
|
||||
domainFull: str, httpPrefix: str) -> {}:
|
||||
domainFull: str, http_prefix: str) -> {}:
|
||||
"""Returns a list of registered devices
|
||||
"""
|
||||
personDir = acctDir(base_dir, nickname, domain)
|
||||
if not os.path.isdir(personDir):
|
||||
return {}
|
||||
personId = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
personId = localActorUrl(http_prefix, nickname, domainFull)
|
||||
if not os.path.isdir(personDir + '/devices'):
|
||||
os.mkdir(personDir + '/devices')
|
||||
deviceList = []
|
||||
|
|
166
epicyon.py
166
epicyon.py
|
@ -673,11 +673,11 @@ if args.testsnetwork:
|
|||
print('All tests succeeded')
|
||||
sys.exit()
|
||||
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
if args.http or args.i2p:
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
elif args.gnunet:
|
||||
httpPrefix = 'gnunet'
|
||||
http_prefix = 'gnunet'
|
||||
|
||||
base_dir = args.base_dir
|
||||
if base_dir.endswith('/'):
|
||||
|
@ -727,7 +727,7 @@ if args.posts:
|
|||
args.language = 'en'
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, originDomain)
|
||||
getPublicPostsOfPerson(base_dir, nickname, domain, False, True,
|
||||
proxyType, args.port, httpPrefix, debug,
|
||||
proxyType, args.port, http_prefix, debug,
|
||||
__version__, args.language,
|
||||
signingPrivateKeyPem, originDomain)
|
||||
sys.exit()
|
||||
|
@ -772,7 +772,7 @@ if args.postDomains:
|
|||
base_dir, nickname, domain,
|
||||
originDomain,
|
||||
proxyType, args.port,
|
||||
httpPrefix, debug,
|
||||
http_prefix, debug,
|
||||
__version__,
|
||||
wordFrequency, domainList,
|
||||
args.language,
|
||||
|
@ -819,7 +819,7 @@ if args.postDomainsBlocked:
|
|||
domainList = getPublicPostDomainsBlocked(None,
|
||||
base_dir, nickname, domain,
|
||||
proxyType, args.port,
|
||||
httpPrefix, debug,
|
||||
http_prefix, debug,
|
||||
__version__,
|
||||
wordFrequency, domainList,
|
||||
args.language,
|
||||
|
@ -864,7 +864,7 @@ if args.checkDomains:
|
|||
checkDomains(None,
|
||||
base_dir, nickname, domain,
|
||||
proxyType, args.port,
|
||||
httpPrefix, debug,
|
||||
http_prefix, debug,
|
||||
__version__,
|
||||
maxBlockedDomains, False, args.language,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -891,7 +891,7 @@ if args.socnet:
|
|||
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
dotGraph = instancesGraph(base_dir, args.socnet,
|
||||
proxyType, args.port,
|
||||
httpPrefix, debug,
|
||||
http_prefix, debug,
|
||||
__version__, args.language,
|
||||
signingPrivateKeyPem)
|
||||
try:
|
||||
|
@ -927,7 +927,7 @@ if args.postsraw:
|
|||
args.language = 'en'
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, originDomain)
|
||||
getPublicPostsOfPerson(base_dir, nickname, domain, False, False,
|
||||
proxyType, args.port, httpPrefix, debug,
|
||||
proxyType, args.port, http_prefix, debug,
|
||||
__version__, args.language,
|
||||
signingPrivateKeyPem, originDomain)
|
||||
sys.exit()
|
||||
|
@ -951,7 +951,7 @@ if args.json:
|
|||
else:
|
||||
print('Did not obtain instance actor key for ' + domain)
|
||||
testJson = getJson(signingPrivateKeyPem, session, args.json, asHeader,
|
||||
None, debug, __version__, httpPrefix, domain)
|
||||
None, debug, __version__, http_prefix, domain)
|
||||
if testJson:
|
||||
pprint(testJson)
|
||||
sys.exit()
|
||||
|
@ -976,7 +976,7 @@ if args.htmlpost:
|
|||
print('Did not obtain instance actor key for ' + domain)
|
||||
testHtml = downloadHtml(signingPrivateKeyPem, session, args.htmlpost,
|
||||
asHeader, None, debug, __version__,
|
||||
httpPrefix, domain)
|
||||
http_prefix, domain)
|
||||
if testHtml:
|
||||
print(testHtml)
|
||||
sys.exit()
|
||||
|
@ -1192,7 +1192,7 @@ if args.approve:
|
|||
if args.secureMode:
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
manualApproveFollowRequest(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.nickname, domain, port,
|
||||
args.approve,
|
||||
federationList,
|
||||
|
@ -1220,7 +1220,7 @@ if args.deny:
|
|||
if args.secureMode:
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
manualDenyFollowRequest(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.nickname, domain, port,
|
||||
args.deny,
|
||||
federationList,
|
||||
|
@ -1318,7 +1318,7 @@ if args.message:
|
|||
base_dir, session, args.nickname, args.password,
|
||||
domain, port,
|
||||
toNickname, toDomain, toPort, ccUrl,
|
||||
httpPrefix, sendMessage, followersOnly,
|
||||
http_prefix, sendMessage, followersOnly,
|
||||
args.commentsEnabled, attach, mediaType,
|
||||
attachedImageDescription, city,
|
||||
cachedWebfingers, personCache, isArticle,
|
||||
|
@ -1354,7 +1354,7 @@ if args.announce:
|
|||
|
||||
sendAnnounceViaServer(base_dir, session, args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.announce,
|
||||
http_prefix, args.announce,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -1398,7 +1398,7 @@ if args.box:
|
|||
session = createSession(proxyType)
|
||||
boxJson = c2sBoxJson(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
args.box, args.pageNumber,
|
||||
args.debug, signingPrivateKeyPem)
|
||||
if boxJson:
|
||||
|
@ -1460,7 +1460,7 @@ if args.itemName:
|
|||
sendShareViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.itemName,
|
||||
args.summary,
|
||||
args.itemImage,
|
||||
|
@ -1503,7 +1503,7 @@ if args.undoItemName:
|
|||
sendUndoShareViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.undoItemName,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
|
@ -1565,7 +1565,7 @@ if args.wantedItemName:
|
|||
sendWantedViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.wantedItemName,
|
||||
args.summary,
|
||||
args.itemImage,
|
||||
|
@ -1608,7 +1608,7 @@ if args.undoWantedItemName:
|
|||
sendUndoWantedViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.undoWantedItemName,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
|
@ -1642,7 +1642,7 @@ if args.like:
|
|||
sendLikeViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.like,
|
||||
http_prefix, args.like,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -1681,7 +1681,7 @@ if args.react:
|
|||
sendReactionViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.react, args.emoji,
|
||||
http_prefix, args.react, args.emoji,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -1714,7 +1714,7 @@ if args.undolike:
|
|||
sendUndoLikeViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.undolike,
|
||||
http_prefix, args.undolike,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1754,7 +1754,7 @@ if args.undoreact:
|
|||
sendUndoReactionViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.undoreact, args.emoji,
|
||||
http_prefix, args.undoreact, args.emoji,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1788,7 +1788,7 @@ if args.bookmark:
|
|||
sendBookmarkViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.bookmark,
|
||||
http_prefix, args.bookmark,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1822,7 +1822,7 @@ if args.unbookmark:
|
|||
sendUndoBookmarkViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.unbookmark,
|
||||
http_prefix, args.unbookmark,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -1855,7 +1855,7 @@ if args.delete:
|
|||
sendDeleteViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.delete,
|
||||
http_prefix, args.delete,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -1887,7 +1887,7 @@ if args.follow:
|
|||
session = createSession(proxyType)
|
||||
personCache = {}
|
||||
cachedWebfingers = {}
|
||||
followHttpPrefix = httpPrefix
|
||||
followHttpPrefix = http_prefix
|
||||
if args.follow.startswith('https'):
|
||||
followHttpPrefix = 'https'
|
||||
if not domain:
|
||||
|
@ -1900,7 +1900,7 @@ if args.follow:
|
|||
args.nickname, args.password,
|
||||
domain, port,
|
||||
followNickname, followDomain, followPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
for t in range(20):
|
||||
|
@ -1933,7 +1933,7 @@ if args.unfollow:
|
|||
session = createSession(proxyType)
|
||||
personCache = {}
|
||||
cachedWebfingers = {}
|
||||
followHttpPrefix = httpPrefix
|
||||
followHttpPrefix = http_prefix
|
||||
if args.follow.startswith('https'):
|
||||
followHttpPrefix = 'https'
|
||||
if not domain:
|
||||
|
@ -1946,7 +1946,7 @@ if args.unfollow:
|
|||
args.nickname, args.password,
|
||||
domain, port,
|
||||
followNickname, followDomain, followPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
for t in range(20):
|
||||
|
@ -1970,7 +1970,7 @@ if args.followingList:
|
|||
session = createSession(proxyType)
|
||||
personCache = {}
|
||||
cachedWebfingers = {}
|
||||
followHttpPrefix = httpPrefix
|
||||
followHttpPrefix = http_prefix
|
||||
if not domain:
|
||||
domain = getConfigParam(base_dir, 'domain')
|
||||
signingPrivateKeyPem = None
|
||||
|
@ -1981,7 +1981,7 @@ if args.followingList:
|
|||
getFollowingViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.pageNumber,
|
||||
http_prefix, args.pageNumber,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
if followingJson:
|
||||
|
@ -2003,7 +2003,7 @@ if args.followersList:
|
|||
session = createSession(proxyType)
|
||||
personCache = {}
|
||||
cachedWebfingers = {}
|
||||
followHttpPrefix = httpPrefix
|
||||
followHttpPrefix = http_prefix
|
||||
if not domain:
|
||||
domain = getConfigParam(base_dir, 'domain')
|
||||
signingPrivateKeyPem = None
|
||||
|
@ -2014,7 +2014,7 @@ if args.followersList:
|
|||
getFollowersViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.pageNumber,
|
||||
http_prefix, args.pageNumber,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2037,7 +2037,7 @@ if args.followRequestsList:
|
|||
session = createSession(proxyType)
|
||||
personCache = {}
|
||||
cachedWebfingers = {}
|
||||
followHttpPrefix = httpPrefix
|
||||
followHttpPrefix = http_prefix
|
||||
if not domain:
|
||||
domain = getConfigParam(base_dir, 'domain')
|
||||
signingPrivateKeyPem = None
|
||||
|
@ -2048,7 +2048,7 @@ if args.followRequestsList:
|
|||
getFollowRequestsViaServer(base_dir, session,
|
||||
args.nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.pageNumber,
|
||||
http_prefix, args.pageNumber,
|
||||
cachedWebfingers, personCache,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
if followRequestsJson:
|
||||
|
@ -2066,28 +2066,28 @@ if args.proxyPort:
|
|||
proxyPort = args.proxyPort
|
||||
setConfigParam(base_dir, 'proxyPort', proxyPort)
|
||||
if args.gnunet:
|
||||
httpPrefix = 'gnunet'
|
||||
http_prefix = 'gnunet'
|
||||
if args.dat or args.hyper:
|
||||
httpPrefix = 'hyper'
|
||||
http_prefix = 'hyper'
|
||||
if args.i2p:
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
|
||||
if args.migrations:
|
||||
cachedWebfingers = {}
|
||||
if args.http or domain.endswith('.onion'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
port = 80
|
||||
proxyType = 'tor'
|
||||
elif domain.endswith('.i2p'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
port = 80
|
||||
proxyType = 'i2p'
|
||||
elif args.gnunet:
|
||||
httpPrefix = 'gnunet'
|
||||
http_prefix = 'gnunet'
|
||||
port = 80
|
||||
proxyType = 'gnunet'
|
||||
else:
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 443
|
||||
session = createSession(proxyType)
|
||||
if not domain:
|
||||
|
@ -2096,7 +2096,7 @@ if args.migrations:
|
|||
if args.secureMode:
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
ctr = migrateAccounts(base_dir, session,
|
||||
httpPrefix, cachedWebfingers,
|
||||
http_prefix, cachedWebfingers,
|
||||
True, signingPrivateKeyPem)
|
||||
if ctr == 0:
|
||||
print('No followed accounts have moved')
|
||||
|
@ -2172,19 +2172,19 @@ if args.followers:
|
|||
domain = domain.replace('\n', '').replace('\r', '')
|
||||
cachedWebfingers = {}
|
||||
if args.http or domain.endswith('.onion'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
port = 80
|
||||
proxyType = 'tor'
|
||||
elif domain.endswith('.i2p'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
port = 80
|
||||
proxyType = 'i2p'
|
||||
elif args.gnunet:
|
||||
httpPrefix = 'gnunet'
|
||||
http_prefix = 'gnunet'
|
||||
port = 80
|
||||
proxyType = 'gnunet'
|
||||
else:
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 443
|
||||
session = createSession(proxyType)
|
||||
if nickname == 'inbox':
|
||||
|
@ -2198,7 +2198,7 @@ if args.followers:
|
|||
if args.secureMode:
|
||||
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
|
||||
wfRequest = webfingerHandle(session, handle,
|
||||
httpPrefix, cachedWebfingers,
|
||||
http_prefix, cachedWebfingers,
|
||||
hostDomain, __version__, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -2232,7 +2232,7 @@ if args.followers:
|
|||
personUrl = personUrl.replace('/c/', '/actor/')
|
||||
if not personUrl:
|
||||
# try single user instance
|
||||
personUrl = httpPrefix + '://' + domain
|
||||
personUrl = http_prefix + '://' + domain
|
||||
profileStr = 'https://www.w3.org/ns/activitystreams'
|
||||
asHeader = {
|
||||
'Accept': 'application/ld+json; profile="' + profileStr + '"'
|
||||
|
@ -2248,7 +2248,7 @@ if args.followers:
|
|||
followersList = \
|
||||
downloadFollowCollection(signingPrivateKeyPem,
|
||||
'followers', session,
|
||||
httpPrefix, personUrl, 1, 3, args.debug)
|
||||
http_prefix, personUrl, 1, 3, args.debug)
|
||||
if followersList:
|
||||
for actor in followersList:
|
||||
print(actor)
|
||||
|
@ -2293,8 +2293,8 @@ if args.addaccount:
|
|||
if domain.endswith('.onion') or \
|
||||
domain.endswith('.i2p'):
|
||||
port = 80
|
||||
httpPrefix = 'http'
|
||||
createPerson(base_dir, nickname, domain, port, httpPrefix,
|
||||
http_prefix = 'http'
|
||||
createPerson(base_dir, nickname, domain, port, http_prefix,
|
||||
True, not args.noapproval, args.password.strip())
|
||||
if os.path.isdir(accountDir):
|
||||
print('Account created for ' + nickname + '@' + domain)
|
||||
|
@ -2330,7 +2330,7 @@ if args.addgroup:
|
|||
if os.path.isdir(accountDir):
|
||||
print('Group already exists')
|
||||
sys.exit()
|
||||
createGroup(base_dir, nickname, domain, port, httpPrefix,
|
||||
createGroup(base_dir, nickname, domain, port, http_prefix,
|
||||
True, args.password.strip())
|
||||
if os.path.isdir(accountDir):
|
||||
print('Group created for ' + nickname + '@' + domain)
|
||||
|
@ -2434,7 +2434,7 @@ if args.archive:
|
|||
else:
|
||||
print('Archiving to ' + args.archive + '...')
|
||||
archiveMedia(base_dir, args.archive, args.archiveWeeks)
|
||||
archivePosts(base_dir, httpPrefix, args.archive, {}, args.archiveMaxPosts)
|
||||
archivePosts(base_dir, http_prefix, args.archive, {}, args.archiveMaxPosts)
|
||||
print('Archiving complete')
|
||||
sys.exit()
|
||||
|
||||
|
@ -2450,7 +2450,7 @@ if args.avatar:
|
|||
print('Specify a nickname with --nickname [name]')
|
||||
sys.exit()
|
||||
city = 'London, England'
|
||||
if setProfileImage(base_dir, httpPrefix, args.nickname, domain,
|
||||
if setProfileImage(base_dir, http_prefix, args.nickname, domain,
|
||||
port, args.avatar, 'avatar', '128x128', city,
|
||||
args.contentLicenseUrl):
|
||||
print('Avatar added for ' + args.nickname)
|
||||
|
@ -2466,7 +2466,7 @@ if args.backgroundImage:
|
|||
print('Specify a nickname with --nickname [name]')
|
||||
sys.exit()
|
||||
city = 'London, England'
|
||||
if setProfileImage(base_dir, httpPrefix, args.nickname, domain,
|
||||
if setProfileImage(base_dir, http_prefix, args.nickname, domain,
|
||||
port, args.backgroundImage, 'background',
|
||||
'256x256', city, args.contentLicenseUrl):
|
||||
print('Background image added for ' + args.nickname)
|
||||
|
@ -2509,7 +2509,7 @@ if args.skill:
|
|||
sendSkillViaServer(base_dir, session,
|
||||
nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.skill, args.skillLevelPercent,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
|
@ -2543,7 +2543,7 @@ if args.availability:
|
|||
|
||||
sendAvailabilityViaServer(base_dir, session, nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
args.availability,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
|
@ -2589,7 +2589,7 @@ if args.desktop:
|
|||
# only store inbox posts if we are not running as a daemon
|
||||
storeInboxPosts = not args.noKeyPress
|
||||
|
||||
runDesktopClient(base_dir, proxyType, httpPrefix,
|
||||
runDesktopClient(base_dir, proxyType, http_prefix,
|
||||
nickname, domain, port, args.password,
|
||||
args.screenreader, args.language,
|
||||
args.notificationSounds,
|
||||
|
@ -2636,7 +2636,7 @@ if args.block:
|
|||
blockedDomain = args.block.split('@')[1]
|
||||
blockedDomain = blockedDomain.replace('\n', '').replace('\r', '')
|
||||
blockedNickname = args.block.split('@')[0]
|
||||
blockedActor = httpPrefix + '://' + blockedDomain + \
|
||||
blockedActor = http_prefix + '://' + blockedDomain + \
|
||||
'/users/' + blockedNickname
|
||||
args.block = blockedActor
|
||||
else:
|
||||
|
@ -2656,7 +2656,7 @@ if args.block:
|
|||
|
||||
sendBlockViaServer(base_dir, session, nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.block,
|
||||
http_prefix, args.block,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -2688,7 +2688,7 @@ if args.mute:
|
|||
|
||||
sendMuteViaServer(base_dir, session, nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.mute,
|
||||
http_prefix, args.mute,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -2720,7 +2720,7 @@ if args.unmute:
|
|||
|
||||
sendUndoMuteViaServer(base_dir, session, nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.unmute,
|
||||
http_prefix, args.unmute,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -2744,7 +2744,7 @@ if args.unblock:
|
|||
blockedDomain = args.unblock.split('@')[1]
|
||||
blockedDomain = blockedDomain.replace('\n', '').replace('\r', '')
|
||||
blockedNickname = args.unblock.split('@')[0]
|
||||
blockedActor = httpPrefix + '://' + blockedDomain + \
|
||||
blockedActor = http_prefix + '://' + blockedDomain + \
|
||||
'/users/' + blockedNickname
|
||||
args.unblock = blockedActor
|
||||
else:
|
||||
|
@ -2764,7 +2764,7 @@ if args.unblock:
|
|||
|
||||
sendUndoBlockViaServer(base_dir, session, nickname, args.password,
|
||||
domain, port,
|
||||
httpPrefix, args.unblock,
|
||||
http_prefix, args.unblock,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(10):
|
||||
|
@ -2814,16 +2814,16 @@ if args.testdata:
|
|||
setConfigParam(base_dir, 'registrationsRemaining',
|
||||
str(maxRegistrations))
|
||||
|
||||
createPerson(base_dir, 'maxboardroom', domain, port, httpPrefix,
|
||||
createPerson(base_dir, 'maxboardroom', domain, port, http_prefix,
|
||||
True, False, password)
|
||||
createPerson(base_dir, 'ultrapancake', domain, port, httpPrefix,
|
||||
createPerson(base_dir, 'ultrapancake', domain, port, http_prefix,
|
||||
True, False, password)
|
||||
createPerson(base_dir, 'drokk', domain, port, httpPrefix,
|
||||
createPerson(base_dir, 'drokk', domain, port, http_prefix,
|
||||
True, False, password)
|
||||
createPerson(base_dir, 'sausagedog', domain, port, httpPrefix,
|
||||
createPerson(base_dir, 'sausagedog', domain, port, http_prefix,
|
||||
True, False, password)
|
||||
|
||||
createPerson(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPerson(base_dir, nickname, domain, port, http_prefix,
|
||||
True, False, 'likewhateveryouwantscoob')
|
||||
setSkillLevel(base_dir, nickname, domain, 'testing', 60)
|
||||
setSkillLevel(base_dir, nickname, domain, 'typing', 50)
|
||||
|
@ -2831,7 +2831,7 @@ if args.testdata:
|
|||
setAvailability(base_dir, nickname, domain, 'busy')
|
||||
|
||||
addShare(base_dir,
|
||||
httpPrefix, nickname, domain, port,
|
||||
http_prefix, nickname, domain, port,
|
||||
"spanner",
|
||||
"It's a spanner",
|
||||
"img/shares1.png",
|
||||
|
@ -2842,7 +2842,7 @@ if args.testdata:
|
|||
debug, city, args.language, {}, 'shares', args.lowBandwidth,
|
||||
args.contentLicenseUrl)
|
||||
addShare(base_dir,
|
||||
httpPrefix, nickname, domain, port,
|
||||
http_prefix, nickname, domain, port,
|
||||
"witch hat",
|
||||
"Spooky",
|
||||
"img/shares2.png",
|
||||
|
@ -2875,7 +2875,7 @@ if args.testdata:
|
|||
conversationId = None
|
||||
lowBandwidth = False
|
||||
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"like this is totally just a #test man",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2888,7 +2888,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"Zoiks!!!",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2901,7 +2901,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"Hey scoob we need like a hundred more #milkshakes",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2914,7 +2914,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"Getting kinda spooky around here",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2927,7 +2927,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"And they would have gotten away with it too" +
|
||||
"if it wasn't for those pesky hackers",
|
||||
testFollowersOnly,
|
||||
|
@ -2941,7 +2941,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"man these centralized sites are like the worst!",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2954,7 +2954,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"another mystery solved #test",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -2967,7 +2967,7 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
lowBandwidth, args.contentLicenseUrl)
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
"let's go bowling",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -3250,7 +3250,7 @@ if __name__ == "__main__":
|
|||
domain, onionDomain, i2pDomain,
|
||||
args.YTReplacementDomain,
|
||||
args.twitterReplacementDomain,
|
||||
port, proxyPort, httpPrefix,
|
||||
port, proxyPort, http_prefix,
|
||||
federationList, args.maxMentions,
|
||||
args.maxEmoji, args.secureMode,
|
||||
proxyType, args.maxReplies,
|
||||
|
|
4
feeds.py
4
feeds.py
|
@ -8,13 +8,13 @@ __status__ = "Production"
|
|||
__module_group__ = "RSS Feeds"
|
||||
|
||||
|
||||
def rss2TagHeader(hashtag: str, httpPrefix: str, domainFull: str) -> str:
|
||||
def rss2TagHeader(hashtag: str, http_prefix: str, domainFull: str) -> str:
|
||||
return \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + \
|
||||
"<rss version=\"2.0\">" + \
|
||||
'<channel>' + \
|
||||
' <title>#' + hashtag + '</title>' + \
|
||||
' <link>' + httpPrefix + '://' + domainFull + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
'/tags/rss2/' + hashtag + '</link>'
|
||||
|
||||
|
||||
|
|
96
follow.py
96
follow.py
|
@ -38,7 +38,7 @@ from session import getJson
|
|||
from session import postJson
|
||||
|
||||
|
||||
def createInitialLastSeen(base_dir: str, httpPrefix: str) -> None:
|
||||
def createInitialLastSeen(base_dir: str, http_prefix: str) -> None:
|
||||
"""Creates initial lastseen files for all follows.
|
||||
The lastseen files are used to generate the Zzz icons on
|
||||
follows/following lists on the profile screen.
|
||||
|
@ -70,7 +70,7 @@ def createInitialLastSeen(base_dir: str, httpPrefix: str) -> None:
|
|||
domain = handle.split('@')[1]
|
||||
if nickname.startswith('!'):
|
||||
nickname = nickname[1:]
|
||||
actor = localActorUrl(httpPrefix, nickname, domain)
|
||||
actor = localActorUrl(http_prefix, nickname, domain)
|
||||
lastSeenFilename = \
|
||||
lastSeenDir + '/' + actor.replace('/', '#') + '.txt'
|
||||
if not os.path.isfile(lastSeenFilename):
|
||||
|
@ -423,7 +423,7 @@ def getNoOfFollowers(base_dir: str,
|
|||
|
||||
|
||||
def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||
httpPrefix: str, authorized: bool,
|
||||
http_prefix: str, authorized: bool,
|
||||
followsPerPage=12,
|
||||
followFile='following') -> {}:
|
||||
"""Returns the following and followers feeds from GET requests.
|
||||
|
@ -468,10 +468,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
|||
|
||||
if headerOnly:
|
||||
firstStr = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + \
|
||||
localActorUrl(http_prefix, nickname, domain) + \
|
||||
'/' + followFile + '?page=1'
|
||||
idStr = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + '/' + followFile
|
||||
localActorUrl(http_prefix, nickname, domain) + '/' + followFile
|
||||
totalStr = \
|
||||
_getNoOfFollows(base_dir, nickname, domain, authorized)
|
||||
following = {
|
||||
|
@ -488,10 +488,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
|||
|
||||
nextPageNumber = int(pageNumber + 1)
|
||||
idStr = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + \
|
||||
localActorUrl(http_prefix, nickname, domain) + \
|
||||
'/' + followFile + '?page=' + str(pageNumber)
|
||||
partOfStr = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + '/' + followFile
|
||||
localActorUrl(http_prefix, nickname, domain) + '/' + followFile
|
||||
following = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': idStr,
|
||||
|
@ -529,10 +529,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
|||
dom = line2.split('@')[1]
|
||||
if not nick.startswith('!'):
|
||||
# person actor
|
||||
url = localActorUrl(httpPrefix, nick, dom)
|
||||
url = localActorUrl(http_prefix, nick, dom)
|
||||
else:
|
||||
# group actor
|
||||
url = httpPrefix + '://' + dom + '/c/' + nick
|
||||
url = http_prefix + '://' + dom + '/c/' + nick
|
||||
following['orderedItems'].append(url)
|
||||
elif ((line.startswith('http') or
|
||||
line.startswith('hyper')) and
|
||||
|
@ -553,7 +553,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
|||
lastPage = 1
|
||||
if nextPageNumber > lastPage:
|
||||
following['next'] = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + \
|
||||
localActorUrl(http_prefix, nickname, domain) + \
|
||||
'/' + followFile + '?page=' + str(lastPage)
|
||||
return following
|
||||
|
||||
|
@ -713,7 +713,7 @@ def storeFollowRequest(base_dir: str,
|
|||
return saveJson(followJson, followActivityfilename)
|
||||
|
||||
|
||||
def followedAccountAccepts(session, base_dir: str, httpPrefix: str,
|
||||
def followedAccountAccepts(session, base_dir: str, http_prefix: str,
|
||||
nicknameToFollow: str, domainToFollow: str,
|
||||
port: int,
|
||||
nickname: str, domain: str, fromPort: int,
|
||||
|
@ -736,7 +736,7 @@ def followedAccountAccepts(session, base_dir: str, httpPrefix: str,
|
|||
' back to ' + acceptHandle)
|
||||
acceptJson = createAccept(base_dir, federationList,
|
||||
nicknameToFollow, domainToFollow, port,
|
||||
personUrl, '', httpPrefix,
|
||||
personUrl, '', http_prefix,
|
||||
followJson)
|
||||
if debug:
|
||||
pprint(acceptJson)
|
||||
|
@ -768,7 +768,7 @@ def followedAccountAccepts(session, base_dir: str, httpPrefix: str,
|
|||
return sendSignedJson(acceptJson, session, base_dir,
|
||||
nicknameToFollow, domainToFollow, port,
|
||||
nickname, domain, fromPort, '',
|
||||
httpPrefix, True, clientToServer,
|
||||
http_prefix, True, clientToServer,
|
||||
federationList,
|
||||
sendThreads, postLog, cachedWebfingers,
|
||||
personCache, debug, projectVersion, None,
|
||||
|
@ -776,7 +776,7 @@ def followedAccountAccepts(session, base_dir: str, httpPrefix: str,
|
|||
7856837)
|
||||
|
||||
|
||||
def followedAccountRejects(session, base_dir: str, httpPrefix: str,
|
||||
def followedAccountRejects(session, base_dir: str, http_prefix: str,
|
||||
nicknameToFollow: str, domainToFollow: str,
|
||||
port: int,
|
||||
nickname: str, domain: str, fromPort: int,
|
||||
|
@ -811,7 +811,7 @@ def followedAccountRejects(session, base_dir: str, httpPrefix: str,
|
|||
rejectJson = \
|
||||
createReject(base_dir, federationList,
|
||||
nicknameToFollow, domainToFollow, port,
|
||||
personUrl, '', httpPrefix, followJson)
|
||||
personUrl, '', http_prefix, followJson)
|
||||
if debug:
|
||||
pprint(rejectJson)
|
||||
print('DEBUG: sending follow Reject from ' +
|
||||
|
@ -836,7 +836,7 @@ def followedAccountRejects(session, base_dir: str, httpPrefix: str,
|
|||
return sendSignedJson(rejectJson, session, base_dir,
|
||||
nicknameToFollow, domainToFollow, port,
|
||||
nickname, domain, fromPort, '',
|
||||
httpPrefix, True, clientToServer,
|
||||
http_prefix, True, clientToServer,
|
||||
federationList,
|
||||
sendThreads, postLog, cachedWebfingers,
|
||||
personCache, debug, projectVersion, None,
|
||||
|
@ -845,7 +845,7 @@ def followedAccountRejects(session, base_dir: str, httpPrefix: str,
|
|||
|
||||
|
||||
def sendFollowRequest(session, base_dir: str,
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
followNickname: str, followDomain: str,
|
||||
followedActor: str,
|
||||
followPort: int, followHttpPrefix: str,
|
||||
|
@ -863,7 +863,7 @@ def sendFollowRequest(session, base_dir: str,
|
|||
return None
|
||||
|
||||
fullDomain = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(httpPrefix, nickname, fullDomain)
|
||||
followActor = localActorUrl(http_prefix, nickname, fullDomain)
|
||||
|
||||
requestDomain = getFullDomain(followDomain, followPort)
|
||||
|
||||
|
@ -928,7 +928,7 @@ def sendFollowRequest(session, base_dir: str,
|
|||
sendSignedJson(newFollowJson, session, base_dir, nickname, domain, port,
|
||||
followNickname, followDomain, followPort,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
httpPrefix, True, clientToServer,
|
||||
http_prefix, True, clientToServer,
|
||||
federationList,
|
||||
sendThreads, postLog, cachedWebfingers, personCache,
|
||||
debug, projectVersion, None, groupAccount,
|
||||
|
@ -942,7 +942,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
|||
fromDomain: str, fromPort: int,
|
||||
followNickname: str, followDomain: str,
|
||||
followPort: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -956,9 +956,9 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
|||
|
||||
followDomainFull = getFullDomain(followDomain, followPort)
|
||||
|
||||
followActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
followedId = \
|
||||
httpPrefix + '://' + followDomainFull + '/@' + followNickname
|
||||
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
newFollowJson = {
|
||||
|
@ -969,11 +969,11 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
|||
'object': followedId
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -993,7 +993,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
|||
fromPersonId, sharedInbox, avatarUrl,
|
||||
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
|
||||
base_dir, session, wfRequest, personCache,
|
||||
projectVersion, httpPrefix, fromNickname,
|
||||
projectVersion, http_prefix, fromNickname,
|
||||
fromDomain, postToBox, 52025)
|
||||
|
||||
if not inboxUrl:
|
||||
|
@ -1014,7 +1014,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, newFollowJson, [], inboxUrl, headers, 3, True)
|
||||
if not postResult:
|
||||
if debug:
|
||||
|
@ -1032,7 +1032,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
fromDomain: str, fromPort: int,
|
||||
followNickname: str, followDomain: str,
|
||||
followPort: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -1045,9 +1045,9 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
followDomainFull = getFullDomain(followDomain, followPort)
|
||||
|
||||
followActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
followedId = \
|
||||
httpPrefix + '://' + followDomainFull + '/@' + followNickname
|
||||
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
||||
unfollowJson = {
|
||||
|
@ -1063,11 +1063,11 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
}
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -1088,7 +1088,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session,
|
||||
wfRequest, personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
fromNickname,
|
||||
fromDomain, postToBox,
|
||||
76536)
|
||||
|
@ -1111,7 +1111,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, unfollowJson, [], inboxUrl, headers, 3, True)
|
||||
if not postResult:
|
||||
if debug:
|
||||
|
@ -1127,7 +1127,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
|||
def getFollowingViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, pageNumber: int,
|
||||
http_prefix: str, pageNumber: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -1138,7 +1138,7 @@ def getFollowingViaServer(base_dir: str, session,
|
|||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ def getFollowingViaServer(base_dir: str, session,
|
|||
url = followActor + '/following?page=' + str(pageNumber)
|
||||
followingJson = \
|
||||
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
|
||||
__version__, httpPrefix, domain, 10, True)
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
if not followingJson:
|
||||
if debug:
|
||||
print('DEBUG: GET following list failed for c2s to ' + url)
|
||||
|
@ -1168,7 +1168,7 @@ def getFollowingViaServer(base_dir: str, session,
|
|||
def getFollowersViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, pageNumber: int,
|
||||
http_prefix: str, pageNumber: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -1179,7 +1179,7 @@ def getFollowersViaServer(base_dir: str, session,
|
|||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ def getFollowersViaServer(base_dir: str, session,
|
|||
url = followActor + '/followers?page=' + str(pageNumber)
|
||||
followersJson = \
|
||||
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
|
||||
__version__, httpPrefix, domain, 10, True)
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
if not followersJson:
|
||||
if debug:
|
||||
print('DEBUG: GET followers list failed for c2s to ' + url)
|
||||
|
@ -1209,7 +1209,7 @@ def getFollowersViaServer(base_dir: str, session,
|
|||
def getFollowRequestsViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, pageNumber: int,
|
||||
http_prefix: str, pageNumber: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -1221,7 +1221,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
|
|||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
||||
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
headers = {
|
||||
|
@ -1235,7 +1235,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
|
|||
url = followActor + '/followrequests?page=' + str(pageNumber)
|
||||
followersJson = \
|
||||
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
|
||||
__version__, httpPrefix, domain, 10, True)
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
if not followersJson:
|
||||
if debug:
|
||||
print('DEBUG: GET follow requests list failed for c2s to ' + url)
|
||||
|
@ -1250,7 +1250,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
|
|||
def approveFollowRequestViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, approveHandle: int,
|
||||
http_prefix: str, approveHandle: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> str:
|
||||
|
@ -1263,7 +1263,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
|
|||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
|
|||
url = actor + '/followapprove=' + approveHandle
|
||||
approveHtml = \
|
||||
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
|
||||
__version__, httpPrefix, domain, 10, True)
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
if not approveHtml:
|
||||
if debug:
|
||||
print('DEBUG: GET approve follow request failed for c2s to ' + url)
|
||||
|
@ -1291,7 +1291,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
|
|||
def denyFollowRequestViaServer(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, denyHandle: int,
|
||||
http_prefix: str, denyHandle: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> str:
|
||||
|
@ -1304,7 +1304,7 @@ def denyFollowRequestViaServer(base_dir: str, session,
|
|||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ def denyFollowRequestViaServer(base_dir: str, session,
|
|||
url = actor + '/followdeny=' + denyHandle
|
||||
denyHtml = \
|
||||
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
|
||||
__version__, httpPrefix, domain, 10, True)
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
if not denyHtml:
|
||||
if debug:
|
||||
print('DEBUG: GET deny follow request failed for c2s to ' + url)
|
||||
|
|
18
httpsig.py
18
httpsig.py
|
@ -68,7 +68,7 @@ def signPostHeaders(dateStr: str, privateKeyPem: str,
|
|||
domain: str, port: int,
|
||||
toDomain: str, toPort: int,
|
||||
path: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
messageBodyJsonStr: str,
|
||||
contentType: str,
|
||||
algorithm: str,
|
||||
|
@ -83,10 +83,10 @@ def signPostHeaders(dateStr: str, privateKeyPem: str,
|
|||
if not dateStr:
|
||||
dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
||||
if nickname != domain and nickname.lower() != 'actor':
|
||||
keyID = localActorUrl(httpPrefix, nickname, domain)
|
||||
keyID = localActorUrl(http_prefix, nickname, domain)
|
||||
else:
|
||||
# instance actor
|
||||
keyID = httpPrefix + '://' + domain + '/actor'
|
||||
keyID = http_prefix + '://' + domain + '/actor'
|
||||
keyID += '#main-key'
|
||||
if not messageBodyJsonStr:
|
||||
headers = {
|
||||
|
@ -147,7 +147,7 @@ def signPostHeadersNew(dateStr: str, privateKeyPem: str,
|
|||
domain: str, port: int,
|
||||
toDomain: str, toPort: int,
|
||||
path: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
messageBodyJsonStr: str,
|
||||
algorithm: str, digestAlgorithm: str,
|
||||
debug: bool) -> (str, str):
|
||||
|
@ -168,7 +168,7 @@ def signPostHeadersNew(dateStr: str, privateKeyPem: str,
|
|||
currTime = datetime.datetime.strptime(dateStr, timeFormat)
|
||||
secondsSinceEpoch = \
|
||||
int((currTime - datetime.datetime(1970, 1, 1)).total_seconds())
|
||||
keyID = localActorUrl(httpPrefix, nickname, domain) + '#main-key'
|
||||
keyID = localActorUrl(http_prefix, nickname, domain) + '#main-key'
|
||||
if not messageBodyJsonStr:
|
||||
headers = {
|
||||
'@request-target': f'get {path}',
|
||||
|
@ -240,7 +240,7 @@ def signPostHeadersNew(dateStr: str, privateKeyPem: str,
|
|||
def createSignedHeader(dateStr: str, privateKeyPem: str, nickname: str,
|
||||
domain: str, port: int,
|
||||
toDomain: str, toPort: int,
|
||||
path: str, httpPrefix: str, withDigest: bool,
|
||||
path: str, http_prefix: str, withDigest: bool,
|
||||
messageBodyJsonStr: str,
|
||||
contentType: str) -> {}:
|
||||
"""Note that the domain is the destination, not the sender
|
||||
|
@ -267,7 +267,7 @@ def createSignedHeader(dateStr: str, privateKeyPem: str, nickname: str,
|
|||
signatureHeader = \
|
||||
signPostHeaders(dateStr, privateKeyPem, nickname,
|
||||
domain, port, toDomain, toPort,
|
||||
path, httpPrefix, None, contentType,
|
||||
path, http_prefix, None, contentType,
|
||||
algorithm, None)
|
||||
else:
|
||||
bodyDigest = messageContentDigest(messageBodyJsonStr, digestAlgorithm)
|
||||
|
@ -285,7 +285,7 @@ def createSignedHeader(dateStr: str, privateKeyPem: str, nickname: str,
|
|||
signPostHeaders(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
toDomain, toPort,
|
||||
path, httpPrefix, messageBodyJsonStr,
|
||||
path, http_prefix, messageBodyJsonStr,
|
||||
contentType, algorithm, digestAlgorithm)
|
||||
headers['signature'] = signatureHeader
|
||||
return headers
|
||||
|
@ -311,7 +311,7 @@ def _verifyRecentSignature(signedDateStr: str) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def verifyPostHeaders(httpPrefix: str,
|
||||
def verifyPostHeaders(http_prefix: str,
|
||||
publicKeyPem: str, headers: dict,
|
||||
path: str, GETmethod: bool,
|
||||
messageBodyDigest: str,
|
||||
|
|
220
inbox.py
220
inbox.py
|
@ -155,7 +155,7 @@ def _storeLastPostId(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
translate: {}) -> bool:
|
||||
"""Updates the hashtag swarm stored as a file
|
||||
"""
|
||||
|
@ -186,7 +186,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
|||
else:
|
||||
print('WARN: no modified date for ' + str(lastModified))
|
||||
if saveSwarm:
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
newSwarmStr = htmlHashTagSwarm(base_dir, actor, translate)
|
||||
if newSwarmStr:
|
||||
try:
|
||||
|
@ -200,7 +200,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def storeHashTags(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
postJsonObject: {}, translate: {}) -> None:
|
||||
"""Extracts hashtags from an incoming post and updates the
|
||||
relevant tags files.
|
||||
|
@ -275,12 +275,12 @@ def storeHashTags(base_dir: str, nickname: str, domain: str,
|
|||
# ready for later display
|
||||
if hashtagsCtr > 0:
|
||||
_updateCachedHashtagSwarm(base_dir, nickname, domain,
|
||||
httpPrefix, domainFull, translate)
|
||||
http_prefix, domainFull, translate)
|
||||
|
||||
|
||||
def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
postJsonObject: {},
|
||||
|
@ -311,7 +311,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
|||
personCache,
|
||||
nickname, domain, port, postJsonObject,
|
||||
avatarUrl, True, allowDeletion,
|
||||
httpPrefix, __version__, boxname,
|
||||
http_prefix, __version__, boxname,
|
||||
YTReplacementDomain, twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
peertubeInstances, allowLocalNetworkAccess,
|
||||
|
@ -448,7 +448,7 @@ def inboxPermittedMessage(domain: str, messageJson: {},
|
|||
return True
|
||||
|
||||
|
||||
def savePostToInboxQueue(base_dir: str, httpPrefix: str,
|
||||
def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
postJsonObject: {},
|
||||
originalPostJsonObject: {},
|
||||
|
@ -542,7 +542,7 @@ def savePostToInboxQueue(base_dir: str, httpPrefix: str,
|
|||
if actor:
|
||||
postId = actor + '/statuses/' + statusNumber
|
||||
else:
|
||||
postId = localActorUrl(httpPrefix, nickname, originalDomain) + \
|
||||
postId = localActorUrl(http_prefix, nickname, originalDomain) + \
|
||||
'/statuses/' + statusNumber
|
||||
|
||||
# NOTE: don't change postJsonObject['id'] before signature check
|
||||
|
@ -593,7 +593,7 @@ def savePostToInboxQueue(base_dir: str, httpPrefix: str,
|
|||
return filename
|
||||
|
||||
|
||||
def _inboxPostRecipientsAdd(base_dir: str, httpPrefix: str, toList: [],
|
||||
def _inboxPostRecipientsAdd(base_dir: str, http_prefix: str, toList: [],
|
||||
recipientsDict: {},
|
||||
domainMatch: str, domain: str,
|
||||
actor: str, debug: bool) -> bool:
|
||||
|
@ -628,7 +628,7 @@ def _inboxPostRecipientsAdd(base_dir: str, httpPrefix: str, toList: [],
|
|||
|
||||
|
||||
def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
debug: bool) -> ([], []):
|
||||
"""Returns dictionaries containing the recipients of the given post
|
||||
The shared dictionary contains followers
|
||||
|
@ -660,7 +660,7 @@ def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
|||
if debug:
|
||||
print('DEBUG: resolving "to"')
|
||||
includesFollowers, recipientsDict = \
|
||||
_inboxPostRecipientsAdd(base_dir, httpPrefix,
|
||||
_inboxPostRecipientsAdd(base_dir, http_prefix,
|
||||
recipientsList,
|
||||
recipientsDict,
|
||||
domainMatch, domainBase,
|
||||
|
@ -677,7 +677,7 @@ def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
|||
else:
|
||||
recipientsList = [postJsonObject['object']['cc']]
|
||||
includesFollowers, recipientsDict = \
|
||||
_inboxPostRecipientsAdd(base_dir, httpPrefix,
|
||||
_inboxPostRecipientsAdd(base_dir, http_prefix,
|
||||
recipientsList,
|
||||
recipientsDict,
|
||||
domainMatch, domainBase,
|
||||
|
@ -702,7 +702,7 @@ def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
|||
else:
|
||||
recipientsList = [postJsonObject['to']]
|
||||
includesFollowers, recipientsDict = \
|
||||
_inboxPostRecipientsAdd(base_dir, httpPrefix,
|
||||
_inboxPostRecipientsAdd(base_dir, http_prefix,
|
||||
recipientsList,
|
||||
recipientsDict,
|
||||
domainMatch, domainBase,
|
||||
|
@ -716,7 +716,7 @@ def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
|||
else:
|
||||
recipientsList = [postJsonObject['cc']]
|
||||
includesFollowers, recipientsDict = \
|
||||
_inboxPostRecipientsAdd(base_dir, httpPrefix,
|
||||
_inboxPostRecipientsAdd(base_dir, http_prefix,
|
||||
recipientsList,
|
||||
recipientsDict,
|
||||
domainMatch, domainBase,
|
||||
|
@ -736,7 +736,7 @@ def _inboxPostRecipients(base_dir: str, postJsonObject: {},
|
|||
return recipientsDict, recipientsDictFollowers
|
||||
|
||||
|
||||
def _receiveUndoFollow(session, base_dir: str, httpPrefix: str,
|
||||
def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
||||
port: int, messageJson: {},
|
||||
federationList: [],
|
||||
debug: bool) -> bool:
|
||||
|
@ -791,7 +791,7 @@ def _receiveUndoFollow(session, base_dir: str, httpPrefix: str,
|
|||
return False
|
||||
|
||||
|
||||
def _receiveUndo(session, base_dir: str, httpPrefix: str,
|
||||
def _receiveUndo(session, base_dir: str, http_prefix: str,
|
||||
port: int, sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
messageJson: {}, federationList: [],
|
||||
|
@ -814,7 +814,7 @@ def _receiveUndo(session, base_dir: str, httpPrefix: str,
|
|||
return False
|
||||
if messageJson['object']['type'] == 'Follow' or \
|
||||
messageJson['object']['type'] == 'Join':
|
||||
return _receiveUndoFollow(session, base_dir, httpPrefix,
|
||||
return _receiveUndoFollow(session, base_dir, http_prefix,
|
||||
port, messageJson,
|
||||
federationList, debug)
|
||||
return False
|
||||
|
@ -938,7 +938,7 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, messageJson: {},
|
|||
|
||||
|
||||
def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
nickname: str, debug: bool) -> bool:
|
||||
|
@ -991,7 +991,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
|
|||
|
||||
def _receiveLike(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
onionDomain: str,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
|
@ -1096,7 +1096,7 @@ def _receiveLike(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
handleName, domain, port, likedPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1114,7 +1114,7 @@ def _receiveLike(recentPostsCache: {},
|
|||
|
||||
def _receiveUndoLike(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool,
|
||||
|
@ -1207,7 +1207,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
handleName, domain, port, likedPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1225,7 +1225,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
|||
|
||||
def _receiveReaction(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
onionDomain: str,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
|
@ -1355,7 +1355,7 @@ def _receiveReaction(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
handleName, domain, port, reactionPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1373,7 +1373,7 @@ def _receiveReaction(recentPostsCache: {},
|
|||
|
||||
def _receiveUndoReaction(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool,
|
||||
|
@ -1482,7 +1482,7 @@ def _receiveUndoReaction(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
handleName, domain, port, reactionPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1500,7 +1500,7 @@ def _receiveUndoReaction(recentPostsCache: {},
|
|||
|
||||
def _receiveBookmark(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool, signingPrivateKeyPem: str,
|
||||
|
@ -1592,7 +1592,7 @@ def _receiveBookmark(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, bookmarkedPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1610,7 +1610,7 @@ def _receiveBookmark(recentPostsCache: {},
|
|||
|
||||
def _receiveUndoBookmark(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool, signingPrivateKeyPem: str,
|
||||
|
@ -1703,7 +1703,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, bookmarkedPostJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1719,7 +1719,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
|
|||
|
||||
|
||||
def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool, allowDeletion: bool,
|
||||
|
@ -1735,7 +1735,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
if not hasObjectString(messageJson, debug):
|
||||
return False
|
||||
domainFull = getFullDomain(domain, port)
|
||||
deletePrefix = httpPrefix + '://' + domainFull + '/'
|
||||
deletePrefix = http_prefix + '://' + domainFull + '/'
|
||||
if (not allowDeletion and
|
||||
(not messageJson['object'].startswith(deletePrefix) or
|
||||
not messageJson['actor'].startswith(deletePrefix))):
|
||||
|
@ -1774,7 +1774,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
print('DEBUG: delete post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return True
|
||||
deletePost(base_dir, httpPrefix, handleNickname,
|
||||
deletePost(base_dir, http_prefix, handleNickname,
|
||||
handleDomain, postFilename, debug,
|
||||
recentPostsCache)
|
||||
if debug:
|
||||
|
@ -1785,7 +1785,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
postFilename = locatePost(base_dir, 'news',
|
||||
handleDomain, messageId)
|
||||
if postFilename:
|
||||
deletePost(base_dir, httpPrefix, 'news',
|
||||
deletePost(base_dir, http_prefix, 'news',
|
||||
handleDomain, postFilename, debug,
|
||||
recentPostsCache)
|
||||
if debug:
|
||||
|
@ -1795,7 +1795,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
|
||||
def _receiveAnnounce(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
domain: str, onionDomain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
|
@ -1910,7 +1910,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, messageJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1931,7 +1931,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
print('Generated announce html ' + announceHtml.replace('\n', ''))
|
||||
|
||||
postJsonObject = downloadAnnounce(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
messageJson,
|
||||
__version__, translate,
|
||||
|
@ -1962,7 +1962,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
print('DEBUG: Announce post downloaded for ' +
|
||||
messageJson['actor'] + ' -> ' + messageJson['object'])
|
||||
storeHashTags(base_dir, nickname, domain,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
postJsonObject, translate)
|
||||
# Try to obtain the actor for this person
|
||||
# so that their avatar can be shown
|
||||
|
@ -1984,7 +1984,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
if isRecentPost(postJsonObject, 3):
|
||||
if not os.path.isfile(postFilename + '.tts'):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
updateSpeaker(base_dir, httpPrefix,
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject, personCache,
|
||||
translate, lookupActor,
|
||||
|
@ -2003,7 +2003,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
pubKey = \
|
||||
getPersonPubKey(base_dir, session, lookupActor,
|
||||
personCache, debug,
|
||||
__version__, httpPrefix,
|
||||
__version__, http_prefix,
|
||||
domain, onionDomain,
|
||||
signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
|
@ -2023,7 +2023,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
|
||||
def _receiveUndoAnnounce(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool) -> bool:
|
||||
|
@ -2104,7 +2104,7 @@ def _postAllowsComments(postFilename: str) -> bool:
|
|||
return jsonPostAllowsComments(postJsonObject)
|
||||
|
||||
|
||||
def populateReplies(base_dir: str, httpPrefix: str, domain: str,
|
||||
def populateReplies(base_dir: str, http_prefix: str, domain: str,
|
||||
messageJson: {}, maxReplies: int, debug: bool) -> bool:
|
||||
"""Updates the list of replies for a post on this domain if
|
||||
a reply to it arrives
|
||||
|
@ -2123,11 +2123,11 @@ def populateReplies(base_dir: str, httpPrefix: str, domain: str,
|
|||
if debug:
|
||||
print('DEBUG: post contains a reply')
|
||||
# is this a reply to a post on this domain?
|
||||
if not replyTo.startswith(httpPrefix + '://' + domain + '/'):
|
||||
if not replyTo.startswith(http_prefix + '://' + domain + '/'):
|
||||
if debug:
|
||||
print('DEBUG: post is a reply to another not on this domain')
|
||||
print(replyTo)
|
||||
print('Expected: ' + httpPrefix + '://' + domain + '/')
|
||||
print('Expected: ' + http_prefix + '://' + domain + '/')
|
||||
return False
|
||||
replyToNickname = getNicknameFromActor(replyTo)
|
||||
if not replyToNickname:
|
||||
|
@ -2188,7 +2188,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
messageJson: {}, maxMentions: int, maxEmoji: int,
|
||||
allowLocalNetworkAccess: bool, debug: bool,
|
||||
systemLanguage: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
personCache: {}) -> bool:
|
||||
"""Is the content of a received post valid?
|
||||
Check for bad html
|
||||
|
@ -2264,7 +2264,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
# check that the post is in a language suitable for this account
|
||||
if not understoodPostLanguage(base_dir, nickname, domain,
|
||||
messageJson, systemLanguage,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
personCache):
|
||||
return False
|
||||
# check for filtered content
|
||||
|
@ -2289,7 +2289,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
|
||||
|
||||
def _obtainAvatarForReplyPost(session, base_dir: str, httpPrefix: str,
|
||||
def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
|
||||
domain: str, onionDomain: str, personCache: {},
|
||||
postJsonObject: {}, debug: bool,
|
||||
signingPrivateKeyPem: str) -> None:
|
||||
|
@ -2322,7 +2322,7 @@ def _obtainAvatarForReplyPost(session, base_dir: str, httpPrefix: str,
|
|||
pubKey = \
|
||||
getPersonPubKey(base_dir, session, lookupActor,
|
||||
personCache, debug,
|
||||
__version__, httpPrefix,
|
||||
__version__, http_prefix,
|
||||
domain, onionDomain, signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
if debug:
|
||||
|
@ -2607,7 +2607,7 @@ def _groupHandle(base_dir: str, handle: str) -> bool:
|
|||
|
||||
def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
||||
postJsonObject: {},
|
||||
httpPrefix: str, federationList: [],
|
||||
http_prefix: str, federationList: [],
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, debug: bool,
|
||||
systemLanguage: str,
|
||||
|
@ -2642,7 +2642,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
nickname = handle.split('@')[0].replace('!', '')
|
||||
domain = handle.split('@')[1]
|
||||
domainFull = getFullDomain(domain, port)
|
||||
groupActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
groupActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
if groupActor not in postJsonObject['to']:
|
||||
return
|
||||
cc = ''
|
||||
|
@ -2650,7 +2650,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
|
||||
# save to the group outbox so that replies will be to the group
|
||||
# rather than the original sender
|
||||
savePostToBox(base_dir, httpPrefix, None,
|
||||
savePostToBox(base_dir, http_prefix, None,
|
||||
nickname, domain, postJsonObject, 'outbox')
|
||||
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
|
@ -2660,14 +2660,14 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
createAnnounce(session, base_dir, federationList,
|
||||
nickname, domain, port,
|
||||
groupActor + '/followers', cc,
|
||||
httpPrefix, postId, False, False,
|
||||
http_prefix, postId, False, False,
|
||||
sendThreads, postLog,
|
||||
personCache, cachedWebfingers,
|
||||
debug, __version__, signingPrivateKeyPem)
|
||||
|
||||
sendToFollowersThread(session, base_dir, nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
httpPrefix, federationList,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
announceJson, debug, __version__,
|
||||
|
@ -2787,7 +2787,7 @@ def _updateLastSeen(base_dir: str, handle: str, actor: str) -> None:
|
|||
print('EX: unable to write ' + lastSeenFilename)
|
||||
|
||||
|
||||
def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
||||
def _bounceDM(senderPostId: str, session, http_prefix: str,
|
||||
base_dir: str, nickname: str, domain: str, port: int,
|
||||
sendingHandle: str, federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
|
@ -2846,7 +2846,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
|||
lowBandwidth = False
|
||||
postJsonObject = \
|
||||
createDirectMessagePost(base_dir, nickname, domain, port,
|
||||
httpPrefix, content, followersOnly,
|
||||
http_prefix, content, followersOnly,
|
||||
saveToFile, clientToServer,
|
||||
commentsEnabled,
|
||||
attachImageFilename, mediaType,
|
||||
|
@ -2864,7 +2864,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
|||
sendSignedJson(postJsonObject, session, base_dir,
|
||||
nickname, domain, port,
|
||||
senderNickname, senderDomain, senderPort, cc,
|
||||
httpPrefix, False, False, federationList,
|
||||
http_prefix, False, False, federationList,
|
||||
sendThreads, postLog, cachedWebfingers,
|
||||
personCache, debug, __version__, None, groupAccount,
|
||||
signingPrivateKeyPem, 7238634)
|
||||
|
@ -2873,7 +2873,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
|
|||
|
||||
def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||
postJsonObject: {}, updateIndexList: [],
|
||||
session, httpPrefix: str,
|
||||
session, http_prefix: str,
|
||||
federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {},
|
||||
|
@ -2895,7 +2895,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if not os.path.isfile(followDMsFilename):
|
||||
# dm index will be updated
|
||||
updateIndexList.append('dm')
|
||||
actUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
||||
_dmNotify(base_dir, handle, actUrl + '/dm')
|
||||
return True
|
||||
|
||||
|
@ -2949,7 +2949,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if not obj.get('inReplyTo'):
|
||||
bouncedId = removeIdEnding(postJsonObject['id'])
|
||||
_bounceDM(bouncedId,
|
||||
session, httpPrefix,
|
||||
session, http_prefix,
|
||||
base_dir,
|
||||
nickname, domain,
|
||||
port, sendH,
|
||||
|
@ -2966,13 +2966,13 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
|
||||
# dm index will be updated
|
||||
updateIndexList.append('dm')
|
||||
actUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
||||
_dmNotify(base_dir, handle, actUrl + '/dm')
|
||||
return True
|
||||
|
||||
|
||||
def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, handle: str, debug: bool,
|
||||
http_prefix: str, handle: str, debug: bool,
|
||||
postJsonObject: {}, recentPostsCache: {},
|
||||
session, onionDomain: str, i2pDomain: str, port: int,
|
||||
federationList: [], sendThreads: [], postLog: [],
|
||||
|
@ -3022,7 +3022,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
|||
session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, questionJson,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -3041,7 +3041,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
|||
questionPostFilename, debug)
|
||||
|
||||
# Is this a question created by this instance?
|
||||
idPrefix = httpPrefix + '://' + domain
|
||||
idPrefix = http_prefix + '://' + domain
|
||||
if not questionJson['object']['id'].startswith(idPrefix):
|
||||
return
|
||||
# if the votes on a question have changed then
|
||||
|
@ -3051,7 +3051,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
|||
sharedItemFederationTokens = {}
|
||||
sendToFollowersThread(session, base_dir, nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
httpPrefix, federationList,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
postJsonObject, debug, __version__,
|
||||
|
@ -3063,7 +3063,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
|||
def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
||||
handle: str, debug: bool, postIsDM: bool,
|
||||
postJsonObject: {}, actor: str,
|
||||
updateIndexList: [], httpPrefix: str,
|
||||
updateIndexList: [], http_prefix: str,
|
||||
defaultReplyIntervalHours: int) -> bool:
|
||||
"""Generates a file indicating that a new reply has arrived
|
||||
The file can then be used by other systems to create a notification
|
||||
|
@ -3098,7 +3098,7 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
defaultReplyIntervalHours)
|
||||
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
||||
replyIntervalHours):
|
||||
actUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
||||
_replyNotify(base_dir, handle, actUrl + '/tlreplies')
|
||||
else:
|
||||
if debug:
|
||||
|
@ -3111,7 +3111,7 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
return isReplyToMutedPost
|
||||
|
||||
|
||||
def _lowFrequencyPostNotification(base_dir: str, httpPrefix: str,
|
||||
def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
port: int, handle: str,
|
||||
postIsDM: bool, jsonObj: {}) -> None:
|
||||
|
@ -3138,7 +3138,7 @@ def _lowFrequencyPostNotification(base_dir: str, httpPrefix: str,
|
|||
postId = removeIdEnding(jsonObj['id'])
|
||||
domFull = getFullDomain(domain, port)
|
||||
postLink = \
|
||||
localActorUrl(httpPrefix, nickname, domFull) + \
|
||||
localActorUrl(http_prefix, nickname, domFull) + \
|
||||
'?notifypost=' + postId.replace('/', '-')
|
||||
_notifyPostArrival(base_dir, handle, postLink)
|
||||
|
||||
|
@ -3177,7 +3177,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||
session, keyId: str, handle: str, messageJson: {},
|
||||
base_dir: str, httpPrefix: str, sendThreads: [],
|
||||
base_dir: str, http_prefix: str, sendThreads: [],
|
||||
postLog: [], cachedWebfingers: {}, personCache: {},
|
||||
queue: [], domain: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
|
@ -3212,7 +3212,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveLike(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
onionDomain,
|
||||
sendThreads, postLog,
|
||||
|
@ -3235,7 +3235,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveUndoLike(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3257,7 +3257,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveReaction(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
onionDomain,
|
||||
sendThreads, postLog,
|
||||
|
@ -3280,7 +3280,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveUndoReaction(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3302,7 +3302,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveBookmark(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3324,7 +3324,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveUndoBookmark(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3349,7 +3349,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveAnnounce(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, onionDomain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3371,7 +3371,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
if _receiveUndoAnnounce(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3384,7 +3384,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
return False
|
||||
|
||||
if _receiveDelete(session, handle, isGroup,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3416,7 +3416,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if _validPostContent(base_dir, nickname, domain,
|
||||
postJsonObject, maxMentions, maxEmoji,
|
||||
allowLocalNetworkAccess, debug,
|
||||
systemLanguage, httpPrefix,
|
||||
systemLanguage, http_prefix,
|
||||
domainFull, personCache):
|
||||
# is the sending actor valid?
|
||||
if not validSendingActor(session, base_dir, nickname, domain,
|
||||
|
@ -3444,11 +3444,11 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
# list of indexes to be updated
|
||||
updateIndexList = ['inbox']
|
||||
populateReplies(base_dir, httpPrefix, domain, postJsonObject,
|
||||
populateReplies(base_dir, http_prefix, domain, postJsonObject,
|
||||
maxReplies, debug)
|
||||
|
||||
_receiveQuestionVote(base_dir, nickname, domain,
|
||||
httpPrefix, handle, debug,
|
||||
http_prefix, handle, debug,
|
||||
postJsonObject, recentPostsCache,
|
||||
session, onionDomain, i2pDomain, port,
|
||||
federationList, sendThreads, postLog,
|
||||
|
@ -3472,7 +3472,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if postIsDM:
|
||||
if not _isValidDM(base_dir, nickname, domain, port,
|
||||
postJsonObject, updateIndexList,
|
||||
session, httpPrefix,
|
||||
session, http_prefix,
|
||||
federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -3485,17 +3485,17 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
return False
|
||||
|
||||
# get the actor being replied to
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
# create a reply notification file if needed
|
||||
isReplyToMutedPost = \
|
||||
_createReplyNotificationFile(base_dir, nickname, domain,
|
||||
handle, debug, postIsDM,
|
||||
postJsonObject, actor,
|
||||
updateIndexList, httpPrefix,
|
||||
updateIndexList, http_prefix,
|
||||
defaultReplyIntervalHours)
|
||||
|
||||
if isImageMedia(session, base_dir, httpPrefix,
|
||||
if isImageMedia(session, base_dir, http_prefix,
|
||||
nickname, domain, postJsonObject,
|
||||
translate,
|
||||
YTReplacementDomain,
|
||||
|
@ -3511,13 +3511,13 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
# get the avatar for a reply/announce
|
||||
_obtainAvatarForReplyPost(session, base_dir,
|
||||
httpPrefix, domain, onionDomain,
|
||||
http_prefix, domain, onionDomain,
|
||||
personCache, postJsonObject, debug,
|
||||
signingPrivateKeyPem)
|
||||
|
||||
# save the post to file
|
||||
if saveJson(postJsonObject, destinationFilename):
|
||||
_lowFrequencyPostNotification(base_dir, httpPrefix,
|
||||
_lowFrequencyPostNotification(base_dir, http_prefix,
|
||||
nickname, domain, port,
|
||||
handle, postIsDM, jsonObj)
|
||||
|
||||
|
@ -3541,7 +3541,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if boxname == 'inbox':
|
||||
if isRecentPost(postJsonObject, 3):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
updateSpeaker(base_dir, httpPrefix,
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject, personCache,
|
||||
translate, None, themeName)
|
||||
|
@ -3554,7 +3554,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
_inboxStorePostToHtmlCache(recentPostsCache,
|
||||
maxRecentPosts,
|
||||
translate, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
session, cachedWebfingers,
|
||||
personCache,
|
||||
handleName,
|
||||
|
@ -3590,7 +3590,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
|
||||
# If this was an edit then delete the previous version of the post
|
||||
if editedFilename:
|
||||
deletePost(base_dir, httpPrefix,
|
||||
deletePost(base_dir, http_prefix,
|
||||
nickname, domain, editedFilename,
|
||||
debug, recentPostsCache)
|
||||
|
||||
|
@ -3600,14 +3600,14 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
|||
_inboxUpdateCalendar(base_dir, handle, postJsonObject)
|
||||
|
||||
storeHashTags(base_dir, handleName, domain,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
postJsonObject, translate)
|
||||
|
||||
# send the post out to group members
|
||||
if isGroup:
|
||||
_sendToGroupMembers(session, base_dir, handle, port,
|
||||
postJsonObject,
|
||||
httpPrefix, federationList, sendThreads,
|
||||
http_prefix, federationList, sendThreads,
|
||||
postLog, cachedWebfingers, personCache,
|
||||
debug, systemLanguage,
|
||||
onionDomain, i2pDomain,
|
||||
|
@ -3843,7 +3843,7 @@ def _checkJsonSignature(base_dir: str, queueJson: {}) -> (bool, bool):
|
|||
return hasJsonSignature, jwebsigType
|
||||
|
||||
|
||||
def _receiveFollowRequest(session, base_dir: str, httpPrefix: str,
|
||||
def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||
port: int, sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
messageJson: {}, federationList: [],
|
||||
|
@ -3968,7 +3968,7 @@ def _receiveFollowRequest(session, base_dir: str, httpPrefix: str,
|
|||
print('Obtaining the following actor: ' + messageJson['actor'])
|
||||
if not getPersonPubKey(base_dir, session, messageJson['actor'],
|
||||
personCache, debug, projectVersion,
|
||||
httpPrefix, domainToFollow, onionDomain,
|
||||
http_prefix, domainToFollow, onionDomain,
|
||||
signingPrivateKeyPem):
|
||||
if debug:
|
||||
print('Unable to obtain following actor: ' +
|
||||
|
@ -4005,7 +4005,7 @@ def _receiveFollowRequest(session, base_dir: str, httpPrefix: str,
|
|||
print('Obtaining the following actor: ' + messageJson['actor'])
|
||||
if not getPersonPubKey(base_dir, session, messageJson['actor'],
|
||||
personCache, debug, projectVersion,
|
||||
httpPrefix, domainToFollow, onionDomain,
|
||||
http_prefix, domainToFollow, onionDomain,
|
||||
signingPrivateKeyPem):
|
||||
if debug:
|
||||
print('Unable to obtain following actor: ' +
|
||||
|
@ -4048,7 +4048,7 @@ def _receiveFollowRequest(session, base_dir: str, httpPrefix: str,
|
|||
print('EX: unable to write ' + followersFilename)
|
||||
|
||||
print('Beginning follow accept')
|
||||
return followedAccountAccepts(session, base_dir, httpPrefix,
|
||||
return followedAccountAccepts(session, base_dir, http_prefix,
|
||||
nicknameToFollow, domainToFollow, port,
|
||||
nickname, domain, fromPort,
|
||||
messageJson['actor'], federationList,
|
||||
|
@ -4060,18 +4060,22 @@ def _receiveFollowRequest(session, base_dir: str, httpPrefix: str,
|
|||
|
||||
def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
||||
projectVersion: str,
|
||||
base_dir: str, httpPrefix: str, sendThreads: [], postLog: [],
|
||||
base_dir: str, http_prefix: str,
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {}, queue: [],
|
||||
domain: str,
|
||||
onionDomain: str, i2pDomain: str, port: int, proxyType: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
port: int, proxyType: str,
|
||||
federationList: [], maxReplies: int,
|
||||
domainMaxPostsPerDay: int, accountMaxPostsPerDay: int,
|
||||
domainMaxPostsPerDay: int,
|
||||
accountMaxPostsPerDay: int,
|
||||
allowDeletion: bool, debug: bool, maxMentions: int,
|
||||
maxEmoji: int, translate: {}, unitTest: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
maxFollowers: int, allowLocalNetworkAccess: bool,
|
||||
maxFollowers: int,
|
||||
allowLocalNetworkAccess: bool,
|
||||
peertubeInstances: [],
|
||||
verifyAllSignatures: bool,
|
||||
themeName: str, systemLanguage: str,
|
||||
|
@ -4228,7 +4232,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
pubKey = \
|
||||
getPersonPubKey(base_dir, session, keyId,
|
||||
personCache, debug,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
domain, onionDomain, signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
if debug:
|
||||
|
@ -4259,7 +4263,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
pprint(queueJson['httpHeaders'])
|
||||
postStr = json.dumps(queueJson['post'])
|
||||
httpSignatureFailed = False
|
||||
if not verifyPostHeaders(httpPrefix,
|
||||
if not verifyPostHeaders(http_prefix,
|
||||
pubKey,
|
||||
queueJson['httpHeaders'],
|
||||
queueJson['path'], False,
|
||||
|
@ -4339,7 +4343,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
# queueJson['post']['id'] = queueJson['id']
|
||||
|
||||
if _receiveUndo(session,
|
||||
base_dir, httpPrefix, port,
|
||||
base_dir, http_prefix, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -4360,7 +4364,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
if debug:
|
||||
print('DEBUG: checking for follow requests')
|
||||
if _receiveFollowRequest(session,
|
||||
base_dir, httpPrefix, port,
|
||||
base_dir, http_prefix, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -4385,7 +4389,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
print('DEBUG: No follow requests')
|
||||
|
||||
if receiveAcceptReject(session,
|
||||
base_dir, httpPrefix, domain, port,
|
||||
base_dir, http_prefix, domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
queueJson['post'],
|
||||
|
@ -4402,7 +4406,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
continue
|
||||
|
||||
if _receiveUpdate(recentPostsCache, session,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
|
@ -4426,7 +4430,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
# get recipients list
|
||||
recipientsDict, recipientsDictFollowers = \
|
||||
_inboxPostRecipients(base_dir, queueJson['post'],
|
||||
httpPrefix, domain, port, debug)
|
||||
http_prefix, domain, port, debug)
|
||||
if len(recipientsDict.items()) == 0 and \
|
||||
len(recipientsDictFollowers.items()) == 0:
|
||||
if debug:
|
||||
|
@ -4485,7 +4489,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
maxRecentPosts,
|
||||
session, keyId, handle,
|
||||
queueJson['post'],
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache, queue,
|
||||
|
|
|
@ -91,7 +91,7 @@ def setActorLanguages(base_dir: str, actorJson: {}, languagesStr: str) -> None:
|
|||
|
||||
def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
||||
messageJson: {}, systemLanguage: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
personCache: {}) -> bool:
|
||||
"""Returns true if the post is written in a language
|
||||
understood by this account
|
||||
|
@ -105,7 +105,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
if msgObject['contentMap'].get(systemLanguage):
|
||||
return True
|
||||
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actorJson = getPersonFromCache(base_dir, personUrl, personCache, False)
|
||||
if not actorJson:
|
||||
print('WARN: unable to load actor to check languages ' + personUrl)
|
||||
|
|
40
like.py
40
like.py
|
@ -71,7 +71,7 @@ def likedByPerson(postJsonObject: {}, nickname: str, domain: str) -> bool:
|
|||
def _like(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
ccList: [], httpPrefix: str,
|
||||
ccList: [], http_prefix: str,
|
||||
objectUrl: str, actorLiked: str,
|
||||
clientToServer: bool,
|
||||
sendThreads: [], postLog: [],
|
||||
|
@ -91,7 +91,7 @@ def _like(recentPostsCache: {},
|
|||
newLikeJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'Like',
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'object': objectUrl
|
||||
}
|
||||
if ccList:
|
||||
|
@ -135,7 +135,7 @@ def _like(recentPostsCache: {},
|
|||
nickname, domain, port,
|
||||
likedPostNickname, likedPostDomain, likedPostPort,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
httpPrefix, True, clientToServer, federationList,
|
||||
http_prefix, True, clientToServer, federationList,
|
||||
sendThreads, postLog, cachedWebfingers, personCache,
|
||||
debug, projectVersion, None, groupAccount,
|
||||
signingPrivateKeyPem, 7367374)
|
||||
|
@ -145,7 +145,7 @@ def _like(recentPostsCache: {},
|
|||
|
||||
def likePost(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
likeNickname: str, likeDomain: str, likePort: int,
|
||||
ccList: [],
|
||||
likeStatusNumber: int, clientToServer: bool,
|
||||
|
@ -157,12 +157,12 @@ def likePost(recentPostsCache: {},
|
|||
"""
|
||||
likeDomain = getFullDomain(likeDomain, likePort)
|
||||
|
||||
actorLiked = localActorUrl(httpPrefix, likeNickname, likeDomain)
|
||||
actorLiked = localActorUrl(http_prefix, likeNickname, likeDomain)
|
||||
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
|
||||
|
||||
return _like(recentPostsCache,
|
||||
session, base_dir, federationList, nickname, domain, port,
|
||||
ccList, httpPrefix, objectUrl, actorLiked, clientToServer,
|
||||
ccList, http_prefix, objectUrl, actorLiked, clientToServer,
|
||||
sendThreads, postLog, personCache, cachedWebfingers,
|
||||
debug, projectVersion, signingPrivateKeyPem)
|
||||
|
||||
|
@ -170,7 +170,7 @@ def likePost(recentPostsCache: {},
|
|||
def sendLikeViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, likeUrl: str,
|
||||
http_prefix: str, likeUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -182,7 +182,7 @@ def sendLikeViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
|
||||
newLikeJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -191,10 +191,10 @@ def sendLikeViaServer(base_dir: str, session,
|
|||
'object': likeUrl
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -216,7 +216,7 @@ def sendLikeViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
fromNickname, fromDomain,
|
||||
postToBox, 72873)
|
||||
|
||||
|
@ -236,7 +236,7 @@ def sendLikeViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, fromDomainFull,
|
||||
postResult = postJson(http_prefix, fromDomainFull,
|
||||
session, newLikeJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -253,7 +253,7 @@ def sendLikeViaServer(base_dir: str, session,
|
|||
def sendUndoLikeViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, likeUrl: str,
|
||||
http_prefix: str, likeUrl: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -265,7 +265,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
|
||||
newUndoLikeJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -278,10 +278,10 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
|||
}
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -304,7 +304,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
72625)
|
||||
|
||||
|
@ -324,7 +324,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, fromDomainFull,
|
||||
postResult = postJson(http_prefix, fromDomainFull,
|
||||
session, newUndoLikeJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -339,7 +339,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
|||
|
||||
|
||||
def outboxLike(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When a like request is received by the outbox from c2s
|
||||
|
@ -374,7 +374,7 @@ def outboxLike(recentPostsCache: {},
|
|||
|
||||
|
||||
def outboxUndoLike(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When an undo like request is received by the outbox from c2s
|
||||
|
|
|
@ -20,7 +20,7 @@ from threads import threadWithTrace
|
|||
|
||||
|
||||
def manualDenyFollowRequest(session, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
denyHandle: str,
|
||||
federationList: [],
|
||||
|
@ -59,7 +59,7 @@ def manualDenyFollowRequest(session, base_dir: str,
|
|||
if ':' in denyDomain:
|
||||
denyPort = getPortFromDomain(denyDomain)
|
||||
denyDomain = removeDomainPort(denyDomain)
|
||||
followedAccountRejects(session, base_dir, httpPrefix,
|
||||
followedAccountRejects(session, base_dir, http_prefix,
|
||||
nickname, domain, port,
|
||||
denyNickname, denyDomain, denyPort,
|
||||
federationList,
|
||||
|
@ -72,7 +72,7 @@ def manualDenyFollowRequest(session, base_dir: str,
|
|||
|
||||
|
||||
def manualDenyFollowRequestThread(session, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
denyHandle: str,
|
||||
federationList: [],
|
||||
|
@ -87,7 +87,7 @@ def manualDenyFollowRequestThread(session, base_dir: str,
|
|||
thr = \
|
||||
threadWithTrace(target=manualDenyFollowRequest,
|
||||
args=(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain, port,
|
||||
denyHandle,
|
||||
federationList,
|
||||
|
@ -121,7 +121,7 @@ def _approveFollowerHandle(accountDir: str, approveHandle: str) -> None:
|
|||
|
||||
|
||||
def manualApproveFollowRequest(session, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
approveHandle: str,
|
||||
federationList: [],
|
||||
|
@ -156,7 +156,7 @@ def manualApproveFollowRequest(session, base_dir: str,
|
|||
groupAccount = True
|
||||
reqNick = approveHandle.split('@')[0].replace('!', '')
|
||||
reqDomain = approveHandle.split('@')[1].strip()
|
||||
reqPrefix = httpPrefix + '://' + reqDomain
|
||||
reqPrefix = http_prefix + '://' + reqDomain
|
||||
paths = getUserPaths()
|
||||
for userPath in paths:
|
||||
if reqPrefix + userPath + reqNick in approveFollowsStr:
|
||||
|
@ -206,7 +206,7 @@ def manualApproveFollowRequest(session, base_dir: str,
|
|||
handle + ' follow request from ' +
|
||||
approveNickname + '@' + approveDomain)
|
||||
followedAccountAccepts(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain, port,
|
||||
approveNickname,
|
||||
approveDomain,
|
||||
|
@ -278,7 +278,7 @@ def manualApproveFollowRequest(session, base_dir: str,
|
|||
|
||||
|
||||
def manualApproveFollowRequestThread(session, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
approveHandle: str,
|
||||
federationList: [],
|
||||
|
@ -293,7 +293,7 @@ def manualApproveFollowRequestThread(session, base_dir: str,
|
|||
thr = \
|
||||
threadWithTrace(target=manualApproveFollowRequest,
|
||||
args=(session, base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain, port,
|
||||
approveHandle,
|
||||
federationList,
|
||||
|
|
|
@ -84,7 +84,7 @@ def _getMastoApiV1Account(base_dir: str, nickname: str, domain: str) -> {}:
|
|||
def mastoApiV1Response(path: str, callingDomain: str,
|
||||
uaStr: str,
|
||||
authorized: bool,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
|
@ -210,10 +210,10 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
|
||||
if callingDomain.endswith('.onion') and onionDomain:
|
||||
domainFull = onionDomain
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
elif (callingDomain.endswith('.i2p') and i2pDomain):
|
||||
domainFull = i2pDomain
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
|
||||
if brochMode:
|
||||
showNodeInfoAccounts = False
|
||||
|
@ -223,7 +223,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
instanceTitle,
|
||||
instanceDescriptionShort,
|
||||
instanceDescription,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
base_dir,
|
||||
adminNickname,
|
||||
domain,
|
||||
|
|
4
media.py
4
media.py
|
@ -293,7 +293,7 @@ def _updateEtag(mediaFilename: str) -> None:
|
|||
str(mediaFilename) + '.etag')
|
||||
|
||||
|
||||
def attachMedia(base_dir: str, httpPrefix: str,
|
||||
def attachMedia(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
postJson: {}, imageFilename: str,
|
||||
mediaType: str, description: str,
|
||||
|
@ -338,7 +338,7 @@ def attachMedia(base_dir: str, httpPrefix: str,
|
|||
'mediaType': mediaType,
|
||||
'name': description,
|
||||
'type': 'Document',
|
||||
'url': httpPrefix + '://' + domain + '/' + mediaPath
|
||||
'url': http_prefix + '://' + domain + '/' + mediaPath
|
||||
}
|
||||
if mediaType.startswith('image/'):
|
||||
attachmentJson['blurhash'] = _getBlurHash()
|
||||
|
|
10
metadata.py
10
metadata.py
|
@ -85,7 +85,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
instanceTitle: str,
|
||||
instanceDescriptionShort: str,
|
||||
instanceDescription: str,
|
||||
httpPrefix: str, base_dir: str,
|
||||
http_prefix: str, base_dir: str,
|
||||
adminNickname: str, domain: str, domainFull: str,
|
||||
registration: bool, systemLanguage: str,
|
||||
version: str) -> {}:
|
||||
|
@ -128,7 +128,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
isBot = True
|
||||
|
||||
url = \
|
||||
httpPrefix + '://' + domainFull + '/@' + \
|
||||
http_prefix + '://' + domainFull + '/@' + \
|
||||
adminActor['preferredUsername']
|
||||
|
||||
if showAccounts:
|
||||
|
@ -170,7 +170,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
'status_count': localPosts,
|
||||
'user_count': activeAccounts
|
||||
},
|
||||
'thumbnail': httpPrefix + '://' + domainFull + '/login.png',
|
||||
'thumbnail': http_prefix + '://' + domainFull + '/login.png',
|
||||
'title': instanceTitle,
|
||||
'uri': domainFull,
|
||||
'urls': {},
|
||||
|
@ -208,13 +208,13 @@ def metaDataInstance(showAccounts: bool,
|
|||
|
||||
|
||||
def metadataCustomEmoji(base_dir: str,
|
||||
httpPrefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
"""Returns the custom emoji
|
||||
Endpoint /api/v1/custom_emojis
|
||||
See https://docs.joinmastodon.org/methods/instance/custom_emojis
|
||||
"""
|
||||
result = []
|
||||
emojisUrl = httpPrefix + '://' + domainFull + '/emoji'
|
||||
emojisUrl = http_prefix + '://' + domainFull + '/emoji'
|
||||
for subdir, dirs, files in os.walk(base_dir + '/emoji'):
|
||||
for f in files:
|
||||
if len(f) < 3:
|
||||
|
|
16
migrate.py
16
migrate.py
|
@ -22,7 +22,7 @@ from person import getActorJson
|
|||
|
||||
def _moveFollowingHandlesForAccount(base_dir: str, nickname: str, domain: str,
|
||||
session,
|
||||
httpPrefix: str, cachedWebfingers: {},
|
||||
http_prefix: str, cachedWebfingers: {},
|
||||
debug: bool,
|
||||
signingPrivateKeyPem: str) -> int:
|
||||
"""Goes through all follows for an account and updates any that have moved
|
||||
|
@ -38,14 +38,14 @@ def _moveFollowingHandlesForAccount(base_dir: str, nickname: str, domain: str,
|
|||
ctr += \
|
||||
_updateMovedHandle(base_dir, nickname, domain,
|
||||
followHandle, session,
|
||||
httpPrefix, cachedWebfingers,
|
||||
http_prefix, cachedWebfingers,
|
||||
debug, signingPrivateKeyPem)
|
||||
return ctr
|
||||
|
||||
|
||||
def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
||||
handle: str, session,
|
||||
httpPrefix: str, cachedWebfingers: {},
|
||||
http_prefix: str, cachedWebfingers: {},
|
||||
debug: bool, signingPrivateKeyPem: str) -> int:
|
||||
"""Check if an account has moved, and if so then alter following.txt
|
||||
for each account.
|
||||
|
@ -59,7 +59,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
|||
if handle.startswith('@'):
|
||||
handle = handle[1:]
|
||||
wfRequest = webfingerHandle(session, handle,
|
||||
httpPrefix, cachedWebfingers,
|
||||
http_prefix, cachedWebfingers,
|
||||
domain, __version__, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -82,10 +82,10 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
|||
return ctr
|
||||
|
||||
gnunet = False
|
||||
if httpPrefix == 'gnunet':
|
||||
if http_prefix == 'gnunet':
|
||||
gnunet = True
|
||||
personJson = \
|
||||
getActorJson(domain, personUrl, httpPrefix, gnunet, debug, False,
|
||||
getActorJson(domain, personUrl, http_prefix, gnunet, debug, False,
|
||||
signingPrivateKeyPem, None)
|
||||
if not personJson:
|
||||
return ctr
|
||||
|
@ -174,7 +174,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def migrateAccounts(base_dir: str, session,
|
||||
httpPrefix: str, cachedWebfingers: {},
|
||||
http_prefix: str, cachedWebfingers: {},
|
||||
debug: bool, signingPrivateKeyPem: str) -> int:
|
||||
"""If followed accounts change then this modifies the
|
||||
following lists for each account accordingly.
|
||||
|
@ -190,7 +190,7 @@ def migrateAccounts(base_dir: str, session,
|
|||
domain = handle.split('@')[1]
|
||||
ctr += \
|
||||
_moveFollowingHandlesForAccount(base_dir, nickname, domain,
|
||||
session, httpPrefix,
|
||||
session, http_prefix,
|
||||
cachedWebfingers, debug,
|
||||
signingPrivateKeyPem)
|
||||
break
|
||||
|
|
|
@ -285,7 +285,7 @@ def hashtagRuleTree(operators: [],
|
|||
return tree
|
||||
|
||||
|
||||
def _hashtagAdd(base_dir: str, httpPrefix: str, domainFull: str,
|
||||
def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
|
||||
postJsonObject: {},
|
||||
actionStr: str, hashtags: [], systemLanguage: str,
|
||||
translate: {}) -> None:
|
||||
|
@ -301,7 +301,7 @@ def _hashtagAdd(base_dir: str, httpPrefix: str, domainFull: str,
|
|||
if not validHashTag(htId):
|
||||
return
|
||||
|
||||
hashtagUrl = httpPrefix + "://" + domainFull + "/tags/" + htId
|
||||
hashtagUrl = http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
newTag = {
|
||||
'href': hashtagUrl,
|
||||
'name': addHashtag,
|
||||
|
@ -337,11 +337,11 @@ def _hashtagAdd(base_dir: str, httpPrefix: str, domainFull: str,
|
|||
if ':' in domain:
|
||||
domain = domain.split(':')[0]
|
||||
storeHashTags(base_dir, 'news', domain,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
postJsonObject, translate)
|
||||
|
||||
|
||||
def _hashtagRemove(httpPrefix: str, domainFull: str, postJsonObject: {},
|
||||
def _hashtagRemove(http_prefix: str, domainFull: str, postJsonObject: {},
|
||||
actionStr: str, hashtags: [], systemLanguage: str) -> None:
|
||||
"""Removes a hashtag via a hashtag rule
|
||||
"""
|
||||
|
@ -352,7 +352,7 @@ def _hashtagRemove(httpPrefix: str, domainFull: str, postJsonObject: {},
|
|||
if rmHashtag in hashtags:
|
||||
hashtags.remove(rmHashtag)
|
||||
htId = rmHashtag.replace('#', '')
|
||||
hashtagUrl = httpPrefix + "://" + domainFull + "/tags/" + htId
|
||||
hashtagUrl = http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
# remove tag html from the post content
|
||||
hashtagHtml = \
|
||||
"<a href=\"" + hashtagUrl + "\" class=\"addedHashtag\" " + \
|
||||
|
@ -374,7 +374,7 @@ def _hashtagRemove(httpPrefix: str, domainFull: str, postJsonObject: {},
|
|||
|
||||
|
||||
def _newswireHashtagProcessing(session, base_dir: str, postJsonObject: {},
|
||||
hashtags: [], httpPrefix: str,
|
||||
hashtags: [], http_prefix: str,
|
||||
domain: str, port: int,
|
||||
personCache: {},
|
||||
cachedWebfingers: {},
|
||||
|
@ -425,12 +425,12 @@ def _newswireHashtagProcessing(session, base_dir: str, postJsonObject: {},
|
|||
|
||||
if actionStr.startswith('add '):
|
||||
# add a hashtag
|
||||
_hashtagAdd(base_dir, httpPrefix, domainFull,
|
||||
_hashtagAdd(base_dir, http_prefix, domainFull,
|
||||
postJsonObject, actionStr, hashtags, systemLanguage,
|
||||
translate)
|
||||
elif actionStr.startswith('remove '):
|
||||
# remove a hashtag
|
||||
_hashtagRemove(httpPrefix, domainFull, postJsonObject,
|
||||
_hashtagRemove(http_prefix, domainFull, postJsonObject,
|
||||
actionStr, hashtags, systemLanguage)
|
||||
elif actionStr.startswith('block') or actionStr.startswith('drop'):
|
||||
# Block this item
|
||||
|
@ -533,7 +533,7 @@ def _createNewsMirror(base_dir: str, domain: str,
|
|||
return True
|
||||
|
||||
|
||||
def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
||||
def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||
domain: str, port: int,
|
||||
newswire: {},
|
||||
translate: {},
|
||||
|
@ -582,7 +582,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
|
||||
statusNumber, published = getStatusNumber(dateStr)
|
||||
newPostId = \
|
||||
localActorUrl(httpPrefix, 'news', domain) + \
|
||||
localActorUrl(http_prefix, 'news', domain) + \
|
||||
'/statuses/' + statusNumber
|
||||
|
||||
# file where the post is stored
|
||||
|
@ -632,7 +632,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
city = 'London, England'
|
||||
conversationId = None
|
||||
blog = createNewsPost(base_dir,
|
||||
domain, port, httpPrefix,
|
||||
domain, port, http_prefix,
|
||||
rssDescription,
|
||||
followersOnly, saveToFile,
|
||||
attachImageFilename, mediaType,
|
||||
|
@ -649,7 +649,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
continue
|
||||
|
||||
idStr = \
|
||||
localActorUrl(httpPrefix, 'news', domain) + \
|
||||
localActorUrl(http_prefix, 'news', domain) + \
|
||||
'/statuses/' + statusNumber + '/replies'
|
||||
blog['news'] = True
|
||||
|
||||
|
@ -665,7 +665,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
blog['object']['id'] = newPostId
|
||||
blog['object']['atomUri'] = newPostId
|
||||
blog['object']['url'] = \
|
||||
httpPrefix + '://' + domain + '/@news/' + statusNumber
|
||||
http_prefix + '://' + domain + '/@news/' + statusNumber
|
||||
blog['object']['published'] = dateStr
|
||||
|
||||
blog['object']['content'] = rssDescription
|
||||
|
@ -681,7 +681,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
|
||||
savePost = _newswireHashtagProcessing(session, base_dir,
|
||||
blog, hashtags,
|
||||
httpPrefix, domain, port,
|
||||
http_prefix, domain, port,
|
||||
personCache, cachedWebfingers,
|
||||
federationList,
|
||||
sendThreads, postLog,
|
||||
|
@ -696,7 +696,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
for tagName in hashtags:
|
||||
htId = tagName.replace('#', '')
|
||||
hashtagUrl = \
|
||||
httpPrefix + "://" + domainFull + "/tags/" + htId
|
||||
http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
newTag = {
|
||||
'href': hashtagUrl,
|
||||
'name': tagName,
|
||||
|
@ -726,7 +726,7 @@ def _convertRSStoActivityPub(base_dir: str, httpPrefix: str,
|
|||
newswire[originalDateStr][6].append(tag)
|
||||
|
||||
storeHashTags(base_dir, 'news', domain,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
blog, translate)
|
||||
|
||||
clearFromPostCaches(base_dir, recentPostsCache, postId)
|
||||
|
@ -771,7 +771,7 @@ def _mergeWithPreviousNewswire(oldNewswire: {}, newNewswire: {}) -> None:
|
|||
|
||||
|
||||
def runNewswireDaemon(base_dir: str, httpd,
|
||||
httpPrefix: str, domain: str, port: int,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
translate: {}) -> None:
|
||||
"""Periodically updates RSS feeds
|
||||
"""
|
||||
|
@ -823,7 +823,7 @@ def runNewswireDaemon(base_dir: str, httpd,
|
|||
|
||||
print('Converting newswire to activitypub format')
|
||||
_convertRSStoActivityPub(base_dir,
|
||||
httpPrefix, domain, port,
|
||||
http_prefix, domain, port,
|
||||
newNewswire, translate,
|
||||
httpd.recentPostsCache,
|
||||
httpd.maxRecentPosts,
|
||||
|
@ -845,7 +845,7 @@ def runNewswireDaemon(base_dir: str, httpd,
|
|||
archiveSubdir = \
|
||||
archiveDir + '/accounts/news@' + domain + '/outbox'
|
||||
print('Archiving news posts')
|
||||
archivePostsForPerson(httpPrefix, 'news',
|
||||
archivePostsForPerson(http_prefix, 'news',
|
||||
domain, base_dir, 'outbox',
|
||||
archiveSubdir,
|
||||
httpd.recentPostsCache,
|
||||
|
|
14
newswire.py
14
newswire.py
|
@ -49,7 +49,7 @@ def _removeCDATA(text: str) -> str:
|
|||
return text
|
||||
|
||||
|
||||
def rss2Header(httpPrefix: str,
|
||||
def rss2Header(http_prefix: str,
|
||||
nickname: str, domainFull: str,
|
||||
title: str, translate: {}) -> str:
|
||||
"""Header for an RSS 2.0 feed
|
||||
|
@ -62,18 +62,18 @@ def rss2Header(httpPrefix: str,
|
|||
if title.startswith('News'):
|
||||
rssStr += \
|
||||
' <title>Newswire</title>' + \
|
||||
' <link>' + httpPrefix + '://' + domainFull + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
'/newswire.xml' + '</link>'
|
||||
elif title.startswith('Site'):
|
||||
rssStr += \
|
||||
' <title>' + domainFull + '</title>' + \
|
||||
' <link>' + httpPrefix + '://' + domainFull + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
'/blog/rss.xml' + '</link>'
|
||||
else:
|
||||
rssStr += \
|
||||
' <title>' + translate[title] + '</title>' + \
|
||||
' <link>' + \
|
||||
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
'/rss.xml' + '</link>'
|
||||
return rssStr
|
||||
|
||||
|
@ -920,12 +920,12 @@ def getRSS(base_dir: str, domain: str, session, url: str,
|
|||
|
||||
|
||||
def getRSSfromDict(base_dir: str, newswire: {},
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
title: str, translate: {}) -> str:
|
||||
"""Returns an rss feed from the current newswire dict.
|
||||
This allows other instances to subscribe to the same newswire
|
||||
"""
|
||||
rssStr = rss2Header(httpPrefix,
|
||||
rssStr = rss2Header(http_prefix,
|
||||
None, domainFull,
|
||||
'Newswire', translate)
|
||||
if not newswire:
|
||||
|
@ -951,7 +951,7 @@ def getRSSfromDict(base_dir: str, newswire: {},
|
|||
url = fields[1]
|
||||
if '://' not in url:
|
||||
if domainFull not in url:
|
||||
url = httpPrefix + '://' + domainFull + url
|
||||
url = http_prefix + '://' + domainFull + url
|
||||
rssStr += ' <link>' + url + '</link>\n'
|
||||
|
||||
rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT")
|
||||
|
|
52
outbox.py
52
outbox.py
|
@ -59,7 +59,7 @@ from webapp_post import individualPostAsHtml
|
|||
|
||||
|
||||
def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" Receive an actor update from c2s
|
||||
|
@ -101,7 +101,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
|||
print('DEBUG: c2s actor update id is not a string')
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
if len(messageJson['to']) != 1:
|
||||
if debug:
|
||||
print('DEBUG: c2s actor update - to does not contain one actor ' +
|
||||
|
@ -179,7 +179,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
|||
|
||||
def postMessageToOutbox(session, translate: {},
|
||||
messageJson: {}, postToNickname: str,
|
||||
server, base_dir: str, httpPrefix: str,
|
||||
server, base_dir: str, http_prefix: str,
|
||||
domain: str, domainFull: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
recentPostsCache: {}, followersThreads: [],
|
||||
|
@ -215,7 +215,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
if debug:
|
||||
print('DEBUG: POST to outbox - adding Create wrapper')
|
||||
messageJson = \
|
||||
outboxMessageCreateWrap(httpPrefix,
|
||||
outboxMessageCreateWrap(http_prefix,
|
||||
postToNickname,
|
||||
domain, port,
|
||||
messageJson)
|
||||
|
@ -334,7 +334,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
os.rename(uploadMediaFilename, mediaFilename)
|
||||
# change the url of the attachment
|
||||
attach['url'] = \
|
||||
httpPrefix + '://' + domainFull + '/' + mediaPath
|
||||
http_prefix + '://' + domainFull + '/' + mediaPath
|
||||
attach['url'] = \
|
||||
attach['url'].replace('/media/',
|
||||
'/system/' +
|
||||
|
@ -371,7 +371,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
|
||||
savedFilename = \
|
||||
savePostToBox(base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
postId,
|
||||
postToNickname, domainFull,
|
||||
messageJson, outboxName)
|
||||
|
@ -412,14 +412,14 @@ def postMessageToOutbox(session, translate: {},
|
|||
if messageJson['type'] in indexedActivities:
|
||||
indexes = [outboxName, "inbox"]
|
||||
selfActor = \
|
||||
localActorUrl(httpPrefix, postToNickname, domainFull)
|
||||
localActorUrl(http_prefix, postToNickname, domainFull)
|
||||
for boxNameIndex in indexes:
|
||||
if not boxNameIndex:
|
||||
continue
|
||||
|
||||
# should this also go to the media timeline?
|
||||
if boxNameIndex == 'inbox':
|
||||
if isImageMedia(session, base_dir, httpPrefix,
|
||||
if isImageMedia(session, base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
messageJson,
|
||||
translate,
|
||||
|
@ -462,7 +462,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
postToNickname, domain, port,
|
||||
messageJson, None, True,
|
||||
allowDeletion,
|
||||
httpPrefix, __version__,
|
||||
http_prefix, __version__,
|
||||
boxNameIndex,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -513,7 +513,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
base_dir,
|
||||
postToNickname,
|
||||
domain, onionDomain, i2pDomain,
|
||||
port, httpPrefix,
|
||||
port, http_prefix,
|
||||
federationList,
|
||||
sendThreads,
|
||||
postLog,
|
||||
|
@ -541,52 +541,52 @@ def postMessageToOutbox(session, translate: {},
|
|||
if debug:
|
||||
print('DEBUG: handle any like requests')
|
||||
outboxLike(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
if debug:
|
||||
print('DEBUG: handle any undo like requests')
|
||||
outboxUndoLike(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle any emoji reaction requests')
|
||||
outboxReaction(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
if debug:
|
||||
print('DEBUG: handle any undo emoji reaction requests')
|
||||
outboxUndoReaction(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle any undo announce requests')
|
||||
outboxUndoAnnounce(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle any bookmark requests')
|
||||
outboxBookmark(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
if debug:
|
||||
print('DEBUG: handle any undo bookmark requests')
|
||||
outboxUndoBookmark(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle delete requests')
|
||||
outboxDelete(base_dir, httpPrefix,
|
||||
outboxDelete(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
messageJson, debug,
|
||||
allowDeletion,
|
||||
|
@ -594,20 +594,20 @@ def postMessageToOutbox(session, translate: {},
|
|||
|
||||
if debug:
|
||||
print('DEBUG: handle block requests')
|
||||
outboxBlock(base_dir, httpPrefix,
|
||||
outboxBlock(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
port,
|
||||
messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle undo block requests')
|
||||
outboxUndoBlock(base_dir, httpPrefix,
|
||||
outboxUndoBlock(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
port, messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle mute requests')
|
||||
outboxMute(base_dir, httpPrefix,
|
||||
outboxMute(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
port,
|
||||
messageJson, debug,
|
||||
|
@ -615,7 +615,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
|
||||
if debug:
|
||||
print('DEBUG: handle undo mute requests')
|
||||
outboxUndoMute(base_dir, httpPrefix,
|
||||
outboxUndoMute(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
port,
|
||||
messageJson, debug,
|
||||
|
@ -623,21 +623,21 @@ def postMessageToOutbox(session, translate: {},
|
|||
|
||||
if debug:
|
||||
print('DEBUG: handle share uploads')
|
||||
outboxShareUpload(base_dir, httpPrefix, postToNickname, domain,
|
||||
outboxShareUpload(base_dir, http_prefix, postToNickname, domain,
|
||||
port, messageJson, debug, city,
|
||||
systemLanguage, translate, lowBandwidth,
|
||||
contentLicenseUrl)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle undo share uploads')
|
||||
outboxUndoShareUpload(base_dir, httpPrefix,
|
||||
outboxUndoShareUpload(base_dir, http_prefix,
|
||||
postToNickname, domain,
|
||||
port, messageJson, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle actor updates from c2s')
|
||||
_outboxPersonReceiveUpdate(recentPostsCache,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postToNickname, domain, port,
|
||||
messageJson, debug)
|
||||
|
||||
|
@ -654,7 +654,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
sendToNamedAddressesThread(server.session, base_dir,
|
||||
postToNickname,
|
||||
domain, onionDomain, i2pDomain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
federationList,
|
||||
sendThreads,
|
||||
postLog,
|
||||
|
|
83
person.py
83
person.py
|
@ -91,7 +91,8 @@ def generateRSAKey() -> (str, str):
|
|||
return privateKeyPem, publicKeyPem
|
||||
|
||||
|
||||
def setProfileImage(base_dir: str, httpPrefix: str, nickname: str, domain: str,
|
||||
def setProfileImage(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
port: int, imageFilename: str, imageType: str,
|
||||
resolution: str, city: str,
|
||||
contentLicenseUrl: str) -> bool:
|
||||
|
@ -148,7 +149,7 @@ def setProfileImage(base_dir: str, httpPrefix: str, nickname: str, domain: str,
|
|||
if personJson:
|
||||
personJson[iconFilenameBase]['mediaType'] = mediaType
|
||||
personJson[iconFilenameBase]['url'] = \
|
||||
localActorUrl(httpPrefix, nickname, fullDomain) + \
|
||||
localActorUrl(http_prefix, nickname, fullDomain) + \
|
||||
'/' + iconFilename
|
||||
saveJson(personJson, personFilename)
|
||||
|
||||
|
@ -348,7 +349,7 @@ def getDefaultPersonContext() -> str:
|
|||
|
||||
|
||||
def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, saveToFile: bool,
|
||||
http_prefix: str, saveToFile: bool,
|
||||
manualFollowerApproval: bool,
|
||||
groupAccount: bool,
|
||||
password: str) -> (str, str, {}, {}):
|
||||
|
@ -357,7 +358,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
|||
privateKeyPem, publicKeyPem = generateRSAKey()
|
||||
webfingerEndpoint = \
|
||||
createWebfingerEndpoint(nickname, domain, port,
|
||||
httpPrefix, publicKeyPem,
|
||||
http_prefix, publicKeyPem,
|
||||
groupAccount)
|
||||
if saveToFile:
|
||||
storeWebfingerEndpoint(nickname, domain, port,
|
||||
|
@ -373,20 +374,20 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
|||
# Enable follower approval by default
|
||||
approveFollowers = manualFollowerApproval
|
||||
personName = nickname
|
||||
personId = localActorUrl(httpPrefix, nickname, domain)
|
||||
personId = localActorUrl(http_prefix, nickname, domain)
|
||||
inboxStr = personId + '/inbox'
|
||||
personUrl = httpPrefix + '://' + domain + '/@' + personName
|
||||
personUrl = http_prefix + '://' + domain + '/@' + personName
|
||||
if nickname == 'inbox':
|
||||
# shared inbox
|
||||
inboxStr = httpPrefix + '://' + domain + '/actor/inbox'
|
||||
personId = httpPrefix + '://' + domain + '/actor'
|
||||
personUrl = httpPrefix + '://' + domain + \
|
||||
inboxStr = http_prefix + '://' + domain + '/actor/inbox'
|
||||
personId = http_prefix + '://' + domain + '/actor'
|
||||
personUrl = http_prefix + '://' + domain + \
|
||||
'/about/more?instance_actor=true'
|
||||
personName = originalDomain
|
||||
approveFollowers = True
|
||||
personType = 'Application'
|
||||
elif nickname == 'news':
|
||||
personUrl = httpPrefix + '://' + domain + \
|
||||
personUrl = http_prefix + '://' + domain + \
|
||||
'/about/more?news_actor=true'
|
||||
approveFollowers = True
|
||||
personType = 'Application'
|
||||
|
@ -415,7 +416,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
|||
'devices': personId + '/collections/devices',
|
||||
'endpoints': {
|
||||
'id': personId + '/endpoints',
|
||||
'sharedInbox': httpPrefix + '://' + domain + '/inbox',
|
||||
'sharedInbox': http_prefix + '://' + domain + '/inbox',
|
||||
},
|
||||
'featured': personId + '/collections/featured',
|
||||
'featuredTags': personId + '/collections/tags',
|
||||
|
@ -538,7 +539,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
|||
return privateKeyPem, publicKeyPem, newPerson, webfingerEndpoint
|
||||
|
||||
|
||||
def registerAccount(base_dir: str, httpPrefix: str, domain: str, port: int,
|
||||
def registerAccount(base_dir: str, http_prefix: str, domain: str, port: int,
|
||||
nickname: str, password: str,
|
||||
manualFollowerApproval: bool) -> bool:
|
||||
"""Registers a new account from the web interface
|
||||
|
@ -554,7 +555,7 @@ def registerAccount(base_dir: str, httpPrefix: str, domain: str, port: int,
|
|||
(privateKeyPem, publicKeyPem,
|
||||
newPerson, webfingerEndpoint) = createPerson(base_dir, nickname,
|
||||
domain, port,
|
||||
httpPrefix, True,
|
||||
http_prefix, True,
|
||||
manualFollowerApproval,
|
||||
password)
|
||||
if privateKeyPem:
|
||||
|
@ -563,14 +564,14 @@ def registerAccount(base_dir: str, httpPrefix: str, domain: str, port: int,
|
|||
|
||||
|
||||
def createGroup(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, saveToFile: bool,
|
||||
http_prefix: str, saveToFile: bool,
|
||||
password: str = None) -> (str, str, {}, {}):
|
||||
"""Returns a group
|
||||
"""
|
||||
(privateKeyPem, publicKeyPem,
|
||||
newPerson, webfingerEndpoint) = createPerson(base_dir, nickname,
|
||||
domain, port,
|
||||
httpPrefix, saveToFile,
|
||||
http_prefix, saveToFile,
|
||||
False, password, True)
|
||||
|
||||
return privateKeyPem, publicKeyPem, newPerson, webfingerEndpoint
|
||||
|
@ -591,7 +592,7 @@ def savePersonQrcode(base_dir: str,
|
|||
|
||||
|
||||
def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, saveToFile: bool,
|
||||
http_prefix: str, saveToFile: bool,
|
||||
manualFollowerApproval: bool,
|
||||
password: str,
|
||||
groupAccount: bool = False) -> (str, str, {}, {}):
|
||||
|
@ -617,7 +618,7 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
|||
(privateKeyPem, publicKeyPem,
|
||||
newPerson, webfingerEndpoint) = _createPersonBase(base_dir, nickname,
|
||||
domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
saveToFile,
|
||||
manualFollowerApproval,
|
||||
groupAccount,
|
||||
|
@ -704,19 +705,19 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
|||
|
||||
|
||||
def createSharedInbox(base_dir: str, nickname: str, domain: str, port: int,
|
||||
httpPrefix: str) -> (str, str, {}, {}):
|
||||
http_prefix: str) -> (str, str, {}, {}):
|
||||
"""Generates the shared inbox
|
||||
"""
|
||||
return _createPersonBase(base_dir, nickname, domain, port, httpPrefix,
|
||||
return _createPersonBase(base_dir, nickname, domain, port, http_prefix,
|
||||
True, True, False, None)
|
||||
|
||||
|
||||
def createNewsInbox(base_dir: str, domain: str, port: int,
|
||||
httpPrefix: str) -> (str, str, {}, {}):
|
||||
http_prefix: str) -> (str, str, {}, {}):
|
||||
"""Generates the news inbox
|
||||
"""
|
||||
return createPerson(base_dir, 'news', domain, port,
|
||||
httpPrefix, True, True, None)
|
||||
http_prefix, True, True, None)
|
||||
|
||||
|
||||
def personUpgradeActor(base_dir: str, personJson: {},
|
||||
|
@ -896,7 +897,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
|
|||
|
||||
def personBoxJson(recentPostsCache: {},
|
||||
session, base_dir: str, domain: str, port: int, path: str,
|
||||
httpPrefix: str, noOfItems: int, boxname: str,
|
||||
http_prefix: str, noOfItems: int, boxname: str,
|
||||
authorized: bool,
|
||||
newswireVotesThreshold: int, positiveVoting: bool,
|
||||
votingTimeMins: int) -> {}:
|
||||
|
@ -947,50 +948,50 @@ def personBoxJson(recentPostsCache: {},
|
|||
if boxname == 'inbox':
|
||||
return createInbox(recentPostsCache,
|
||||
session, base_dir, nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, headerOnly, pageNumber)
|
||||
elif boxname == 'dm':
|
||||
return createDMTimeline(recentPostsCache,
|
||||
session, base_dir, nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, headerOnly, pageNumber)
|
||||
elif boxname == 'tlbookmarks' or boxname == 'bookmarks':
|
||||
return createBookmarksTimeline(session, base_dir, nickname, domain,
|
||||
port, httpPrefix,
|
||||
port, http_prefix,
|
||||
noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
elif boxname == 'tlreplies':
|
||||
return createRepliesTimeline(recentPostsCache,
|
||||
session, base_dir, nickname, domain,
|
||||
port, httpPrefix,
|
||||
port, http_prefix,
|
||||
noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
elif boxname == 'tlmedia':
|
||||
return createMediaTimeline(session, base_dir, nickname, domain, port,
|
||||
httpPrefix, noOfItems, headerOnly,
|
||||
http_prefix, noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
elif boxname == 'tlnews':
|
||||
return createNewsTimeline(session, base_dir, nickname, domain, port,
|
||||
httpPrefix, noOfItems, headerOnly,
|
||||
http_prefix, noOfItems, headerOnly,
|
||||
newswireVotesThreshold, positiveVoting,
|
||||
votingTimeMins, pageNumber)
|
||||
elif boxname == 'tlfeatures':
|
||||
return createFeaturesTimeline(session, base_dir,
|
||||
nickname, domain, port,
|
||||
httpPrefix, noOfItems, headerOnly,
|
||||
http_prefix, noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
elif boxname == 'tlblogs':
|
||||
return createBlogsTimeline(session, base_dir, nickname, domain, port,
|
||||
httpPrefix, noOfItems, headerOnly,
|
||||
http_prefix, noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
elif boxname == 'outbox':
|
||||
return createOutbox(session, base_dir, nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, headerOnly, authorized,
|
||||
pageNumber)
|
||||
elif boxname == 'moderation':
|
||||
return createModeration(base_dir, nickname, domain, port,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
noOfItems, headerOnly,
|
||||
pageNumber)
|
||||
return None
|
||||
|
@ -1497,19 +1498,19 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
|||
cachedWebfingers = {}
|
||||
proxyType = None
|
||||
if http or domain.endswith('.onion'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = 'tor'
|
||||
elif domain.endswith('.i2p'):
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = 'i2p'
|
||||
elif gnunet:
|
||||
httpPrefix = 'gnunet'
|
||||
http_prefix = 'gnunet'
|
||||
proxyType = 'gnunet'
|
||||
else:
|
||||
if '127.0.' not in domain and '192.168.' not in domain:
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
else:
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
if existingSession:
|
||||
session = existingSession
|
||||
else:
|
||||
|
@ -1532,7 +1533,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
|||
else:
|
||||
handle = nickname + '@' + domain
|
||||
wfRequest = webfingerHandle(session, handle,
|
||||
httpPrefix, cachedWebfingers,
|
||||
http_prefix, cachedWebfingers,
|
||||
hostDomain, __version__, debug,
|
||||
groupAccount, signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -1570,10 +1571,10 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
|||
for userPath in paths:
|
||||
personUrl = personUrl.replace(userPath, '/actor/')
|
||||
if not personUrl and groupAccount:
|
||||
personUrl = httpPrefix + '://' + domain + '/c/' + nickname
|
||||
personUrl = http_prefix + '://' + domain + '/c/' + nickname
|
||||
if not personUrl:
|
||||
# try single user instance
|
||||
personUrl = httpPrefix + '://' + domain + '/' + nickname
|
||||
personUrl = http_prefix + '://' + domain + '/' + nickname
|
||||
headersList = (
|
||||
"ld+json", "jrd+json", "activity+json"
|
||||
)
|
||||
|
@ -1592,7 +1593,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
|||
}
|
||||
personJson = \
|
||||
getJson(signingPrivateKeyPem, session, personUrl, asHeader, None,
|
||||
debug, __version__, httpPrefix, hostDomain, 20, quiet)
|
||||
debug, __version__, http_prefix, hostDomain, 20, quiet)
|
||||
if personJson:
|
||||
if not quiet:
|
||||
pprint(personJson)
|
||||
|
|
10
pgp.py
10
pgp.py
|
@ -455,7 +455,7 @@ def pgpLocalPublicKey() -> str:
|
|||
def pgpPublicKeyUpload(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, test: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -500,7 +500,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
if debug:
|
||||
print('Actor for ' + handle + ' obtained')
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
handle = replaceUsersWithAt(actor)
|
||||
|
||||
# check that this looks like the correct actor
|
||||
|
@ -557,7 +557,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
domain, __version__, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -578,7 +578,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
|
||||
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
|
||||
base_dir, session, wfRequest, personCache,
|
||||
__version__, httpPrefix, nickname,
|
||||
__version__, http_prefix, nickname,
|
||||
domain, postToBox, 35725)
|
||||
|
||||
if not inboxUrl:
|
||||
|
@ -601,7 +601,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
tries = 0
|
||||
while tries < 4:
|
||||
postResult = \
|
||||
postJson(httpPrefix, domainFull,
|
||||
postJson(http_prefix, domainFull,
|
||||
session, actorUpdate, [], inboxUrl,
|
||||
headers, 5, quiet)
|
||||
if postResult:
|
||||
|
|
41
reaction.py
41
reaction.py
|
@ -63,7 +63,7 @@ def validEmojiContent(emojiContent: str) -> bool:
|
|||
def _reaction(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int,
|
||||
ccList: [], httpPrefix: str,
|
||||
ccList: [], http_prefix: str,
|
||||
objectUrl: str, emojiContent: str,
|
||||
actorReaction: str,
|
||||
clientToServer: bool,
|
||||
|
@ -87,7 +87,7 @@ def _reaction(recentPostsCache: {},
|
|||
newReactionJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'type': 'EmojiReact',
|
||||
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
||||
'object': objectUrl,
|
||||
'content': emojiContent
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ def _reaction(recentPostsCache: {},
|
|||
reactionPostNickname,
|
||||
reactionPostDomain, reactionPostPort,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
httpPrefix, True, clientToServer, federationList,
|
||||
http_prefix, True, clientToServer, federationList,
|
||||
sendThreads, postLog, cachedWebfingers, personCache,
|
||||
debug, projectVersion, None, groupAccount,
|
||||
signingPrivateKeyPem, 7165392)
|
||||
|
@ -147,7 +147,7 @@ def _reaction(recentPostsCache: {},
|
|||
|
||||
def reactionPost(recentPostsCache: {},
|
||||
session, base_dir: str, federationList: [],
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
reactionNickname: str, reactionDomain: str, reactionPort: int,
|
||||
ccList: [],
|
||||
reactionStatusNumber: int, emojiContent: str,
|
||||
|
@ -160,13 +160,14 @@ def reactionPost(recentPostsCache: {},
|
|||
"""
|
||||
reactionDomain = getFullDomain(reactionDomain, reactionPort)
|
||||
|
||||
actorReaction = localActorUrl(httpPrefix, reactionNickname, reactionDomain)
|
||||
actorReaction = \
|
||||
localActorUrl(http_prefix, reactionNickname, reactionDomain)
|
||||
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
|
||||
|
||||
return _reaction(recentPostsCache,
|
||||
session, base_dir, federationList,
|
||||
nickname, domain, port,
|
||||
ccList, httpPrefix, objectUrl, emojiContent,
|
||||
ccList, http_prefix, objectUrl, emojiContent,
|
||||
actorReaction, clientToServer,
|
||||
sendThreads, postLog, personCache, cachedWebfingers,
|
||||
debug, projectVersion, signingPrivateKeyPem)
|
||||
|
@ -175,7 +176,7 @@ def reactionPost(recentPostsCache: {},
|
|||
def sendReactionViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, reactionUrl: str,
|
||||
http_prefix: str, reactionUrl: str,
|
||||
emojiContent: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
|
@ -192,7 +193,7 @@ def sendReactionViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
|
||||
newReactionJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -202,10 +203,10 @@ def sendReactionViaServer(base_dir: str, session,
|
|||
'content': emojiContent
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -227,7 +228,7 @@ def sendReactionViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
fromNickname, fromDomain,
|
||||
postToBox, 72873)
|
||||
|
||||
|
@ -248,7 +249,7 @@ def sendReactionViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, fromDomainFull,
|
||||
postResult = postJson(http_prefix, fromDomainFull,
|
||||
session, newReactionJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -265,7 +266,7 @@ def sendReactionViaServer(base_dir: str, session,
|
|||
def sendUndoReactionViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, reactionUrl: str,
|
||||
http_prefix: str, reactionUrl: str,
|
||||
emojiContent: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
|
@ -278,7 +279,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
|
||||
newUndoReactionJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -292,10 +293,10 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
|||
}
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, httpPrefix,
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -318,7 +319,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
72625)
|
||||
|
||||
|
@ -339,7 +340,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(httpPrefix, fromDomainFull,
|
||||
postResult = postJson(http_prefix, fromDomainFull,
|
||||
session, newUndoReactionJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -354,7 +355,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
|||
|
||||
|
||||
def outboxReaction(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When a reaction request is received by the outbox from c2s
|
||||
|
@ -398,7 +399,7 @@ def outboxReaction(recentPostsCache: {},
|
|||
|
||||
|
||||
def outboxUndoReaction(recentPostsCache: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When an undo reaction request is received by the outbox from c2s
|
||||
|
|
|
@ -97,7 +97,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
|
|||
httpd.translate,
|
||||
postJsonObject, nickname,
|
||||
httpd, base_dir,
|
||||
httpd.httpPrefix,
|
||||
httpd.http_prefix,
|
||||
httpd.domain,
|
||||
httpd.domainFull,
|
||||
httpd.onionDomain,
|
||||
|
|
26
session.py
26
session.py
|
@ -55,7 +55,7 @@ def createSession(proxyType: str):
|
|||
|
||||
|
||||
def urlExists(session, url: str, timeoutSec: int = 3,
|
||||
httpPrefix: str = 'https', domain: str = 'testdomain') -> bool:
|
||||
http_prefix: str = 'https', domain: str = 'testdomain') -> bool:
|
||||
if not isinstance(url, str):
|
||||
print('url: ' + str(url))
|
||||
print('ERROR: urlExists failed, url should be a string')
|
||||
|
@ -65,7 +65,7 @@ def urlExists(session, url: str, timeoutSec: int = 3,
|
|||
sessionHeaders['User-Agent'] = 'Epicyon/' + __version__
|
||||
if domain:
|
||||
sessionHeaders['User-Agent'] += \
|
||||
'; +' + httpPrefix + '://' + domain + '/'
|
||||
'; +' + http_prefix + '://' + domain + '/'
|
||||
if not session:
|
||||
print('WARN: urlExists failed, no session specified')
|
||||
return True
|
||||
|
@ -148,7 +148,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
if '://' not in url:
|
||||
print('Invalid url: ' + url)
|
||||
return None
|
||||
httpPrefix = url.split('://')[0]
|
||||
http_prefix = url.split('://')[0]
|
||||
toDomainFull = url.split('://')[1]
|
||||
if '/' in toDomainFull:
|
||||
toDomainFull = toDomainFull.split('/')[0]
|
||||
|
@ -158,7 +158,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
port = domainFull.split(':')[1]
|
||||
else:
|
||||
domain = domainFull
|
||||
if httpPrefix == 'https':
|
||||
if http_prefix == 'https':
|
||||
port = 443
|
||||
else:
|
||||
port = 80
|
||||
|
@ -168,7 +168,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
toPort = toDomainFull.split(':')[1]
|
||||
else:
|
||||
toDomain = toDomainFull
|
||||
if httpPrefix == 'https':
|
||||
if http_prefix == 'https':
|
||||
toPort = 443
|
||||
else:
|
||||
toPort = 80
|
||||
|
@ -177,7 +177,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
print('Signed GET domain: ' + domain + ' ' + str(port))
|
||||
print('Signed GET toDomain: ' + toDomain + ' ' + str(toPort))
|
||||
print('Signed GET url: ' + url)
|
||||
print('Signed GET httpPrefix: ' + httpPrefix)
|
||||
print('Signed GET http_prefix: ' + http_prefix)
|
||||
messageStr = ''
|
||||
withDigest = False
|
||||
if toDomainFull + '/' in url:
|
||||
|
@ -189,7 +189,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
contentType = sessionHeaders['Accept']
|
||||
signatureHeaderJson = \
|
||||
createSignedHeader(None, signingPrivateKeyPem, 'actor', domain, port,
|
||||
toDomain, toPort, path, httpPrefix, withDigest,
|
||||
toDomain, toPort, path, http_prefix, withDigest,
|
||||
messageStr, contentType)
|
||||
if debug:
|
||||
print('Signed GET signatureHeaderJson ' + str(signatureHeaderJson))
|
||||
|
@ -212,7 +212,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
|
||||
def getJson(signingPrivateKeyPem: str,
|
||||
session, url: str, headers: {}, params: {}, debug: bool,
|
||||
version: str = '1.2.0', httpPrefix: str = 'https',
|
||||
version: str = '1.2.0', http_prefix: str = 'https',
|
||||
domain: str = 'testdomain',
|
||||
timeoutSec: int = 20, quiet: bool = False) -> {}:
|
||||
if not isinstance(url, str):
|
||||
|
@ -229,7 +229,7 @@ def getJson(signingPrivateKeyPem: str,
|
|||
sessionHeaders['User-Agent'] = 'Epicyon/' + version
|
||||
if domain:
|
||||
sessionHeaders['User-Agent'] += \
|
||||
'; +' + httpPrefix + '://' + domain + '/'
|
||||
'; +' + http_prefix + '://' + domain + '/'
|
||||
if not session:
|
||||
if not quiet:
|
||||
print('WARN: getJson failed, no session specified for getJson')
|
||||
|
@ -251,7 +251,7 @@ def getJson(signingPrivateKeyPem: str,
|
|||
|
||||
def downloadHtml(signingPrivateKeyPem: str,
|
||||
session, url: str, headers: {}, params: {}, debug: bool,
|
||||
version: str = '1.2.0', httpPrefix: str = 'https',
|
||||
version: str = '1.2.0', http_prefix: str = 'https',
|
||||
domain: str = 'testdomain',
|
||||
timeoutSec: int = 20, quiet: bool = False) -> {}:
|
||||
if not isinstance(url, str):
|
||||
|
@ -269,7 +269,7 @@ def downloadHtml(signingPrivateKeyPem: str,
|
|||
sessionHeaders['User-Agent'] = 'Epicyon/' + version
|
||||
if domain:
|
||||
sessionHeaders['User-Agent'] += \
|
||||
'; +' + httpPrefix + '://' + domain + '/'
|
||||
'; +' + http_prefix + '://' + domain + '/'
|
||||
if not session:
|
||||
if not quiet:
|
||||
print('WARN: downloadHtml failed, ' +
|
||||
|
@ -290,7 +290,7 @@ def downloadHtml(signingPrivateKeyPem: str,
|
|||
None, quiet, debug, False)
|
||||
|
||||
|
||||
def postJson(httpPrefix: str, domainFull: str,
|
||||
def postJson(http_prefix: str, domainFull: str,
|
||||
session, postJsonObject: {}, federationList: [],
|
||||
inboxUrl: str, headers: {}, timeoutSec: int = 60,
|
||||
quiet: bool = False) -> str:
|
||||
|
@ -305,7 +305,7 @@ def postJson(httpPrefix: str, domainFull: str,
|
|||
sessionHeaders = headers
|
||||
sessionHeaders['User-Agent'] = 'Epicyon/' + __version__
|
||||
sessionHeaders['User-Agent'] += \
|
||||
'; +' + httpPrefix + '://' + domainFull + '/'
|
||||
'; +' + http_prefix + '://' + domainFull + '/'
|
||||
|
||||
try:
|
||||
postResult = \
|
||||
|
|
137
shares.py
137
shares.py
|
@ -48,7 +48,7 @@ from blocking import isBlocked
|
|||
|
||||
def _loadDfcIds(base_dir: str, systemLanguage: str,
|
||||
productType: str,
|
||||
httpPrefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
"""Loads the product types ontology
|
||||
This is used to add an id to shared items
|
||||
"""
|
||||
|
@ -95,7 +95,7 @@ def _loadDfcIds(base_dir: str, systemLanguage: str,
|
|||
if label['@language'] == systemLanguage:
|
||||
itemId = \
|
||||
item['@id'].replace('http://static.datafoodconsortium.org',
|
||||
httpPrefix + '://' + domainFull)
|
||||
http_prefix + '://' + domainFull)
|
||||
dfcIds[label['@value'].lower()] = itemId
|
||||
break
|
||||
return dfcIds
|
||||
|
@ -120,7 +120,7 @@ def _getValidSharedItemID(actor: str, displayName: str) -> str:
|
|||
|
||||
def removeSharedItem(base_dir: str, nickname: str, domain: str,
|
||||
itemID: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
sharesFileType: str) -> None:
|
||||
"""Removes a share for a person
|
||||
"""
|
||||
|
@ -202,7 +202,7 @@ def _dfcProductTypeFromCategory(base_dir: str,
|
|||
def _getshareDfcId(base_dir: str, systemLanguage: str,
|
||||
itemType: str, itemCategory: str,
|
||||
translate: {},
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
dfcIds: {} = None) -> str:
|
||||
"""Attempts to obtain a DFC Id for the shared item,
|
||||
based upon productTypes ontology.
|
||||
|
@ -218,7 +218,7 @@ def _getshareDfcId(base_dir: str, systemLanguage: str,
|
|||
return 'epicyon#' + itemType
|
||||
if not dfcIds:
|
||||
dfcIds = _loadDfcIds(base_dir, systemLanguage, matchedProductType,
|
||||
httpPrefix, domainFull)
|
||||
http_prefix, domainFull)
|
||||
if not dfcIds:
|
||||
return ''
|
||||
itemTypeLower = itemType.lower()
|
||||
|
@ -264,7 +264,7 @@ def _getshareTypeFromDfcId(dfcUri: str, dfcIds: {}) -> str:
|
|||
return None
|
||||
|
||||
|
||||
def _indicateNewShareAvailable(base_dir: str, httpPrefix: str,
|
||||
def _indicateNewShareAvailable(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, sharesFileType: str) -> None:
|
||||
"""Indicate to each account that a new share is available
|
||||
|
@ -286,7 +286,8 @@ def _indicateNewShareAvailable(base_dir: str, httpPrefix: str,
|
|||
if isBlocked(base_dir, accountNickname, domain,
|
||||
nickname, domain, None):
|
||||
continue
|
||||
localActor = localActorUrl(httpPrefix, accountNickname, domainFull)
|
||||
localActor = \
|
||||
localActorUrl(http_prefix, accountNickname, domainFull)
|
||||
try:
|
||||
with open(newShareFile, 'w+') as fp:
|
||||
if sharesFileType == 'shares':
|
||||
|
@ -300,7 +301,7 @@ def _indicateNewShareAvailable(base_dir: str, httpPrefix: str,
|
|||
|
||||
|
||||
def addShare(base_dir: str,
|
||||
httpPrefix: str, nickname: str, domain: str, port: int,
|
||||
http_prefix: str, nickname: str, domain: str, port: int,
|
||||
displayName: str, summary: str, imageFilename: str,
|
||||
itemQty: float, itemType: str, itemCategory: str, location: str,
|
||||
duration: str, debug: bool, city: str,
|
||||
|
@ -326,11 +327,11 @@ def addShare(base_dir: str,
|
|||
durationSec = _addShareDurationSec(duration, published)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
itemID = _getValidSharedItemID(actor, displayName)
|
||||
dfcId = _getshareDfcId(base_dir, systemLanguage,
|
||||
itemType, itemCategory, translate,
|
||||
httpPrefix, domainFull)
|
||||
http_prefix, domainFull)
|
||||
|
||||
# has an image for this share been uploaded?
|
||||
imageUrl = None
|
||||
|
@ -370,7 +371,7 @@ def addShare(base_dir: str,
|
|||
print('EX: addShare unable to delete ' +
|
||||
str(imageFilename))
|
||||
imageUrl = \
|
||||
httpPrefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domainFull + \
|
||||
'/sharefiles/' + nickname + '/' + itemID + '.' + ext
|
||||
|
||||
sharesJson[itemID] = {
|
||||
|
@ -390,7 +391,7 @@ def addShare(base_dir: str,
|
|||
|
||||
saveJson(sharesJson, sharesFilename)
|
||||
|
||||
_indicateNewShareAvailable(base_dir, httpPrefix,
|
||||
_indicateNewShareAvailable(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
sharesFileType)
|
||||
|
||||
|
@ -447,7 +448,7 @@ def _expireSharesForAccount(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
def getSharesFeedForPerson(base_dir: str,
|
||||
domain: str, port: int,
|
||||
path: str, httpPrefix: str,
|
||||
path: str, http_prefix: str,
|
||||
sharesFileType: str,
|
||||
sharesPerPage: int) -> {}:
|
||||
"""Returns the shares for an account from GET requests
|
||||
|
@ -498,7 +499,7 @@ def getSharesFeedForPerson(base_dir: str,
|
|||
sharesJson = loadJson(sharesFilename)
|
||||
if sharesJson:
|
||||
noOfShares = len(sharesJson.items())
|
||||
idStr = localActorUrl(httpPrefix, nickname, domain)
|
||||
idStr = localActorUrl(http_prefix, nickname, domain)
|
||||
shares = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': idStr + '/' + sharesFileType + '?page=1',
|
||||
|
@ -512,7 +513,7 @@ def getSharesFeedForPerson(base_dir: str,
|
|||
pageNumber = 1
|
||||
|
||||
nextPageNumber = int(pageNumber + 1)
|
||||
idStr = localActorUrl(httpPrefix, nickname, domain)
|
||||
idStr = localActorUrl(http_prefix, nickname, domain)
|
||||
shares = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': idStr + '/' + sharesFileType + '?page=' + str(pageNumber),
|
||||
|
@ -545,7 +546,7 @@ def getSharesFeedForPerson(base_dir: str,
|
|||
lastPage = 1
|
||||
if nextPageNumber > lastPage:
|
||||
shares['next'] = \
|
||||
localActorUrl(httpPrefix, nickname, domain) + \
|
||||
localActorUrl(http_prefix, nickname, domain) + \
|
||||
'/' + sharesFileType + '?page=' + str(lastPage)
|
||||
return shares
|
||||
|
||||
|
@ -553,7 +554,7 @@ def getSharesFeedForPerson(base_dir: str,
|
|||
def sendShareViaServer(base_dir, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, displayName: str,
|
||||
http_prefix: str, displayName: str,
|
||||
summary: str, imageFilename: str,
|
||||
itemQty: float, itemType: str, itemCategory: str,
|
||||
location: str, duration: str,
|
||||
|
@ -577,7 +578,7 @@ def sendShareViaServer(base_dir, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -604,11 +605,11 @@ def sendShareViaServer(base_dir, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix,
|
||||
webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -630,7 +631,7 @@ def sendShareViaServer(base_dir, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
83653)
|
||||
|
||||
|
@ -662,7 +663,7 @@ def sendShareViaServer(base_dir, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, newShareJson, [], inboxUrl, headers, 30, True)
|
||||
if not postResult:
|
||||
if debug:
|
||||
|
@ -678,7 +679,7 @@ def sendShareViaServer(base_dir, session,
|
|||
def sendUndoShareViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, displayName: str,
|
||||
http_prefix: str, displayName: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -690,7 +691,7 @@ def sendUndoShareViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -709,11 +710,11 @@ def sendUndoShareViaServer(base_dir: str, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -734,7 +735,7 @@ def sendUndoShareViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
12663)
|
||||
|
||||
|
@ -756,7 +757,7 @@ def sendUndoShareViaServer(base_dir: str, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, undoShareJson, [], inboxUrl,
|
||||
headers, 30, True)
|
||||
if not postResult:
|
||||
|
@ -773,7 +774,7 @@ def sendUndoShareViaServer(base_dir: str, session,
|
|||
def sendWantedViaServer(base_dir, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, displayName: str,
|
||||
http_prefix: str, displayName: str,
|
||||
summary: str, imageFilename: str,
|
||||
itemQty: float, itemType: str, itemCategory: str,
|
||||
location: str, duration: str,
|
||||
|
@ -797,7 +798,7 @@ def sendWantedViaServer(base_dir, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -824,11 +825,11 @@ def sendWantedViaServer(base_dir, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix,
|
||||
webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -850,7 +851,7 @@ def sendWantedViaServer(base_dir, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
23653)
|
||||
|
||||
|
@ -882,7 +883,7 @@ def sendWantedViaServer(base_dir, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, newShareJson, [], inboxUrl, headers, 30, True)
|
||||
if not postResult:
|
||||
if debug:
|
||||
|
@ -898,7 +899,7 @@ def sendWantedViaServer(base_dir, session,
|
|||
def sendUndoWantedViaServer(base_dir: str, session,
|
||||
fromNickname: str, password: str,
|
||||
fromDomain: str, fromPort: int,
|
||||
httpPrefix: str, displayName: str,
|
||||
http_prefix: str, displayName: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
|
@ -910,7 +911,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
|||
|
||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||
|
||||
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -929,11 +930,11 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
handle = http_prefix + '://' + fromDomainFull + '/@' + fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix, cachedWebfingers,
|
||||
webfingerHandle(session, handle, http_prefix, cachedWebfingers,
|
||||
fromDomain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
if not wfRequest:
|
||||
|
@ -954,7 +955,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, fromNickname,
|
||||
http_prefix, fromNickname,
|
||||
fromDomain, postToBox,
|
||||
12693)
|
||||
|
||||
|
@ -976,7 +977,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, fromDomainFull,
|
||||
postJson(http_prefix, fromDomainFull,
|
||||
session, undoShareJson, [], inboxUrl,
|
||||
headers, 30, True)
|
||||
if not postResult:
|
||||
|
@ -993,7 +994,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
|||
def getSharedItemsCatalogViaServer(base_dir, session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, debug: bool,
|
||||
http_prefix: str, debug: bool,
|
||||
signingPrivateKeyPem: str) -> {}:
|
||||
"""Returns the shared items catalog via c2s
|
||||
"""
|
||||
|
@ -1010,11 +1011,11 @@ def getSharedItemsCatalogViaServer(base_dir, session,
|
|||
'Accept': 'application/json'
|
||||
}
|
||||
domainFull = getFullDomain(domain, port)
|
||||
url = localActorUrl(httpPrefix, nickname, domainFull) + '/catalog'
|
||||
url = localActorUrl(http_prefix, nickname, domainFull) + '/catalog'
|
||||
if debug:
|
||||
print('Shared items catalog request to: ' + url)
|
||||
catalogJson = getJson(signingPrivateKeyPem, session, url, headers, None,
|
||||
debug, __version__, httpPrefix, None)
|
||||
debug, __version__, http_prefix, None)
|
||||
if not catalogJson:
|
||||
if debug:
|
||||
print('DEBUG: GET shared items catalog failed for c2s to ' + url)
|
||||
|
@ -1026,7 +1027,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
|
|||
return catalogJson
|
||||
|
||||
|
||||
def outboxShareUpload(base_dir: str, httpPrefix: str,
|
||||
def outboxShareUpload(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool, city: str,
|
||||
systemLanguage: str, translate: {},
|
||||
|
@ -1080,7 +1081,7 @@ def outboxShareUpload(base_dir: str, httpPrefix: str,
|
|||
pprint(messageJson)
|
||||
|
||||
addShare(base_dir,
|
||||
httpPrefix, nickname, domain, port,
|
||||
http_prefix, nickname, domain, port,
|
||||
messageJson['object']['displayName'],
|
||||
messageJson['object']['summary'],
|
||||
imageFilename,
|
||||
|
@ -1098,7 +1099,7 @@ def outboxShareUpload(base_dir: str, httpPrefix: str,
|
|||
print('DEBUG: shared item received via c2s')
|
||||
|
||||
|
||||
def outboxUndoShareUpload(base_dir: str, httpPrefix: str,
|
||||
def outboxUndoShareUpload(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
messageJson: {}, debug: bool) -> None:
|
||||
""" When a shared item is removed via c2s
|
||||
|
@ -1120,7 +1121,7 @@ def outboxUndoShareUpload(base_dir: str, httpPrefix: str,
|
|||
domainFull = getFullDomain(domain, port)
|
||||
removeSharedItem(base_dir, nickname, domain,
|
||||
messageJson['object']['displayName'],
|
||||
httpPrefix, domainFull, 'shares')
|
||||
http_prefix, domainFull, 'shares')
|
||||
if debug:
|
||||
print('DEBUG: shared item removed via c2s')
|
||||
|
||||
|
@ -1156,7 +1157,7 @@ def _sharesCatalogParams(path: str) -> (bool, float, float, str):
|
|||
return today, minPrice, maxPrice, matchPattern
|
||||
|
||||
|
||||
def sharesCatalogAccountEndpoint(base_dir: str, httpPrefix: str,
|
||||
def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
path: str, debug: bool,
|
||||
|
@ -1167,11 +1168,11 @@ def sharesCatalogAccountEndpoint(base_dir: str, httpPrefix: str,
|
|||
"""
|
||||
today, minPrice, maxPrice, matchPattern = _sharesCatalogParams(path)
|
||||
dfcUrl = \
|
||||
httpPrefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
http_prefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
dfcPtUrl = \
|
||||
httpPrefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domainFull + \
|
||||
'/ontologies/DFC_ProductGlossary.rdf#'
|
||||
owner = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
owner = localActorUrl(http_prefix, nickname, domainFull)
|
||||
if sharesFileType == 'shares':
|
||||
dfcInstanceId = owner + '/catalog'
|
||||
else:
|
||||
|
@ -1248,7 +1249,7 @@ def sharesCatalogAccountEndpoint(base_dir: str, httpPrefix: str,
|
|||
return endpoint
|
||||
|
||||
|
||||
def sharesCatalogEndpoint(base_dir: str, httpPrefix: str,
|
||||
def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
||||
domainFull: str,
|
||||
path: str, sharesFileType: str) -> {}:
|
||||
"""Returns the endpoint for the shares catalog for the instance
|
||||
|
@ -1257,11 +1258,11 @@ def sharesCatalogEndpoint(base_dir: str, httpPrefix: str,
|
|||
"""
|
||||
today, minPrice, maxPrice, matchPattern = _sharesCatalogParams(path)
|
||||
dfcUrl = \
|
||||
httpPrefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
http_prefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
dfcPtUrl = \
|
||||
httpPrefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domainFull + \
|
||||
'/ontologies/DFC_ProductGlossary.rdf#'
|
||||
dfcInstanceId = httpPrefix + '://' + domainFull + '/catalog'
|
||||
dfcInstanceId = http_prefix + '://' + domainFull + '/catalog'
|
||||
endpoint = {
|
||||
"@context": {
|
||||
"DFC": dfcUrl,
|
||||
|
@ -1282,7 +1283,7 @@ def sharesCatalogEndpoint(base_dir: str, httpPrefix: str,
|
|||
continue
|
||||
nickname = acct.split('@')[0]
|
||||
domain = acct.split('@')[1]
|
||||
owner = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
owner = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
sharesFilename = \
|
||||
acctDir(base_dir, nickname, domain) + '/' + \
|
||||
|
@ -1337,13 +1338,13 @@ def sharesCatalogEndpoint(base_dir: str, httpPrefix: str,
|
|||
return endpoint
|
||||
|
||||
|
||||
def sharesCatalogCSVEndpoint(base_dir: str, httpPrefix: str,
|
||||
def sharesCatalogCSVEndpoint(base_dir: str, http_prefix: str,
|
||||
domainFull: str,
|
||||
path: str, sharesFileType: str) -> str:
|
||||
"""Returns a CSV version of the shares catalog
|
||||
"""
|
||||
catalogJson = \
|
||||
sharesCatalogEndpoint(base_dir, httpPrefix, domainFull, path,
|
||||
sharesCatalogEndpoint(base_dir, http_prefix, domainFull, path,
|
||||
sharesFileType)
|
||||
if not catalogJson:
|
||||
return ''
|
||||
|
@ -1540,7 +1541,7 @@ def authorizeSharedItems(sharedItemsFederatedDomains: [],
|
|||
|
||||
def _updateFederatedSharesCache(session, sharedItemsFederatedDomains: [],
|
||||
base_dir: str, domainFull: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
tokensJson: {}, debug: bool,
|
||||
systemLanguage: str,
|
||||
sharesFileType: str) -> None:
|
||||
|
@ -1572,15 +1573,15 @@ def _updateFederatedSharesCache(session, sharedItemsFederatedDomains: [],
|
|||
if not tokensJson.get(federatedDomainFull):
|
||||
# token has been obtained for the other domain
|
||||
continue
|
||||
if not siteIsActive(httpPrefix + '://' + federatedDomainFull, 10):
|
||||
if not siteIsActive(http_prefix + '://' + federatedDomainFull, 10):
|
||||
continue
|
||||
if sharesFileType == 'shares':
|
||||
url = httpPrefix + '://' + federatedDomainFull + '/catalog'
|
||||
url = http_prefix + '://' + federatedDomainFull + '/catalog'
|
||||
else:
|
||||
url = httpPrefix + '://' + federatedDomainFull + '/wantedItems'
|
||||
url = http_prefix + '://' + federatedDomainFull + '/wantedItems'
|
||||
asHeader['Authorization'] = tokensJson[federatedDomainFull]
|
||||
catalogJson = getJson(session, url, asHeader, None,
|
||||
debug, __version__, httpPrefix, None)
|
||||
debug, __version__, http_prefix, None)
|
||||
if not catalogJson:
|
||||
print('WARN: failed to download shared items catalog for ' +
|
||||
federatedDomainFull)
|
||||
|
@ -1590,7 +1591,7 @@ def _updateFederatedSharesCache(session, sharedItemsFederatedDomains: [],
|
|||
print('Downloaded shared items catalog for ' + federatedDomainFull)
|
||||
sharesJson = _dfcToSharesFormat(catalogJson,
|
||||
base_dir, systemLanguage,
|
||||
httpPrefix, domainFull)
|
||||
http_prefix, domainFull)
|
||||
if sharesJson:
|
||||
sharesFilename = \
|
||||
catalogsDir + '/' + federatedDomainFull + '.' + \
|
||||
|
@ -1695,7 +1696,7 @@ def _regenerateSharesToken(base_dir: str, domainFull: str,
|
|||
base_dir)
|
||||
|
||||
|
||||
def runFederatedSharesDaemon(base_dir: str, httpd, httpPrefix: str,
|
||||
def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
|
||||
domainFull: str, proxyType: str, debug: bool,
|
||||
systemLanguage: str) -> None:
|
||||
"""Runs the daemon used to update federated shared items
|
||||
|
@ -1742,7 +1743,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, httpPrefix: str,
|
|||
session = createSession(proxyType)
|
||||
for sharesFileType in getSharesFilesList():
|
||||
_updateFederatedSharesCache(session, sharedItemsFederatedDomains,
|
||||
base_dir, domainFull, httpPrefix,
|
||||
base_dir, domainFull, http_prefix,
|
||||
tokensJson, debug, systemLanguage,
|
||||
sharesFileType)
|
||||
time.sleep(secondsPerHour * 6)
|
||||
|
@ -1750,7 +1751,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, httpPrefix: str,
|
|||
|
||||
def _dfcToSharesFormat(catalogJson: {},
|
||||
base_dir: str, systemLanguage: str,
|
||||
httpPrefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
"""Converts DFC format into the internal formal used to store shared items.
|
||||
This simplifies subsequent search and display
|
||||
"""
|
||||
|
@ -1763,7 +1764,7 @@ def _dfcToSharesFormat(catalogJson: {},
|
|||
for productType in productTypesList:
|
||||
dfcIds[productType] = \
|
||||
_loadDfcIds(base_dir, systemLanguage, productType,
|
||||
httpPrefix, domainFull)
|
||||
http_prefix, domainFull)
|
||||
|
||||
currTime = int(time.time())
|
||||
for item in catalogJson['DFC:supplies']:
|
||||
|
|
12
skills.py
12
skills.py
|
@ -174,7 +174,7 @@ def outboxSkills(base_dir: str, nickname: str, messageJson: {},
|
|||
|
||||
def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
skill: str, skillLevelPercent: int,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
debug: bool, projectVersion: str,
|
||||
|
@ -187,7 +187,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
toUrl = actor
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -204,11 +204,11 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = httpPrefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix,
|
||||
webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -230,7 +230,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, nickname, domain,
|
||||
http_prefix, nickname, domain,
|
||||
postToBox, 76121)
|
||||
|
||||
if not inboxUrl:
|
||||
|
@ -251,7 +251,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(httpPrefix, domainFull,
|
||||
postJson(http_prefix, domainFull,
|
||||
session, newSkillJson, [], inboxUrl,
|
||||
headers, 30, True)
|
||||
if not postResult:
|
||||
|
|
10
socnet.py
10
socnet.py
|
@ -16,7 +16,7 @@ from utils import getFullDomain
|
|||
|
||||
def instancesGraph(base_dir: str, handles: str,
|
||||
proxyType: str,
|
||||
port: int, httpPrefix: str,
|
||||
port: int, http_prefix: str,
|
||||
debug: bool, projectVersion: str,
|
||||
systemLanguage: str, signingPrivateKeyPem: str) -> str:
|
||||
""" Returns a dot graph of federating instances
|
||||
|
@ -50,9 +50,9 @@ def instancesGraph(base_dir: str, handles: str,
|
|||
domain = handle.split('@')[1]
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
handle = httpPrefix + "://" + domainFull + "/@" + nickname
|
||||
handle = http_prefix + "://" + domainFull + "/@" + nickname
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, httpPrefix,
|
||||
webfingerHandle(session, handle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, projectVersion, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -69,7 +69,7 @@ def instancesGraph(base_dir: str, handles: str,
|
|||
originDomain,
|
||||
base_dir, session, wfRequest,
|
||||
personCache,
|
||||
projectVersion, httpPrefix,
|
||||
projectVersion, http_prefix,
|
||||
nickname, domain, 'outbox',
|
||||
27261)
|
||||
wordFrequency = {}
|
||||
|
@ -77,7 +77,7 @@ def instancesGraph(base_dir: str, handles: str,
|
|||
getPostDomains(session, personUrl, 64, maxMentions, maxEmoji,
|
||||
maxAttachments, federationList,
|
||||
personCache, debug,
|
||||
projectVersion, httpPrefix, domain,
|
||||
projectVersion, http_prefix, domain,
|
||||
wordFrequency, [], systemLanguage,
|
||||
signingPrivateKeyPem)
|
||||
postDomains.sort()
|
||||
|
|
|
@ -402,7 +402,7 @@ def speakableText(base_dir: str, content: str, translate: {}) -> (str, []):
|
|||
return sayContent.replace(' . ', '. ').strip(), detectedLinks
|
||||
|
||||
|
||||
def _postToSpeakerJson(base_dir: str, httpPrefix: str,
|
||||
def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {}, personCache: {},
|
||||
translate: {}, announcingActor: str,
|
||||
|
@ -454,7 +454,7 @@ def _postToSpeakerJson(base_dir: str, httpPrefix: str,
|
|||
img['name'] + '. '
|
||||
|
||||
isDirect = isDM(postJsonObject)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
replyToYou = isReply(postJsonObject, actor)
|
||||
|
||||
published = ''
|
||||
|
@ -533,7 +533,7 @@ def _postToSpeakerJson(base_dir: str, httpPrefix: str,
|
|||
isDirect, replyToYou)
|
||||
|
||||
|
||||
def updateSpeaker(base_dir: str, httpPrefix: str,
|
||||
def updateSpeaker(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
postJsonObject: {}, personCache: {},
|
||||
translate: {}, announcingActor: str,
|
||||
|
@ -542,7 +542,7 @@ def updateSpeaker(base_dir: str, httpPrefix: str,
|
|||
of incoming inbox posts
|
||||
"""
|
||||
speakerJson = \
|
||||
_postToSpeakerJson(base_dir, httpPrefix,
|
||||
_postToSpeakerJson(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject, personCache,
|
||||
translate, announcingActor,
|
||||
|
|
246
tests.py
246
tests.py
|
@ -185,7 +185,7 @@ thrEve = None
|
|||
|
||||
def _testHttpSignedGET(base_dir: str):
|
||||
print('testHttpSignedGET')
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
debug = True
|
||||
|
||||
boxpath = "/users/Actor"
|
||||
|
@ -240,12 +240,12 @@ def _testHttpSignedGET(base_dir: str):
|
|||
messageBodyDigest = None
|
||||
messageBodyJsonStr = ''
|
||||
noRecencyCheck = True
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, messageBodyDigest,
|
||||
messageBodyJsonStr, debug, noRecencyCheck)
|
||||
# Change a single character and the signature should fail
|
||||
headers['date'] = headers['date'].replace(':10', ':11')
|
||||
assert not verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert not verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, messageBodyDigest,
|
||||
messageBodyJsonStr, debug, noRecencyCheck)
|
||||
|
||||
|
@ -258,13 +258,13 @@ def _testHttpSignedGET(base_dir: str):
|
|||
nickname = 'testactor'
|
||||
hostDomain = 'someother.instance'
|
||||
domain = 'argumentative.social'
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 443
|
||||
withDigest = False
|
||||
password = 'SuperSecretPassword'
|
||||
noRecencyCheck = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix,
|
||||
createPerson(path, nickname, domain, port, http_prefix,
|
||||
False, False, password)
|
||||
assert privateKeyPem
|
||||
assert publicKeyPem
|
||||
|
@ -287,12 +287,12 @@ def _testHttpSignedGET(base_dir: str):
|
|||
privateKeyPem, nickname,
|
||||
domain, port,
|
||||
hostDomain, port,
|
||||
boxpath, httpPrefix, False,
|
||||
boxpath, http_prefix, False,
|
||||
None, accept)
|
||||
|
||||
headers['signature'] = signatureHeader['signature']
|
||||
GETmethod = not withDigest
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, debug, noRecencyCheck)
|
||||
if os.path.isdir(path):
|
||||
|
@ -395,7 +395,7 @@ def _testSignAndVerify() -> None:
|
|||
|
||||
def _testHttpSigNew(algorithm: str, digestAlgorithm: str):
|
||||
print('testHttpSigNew')
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 443
|
||||
debug = True
|
||||
messageBodyJson = {"hello": "world"}
|
||||
|
@ -489,7 +489,7 @@ def _testHttpSigNew(algorithm: str, digestAlgorithm: str):
|
|||
signPostHeadersNew(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
domain, port,
|
||||
pathStr, httpPrefix, messageBodyJsonStr,
|
||||
pathStr, http_prefix, messageBodyJsonStr,
|
||||
algorithm, digestAlgorithm, debug)
|
||||
print('signatureIndexHeader1: ' + str(signatureIndexHeader))
|
||||
print('signatureHeader1: ' + str(signatureHeader))
|
||||
|
@ -511,14 +511,14 @@ def _testHttpSigNew(algorithm: str, digestAlgorithm: str):
|
|||
headers['path'] = pathStr
|
||||
headers['signature'] = sig
|
||||
headers['signature-input'] = sigInput
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
pathStr, False, None,
|
||||
messageBodyJsonStr, debug, True)
|
||||
|
||||
# make a deliberate mistake
|
||||
debug = False
|
||||
headers['signature'] = headers['signature'].replace('V', 'B')
|
||||
assert not verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert not verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
pathStr, False, None,
|
||||
messageBodyJsonStr, debug, True)
|
||||
|
||||
|
@ -538,11 +538,11 @@ def _testHttpsigBase(withDigest: bool, base_dir: str):
|
|||
nickname = 'socrates'
|
||||
hostDomain = 'someother.instance'
|
||||
domain = 'argumentative.social'
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 5576
|
||||
password = 'SuperSecretPassword'
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix,
|
||||
createPerson(path, nickname, domain, port, http_prefix,
|
||||
False, False, password)
|
||||
assert privateKeyPem
|
||||
if withDigest:
|
||||
|
@ -569,7 +569,7 @@ def _testHttpsigBase(withDigest: bool, base_dir: str):
|
|||
signPostHeaders(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
hostDomain, port,
|
||||
boxpath, httpPrefix, None, contentType,
|
||||
boxpath, http_prefix, None, contentType,
|
||||
algorithm, None)
|
||||
else:
|
||||
digestPrefix = getDigestPrefix(digestAlgorithm)
|
||||
|
@ -587,25 +587,25 @@ def _testHttpsigBase(withDigest: bool, base_dir: str):
|
|||
signPostHeaders(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
hostDomain, port,
|
||||
boxpath, httpPrefix, messageBodyJsonStr,
|
||||
boxpath, http_prefix, messageBodyJsonStr,
|
||||
contentType, algorithm, digestAlgorithm)
|
||||
|
||||
headers['signature'] = signatureHeader
|
||||
GETmethod = not withDigest
|
||||
debug = True
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, debug)
|
||||
if withDigest:
|
||||
# everything correct except for content-length
|
||||
headers['content-length'] = str(contentLength + 2)
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, False) is False
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
'/parambulator' + boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, False) is False
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, not GETmethod, None,
|
||||
messageBodyJsonStr, False) is False
|
||||
if not withDigest:
|
||||
|
@ -632,7 +632,7 @@ def _testHttpsigBase(withDigest: bool, base_dir: str):
|
|||
}
|
||||
assert getDigestAlgorithmFromHeaders(headers) == digestAlgorithm
|
||||
headers['signature'] = signatureHeader
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, not GETmethod, None,
|
||||
messageBodyJsonStr, False) is False
|
||||
|
||||
|
@ -690,7 +690,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
sharedItemsFederatedDomains = []
|
||||
systemLanguage = 'en'
|
||||
nickname = 'alice'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
password = 'alicepass'
|
||||
maxReplies = 64
|
||||
|
@ -699,7 +699,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
allowDeletion = True
|
||||
lowBandwidth = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(path, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
deleteAllPosts(path, nickname, domain, 'inbox')
|
||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||
|
@ -729,7 +729,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
testIsArticle = False
|
||||
conversationId = None
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"No wise fish would go anywhere without a porpoise",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -743,7 +743,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, systemLanguage, conversationId,
|
||||
lowBandwidth, contentLicenseUrl)
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"Curiouser and curiouser!",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -757,7 +757,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, systemLanguage, conversationId,
|
||||
lowBandwidth, contentLicenseUrl)
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"In the gardens of memory, in the palace " +
|
||||
"of dreams, that is where you and I shall meet",
|
||||
testFollowersOnly,
|
||||
|
@ -815,7 +815,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
httpPrefix, federationList, maxMentions, maxEmoji, False,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
allowDeletion, True, True, False, sendThreads,
|
||||
|
@ -834,7 +834,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
sharedItemsFederatedDomains = []
|
||||
systemLanguage = 'en'
|
||||
nickname = 'bob'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
clientToServer = False
|
||||
password = 'bobpass'
|
||||
|
@ -844,7 +844,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
allowDeletion = True
|
||||
lowBandwidth = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(path, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
deleteAllPosts(path, nickname, domain, 'inbox')
|
||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||
|
@ -871,7 +871,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
testIsArticle = False
|
||||
conversationId = None
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"It's your life, live it your way.",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -885,7 +885,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, systemLanguage, conversationId,
|
||||
lowBandwidth, contentLicenseUrl)
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"One of the things I've realised is that " +
|
||||
"I am very simple",
|
||||
testFollowersOnly,
|
||||
|
@ -900,7 +900,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, systemLanguage, conversationId,
|
||||
lowBandwidth, contentLicenseUrl)
|
||||
createPublicPost(path, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||
"Quantum physics is a bit of a passion of mine",
|
||||
testFollowersOnly,
|
||||
testSaveToFile,
|
||||
|
@ -957,7 +957,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
httpPrefix, federationList, maxMentions, maxEmoji, False,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
allowDeletion, True, True, False, sendThreads,
|
||||
|
@ -974,13 +974,13 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
os.chdir(path)
|
||||
sharedItemsFederatedDomains = []
|
||||
nickname = 'eve'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
password = 'evepass'
|
||||
maxReplies = 64
|
||||
allowDeletion = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(path, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
deleteAllPosts(path, nickname, domain, 'inbox')
|
||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||
|
@ -1027,7 +1027,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
httpPrefix, federationList, maxMentions, maxEmoji, False,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies, allowDeletion, True, True, False,
|
||||
sendThreads, False)
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
sharedItemsFederatedDomains = []
|
||||
# systemLanguage = 'en'
|
||||
nickname = 'testgroup'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
password = 'testgrouppass'
|
||||
maxReplies = 64
|
||||
|
@ -1052,7 +1052,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
accountMaxPostsPerDay = 1000
|
||||
allowDeletion = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createGroup(path, nickname, domain, port, httpPrefix, True,
|
||||
createGroup(path, nickname, domain, port, http_prefix, True,
|
||||
password)
|
||||
deleteAllPosts(path, nickname, domain, 'inbox')
|
||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||
|
@ -1099,7 +1099,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
httpPrefix, federationList, maxMentions, maxEmoji, False,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
allowDeletion, True, True, False, sendThreads,
|
||||
|
@ -1115,7 +1115,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
testServerBobRunning = False
|
||||
|
||||
systemLanguage = 'en'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
sendResult = \
|
||||
sendPost(signingPrivateKeyPem, __version__,
|
||||
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort, ccUrl, httpPrefix,
|
||||
'bob', bobDomain, bobPort, ccUrl, http_prefix,
|
||||
'Why is a mouse when it spins? ' +
|
||||
'यह एक परीक्षण है #sillyquestion',
|
||||
followersOnly,
|
||||
|
@ -1257,7 +1257,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
# check the id of the news actor
|
||||
print('News actor Id: ' + newsActorJson["id"])
|
||||
assert (newsActorJson["id"] ==
|
||||
httpPrefix + '://' + aliceAddress + '/users/news')
|
||||
http_prefix + '://' + aliceAddress + '/users/news')
|
||||
|
||||
# Image attachment created
|
||||
assert len([name for name in os.listdir(mediaPath)
|
||||
|
@ -1328,7 +1328,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
assert statusNumber > 0
|
||||
assert outboxPostFilename
|
||||
assert likePost({}, sessionBob, bobDir, federationList,
|
||||
'bob', bobDomain, bobPort, httpPrefix,
|
||||
'bob', bobDomain, bobPort, http_prefix,
|
||||
'alice', aliceDomain, alicePort, [],
|
||||
statusNumber, False, bobSendThreads, bobPostLog,
|
||||
bobPersonCache, bobCachedWebfingers,
|
||||
|
@ -1349,7 +1349,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
print("Bob reacts to Alice's post")
|
||||
|
||||
assert reactionPost({}, sessionBob, bobDir, federationList,
|
||||
'bob', bobDomain, bobPort, httpPrefix,
|
||||
'bob', bobDomain, bobPort, http_prefix,
|
||||
'alice', aliceDomain, alicePort, [],
|
||||
statusNumber, '😀',
|
||||
False, bobSendThreads, bobPostLog,
|
||||
|
@ -1370,7 +1370,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
print('\n\n*******************************************************')
|
||||
print("Bob repeats Alice's post")
|
||||
objectUrl = \
|
||||
httpPrefix + '://' + aliceDomain + ':' + str(alicePort) + \
|
||||
http_prefix + '://' + aliceDomain + ':' + str(alicePort) + \
|
||||
'/users/alice/statuses/' + str(statusNumber)
|
||||
inboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/inbox'
|
||||
outboxPath = bobDir + '/accounts/bob@' + bobDomain + '/outbox'
|
||||
|
@ -1385,7 +1385,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
|||
assert outboxBeforeAnnounceCount == 0
|
||||
assert beforeAnnounceCount == 0
|
||||
announcePublic(sessionBob, bobDir, federationList,
|
||||
'bob', bobDomain, bobPort, httpPrefix,
|
||||
'bob', bobDomain, bobPort, http_prefix,
|
||||
objectUrl,
|
||||
False, bobSendThreads, bobPostLog,
|
||||
bobPersonCache, bobCachedWebfingers,
|
||||
|
@ -1439,7 +1439,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
|||
testServerBobRunning = False
|
||||
|
||||
systemLanguage = 'en'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
federationList = []
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
@ -1523,13 +1523,13 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
|||
alicePersonCache = {}
|
||||
aliceCachedWebfingers = {}
|
||||
alicePostLog = []
|
||||
bobActor = httpPrefix + '://' + bobAddress + '/users/bob'
|
||||
bobActor = http_prefix + '://' + bobAddress + '/users/bob'
|
||||
signingPrivateKeyPem = None
|
||||
sendResult = \
|
||||
sendFollowRequest(sessionAlice, aliceDir,
|
||||
'alice', aliceDomain, alicePort, httpPrefix,
|
||||
'alice', aliceDomain, alicePort, http_prefix,
|
||||
'bob', bobDomain, bobActor,
|
||||
bobPort, httpPrefix,
|
||||
bobPort, http_prefix,
|
||||
clientToServer, federationList,
|
||||
aliceSendThreads, alicePostLog,
|
||||
aliceCachedWebfingers, alicePersonCache,
|
||||
|
@ -1575,7 +1575,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
|||
sendPost(signingPrivateKeyPem, __version__,
|
||||
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort, ccUrl,
|
||||
httpPrefix, 'Alice message', followersOnly, saveToFile,
|
||||
http_prefix, 'Alice message', followersOnly, saveToFile,
|
||||
clientToServer, True,
|
||||
None, None, None, city, federationList,
|
||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||
|
@ -1628,7 +1628,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
testServerBobRunning = False
|
||||
|
||||
systemLanguage = 'en'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
federationList = []
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
@ -1741,12 +1741,12 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
alicePersonCache = {}
|
||||
aliceCachedWebfingers = {}
|
||||
alicePostLog = []
|
||||
bobActor = httpPrefix + '://' + bobAddress + '/users/bob'
|
||||
bobActor = http_prefix + '://' + bobAddress + '/users/bob'
|
||||
sendResult = \
|
||||
sendFollowRequest(sessionAlice, aliceDir,
|
||||
'alice', aliceDomain, alicePort, httpPrefix,
|
||||
'alice', aliceDomain, alicePort, http_prefix,
|
||||
'bob', bobDomain, bobActor,
|
||||
bobPort, httpPrefix,
|
||||
bobPort, http_prefix,
|
||||
clientToServer, federationList,
|
||||
aliceSendThreads, alicePostLog,
|
||||
aliceCachedWebfingers, alicePersonCache,
|
||||
|
@ -1814,7 +1814,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
sendShareViaServer(bobDir, sessionBob,
|
||||
'bob', bobPassword,
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, sharedItemName,
|
||||
http_prefix, sharedItemName,
|
||||
sharedItemDescription, sharedItemImageFilename,
|
||||
sharedItemQty, sharedItemType, sharedItemCategory,
|
||||
sharedItemLocation, sharedItemDuration,
|
||||
|
@ -1838,7 +1838,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
sendShareViaServer(bobDir, sessionBob,
|
||||
'bob', bobPassword,
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, sharedItemName,
|
||||
http_prefix, sharedItemName,
|
||||
sharedItemDescription, sharedItemImageFilename,
|
||||
sharedItemQty, sharedItemType, sharedItemCategory,
|
||||
sharedItemLocation, sharedItemDuration,
|
||||
|
@ -1862,7 +1862,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
sendShareViaServer(bobDir, sessionBob,
|
||||
'bob', bobPassword,
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, sharedItemName,
|
||||
http_prefix, sharedItemName,
|
||||
sharedItemDescription, sharedItemImageFilename,
|
||||
sharedItemQty, sharedItemType, sharedItemCategory,
|
||||
sharedItemLocation, sharedItemDuration,
|
||||
|
@ -1894,7 +1894,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
signingPrivateKeyPem = None
|
||||
catalogJson = \
|
||||
getSharedItemsCatalogViaServer(bobDir, sessionBob, 'bob', bobPassword,
|
||||
bobDomain, bobPort, httpPrefix, True,
|
||||
bobDomain, bobPort, http_prefix, True,
|
||||
signingPrivateKeyPem)
|
||||
assert catalogJson
|
||||
pprint(catalogJson)
|
||||
|
@ -1926,7 +1926,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
sendPost(signingPrivateKeyPem, __version__,
|
||||
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort, ccUrl,
|
||||
httpPrefix, 'Alice message', followersOnly, saveToFile,
|
||||
http_prefix, 'Alice message', followersOnly, saveToFile,
|
||||
clientToServer, True,
|
||||
None, None, None, city, federationList,
|
||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||
|
@ -1986,7 +1986,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
'host': bobAddress,
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
url = httpPrefix + '://' + bobAddress + '/catalog'
|
||||
url = http_prefix + '://' + bobAddress + '/catalog'
|
||||
signingPrivateKeyPem = None
|
||||
catalogJson = getJson(signingPrivateKeyPem, sessionAlice, url, headers,
|
||||
None, True)
|
||||
|
@ -2034,7 +2034,7 @@ def testGroupFollow(base_dir: str) -> None:
|
|||
testServerGroupRunning = False
|
||||
|
||||
# systemLanguage = 'en'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
federationList = []
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
@ -2177,14 +2177,15 @@ def testGroupFollow(base_dir: str) -> None:
|
|||
alicePersonCache = {}
|
||||
aliceCachedWebfingers = {}
|
||||
alicePostLog = []
|
||||
# aliceActor = httpPrefix + '://' + aliceAddress + '/users/alice'
|
||||
testgroupActor = httpPrefix + '://' + testgroupAddress + '/users/testgroup'
|
||||
# aliceActor = http_prefix + '://' + aliceAddress + '/users/alice'
|
||||
testgroupActor = \
|
||||
http_prefix + '://' + testgroupAddress + '/users/testgroup'
|
||||
signingPrivateKeyPem = None
|
||||
sendResult = \
|
||||
sendFollowRequest(sessionAlice, aliceDir,
|
||||
'alice', aliceDomain, alicePort, httpPrefix,
|
||||
'alice', aliceDomain, alicePort, http_prefix,
|
||||
'testgroup', testgroupDomain, testgroupActor,
|
||||
testgroupPort, httpPrefix,
|
||||
testgroupPort, http_prefix,
|
||||
clientToServer, federationList,
|
||||
aliceSendThreads, alicePostLog,
|
||||
aliceCachedWebfingers, alicePersonCache,
|
||||
|
@ -2253,14 +2254,15 @@ def testGroupFollow(base_dir: str) -> None:
|
|||
bobPersonCache = {}
|
||||
bobCachedWebfingers = {}
|
||||
bobPostLog = []
|
||||
# bobActor = httpPrefix + '://' + bobAddress + '/users/bob'
|
||||
testgroupActor = httpPrefix + '://' + testgroupAddress + '/users/testgroup'
|
||||
# bobActor = http_prefix + '://' + bobAddress + '/users/bob'
|
||||
testgroupActor = \
|
||||
http_prefix + '://' + testgroupAddress + '/users/testgroup'
|
||||
signingPrivateKeyPem = None
|
||||
sendResult = \
|
||||
sendFollowRequest(sessionBob, bobDir,
|
||||
'bob', bobDomain, bobPort, httpPrefix,
|
||||
'bob', bobDomain, bobPort, http_prefix,
|
||||
'testgroup', testgroupDomain, testgroupActor,
|
||||
testgroupPort, httpPrefix,
|
||||
testgroupPort, http_prefix,
|
||||
clientToServer, federationList,
|
||||
bobSendThreads, bobPostLog,
|
||||
bobCachedWebfingers, bobPersonCache,
|
||||
|
@ -2347,7 +2349,7 @@ def testGroupFollow(base_dir: str) -> None:
|
|||
sendPost(signingPrivateKeyPem, __version__,
|
||||
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
|
||||
'testgroup', testgroupDomain, testgroupPort, ccUrl,
|
||||
httpPrefix, "Alice group message", followersOnly,
|
||||
http_prefix, "Alice group message", followersOnly,
|
||||
saveToFile, clientToServer, True,
|
||||
None, None, None, city, federationList,
|
||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||
|
@ -2438,7 +2440,7 @@ def _testFollowersOfPerson(base_dir: str) -> None:
|
|||
domain = 'diva.domain'
|
||||
password = 'birb'
|
||||
port = 80
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
federationList = []
|
||||
base_dir = currDir + '/.tests_followersofperson'
|
||||
if os.path.isdir(base_dir):
|
||||
|
@ -2446,15 +2448,15 @@ def _testFollowersOfPerson(base_dir: str) -> None:
|
|||
os.mkdir(base_dir)
|
||||
os.chdir(base_dir)
|
||||
createPerson(base_dir, nickname, domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'maxboardroom', domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'ultrapancake', domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'drokk', domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'sausagedog', domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
|
||||
clearFollows(base_dir, nickname, domain)
|
||||
followPerson(base_dir, nickname, domain, 'maxboardroom', domain,
|
||||
|
@ -2488,23 +2490,23 @@ def _testNoOfFollowersOnDomain(base_dir: str) -> None:
|
|||
otherdomain = 'soup.dragon'
|
||||
password = 'birb'
|
||||
port = 80
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
federationList = []
|
||||
base_dir = currDir + '/.tests_nooffollowersOndomain'
|
||||
if os.path.isdir(base_dir):
|
||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||
os.mkdir(base_dir)
|
||||
os.chdir(base_dir)
|
||||
createPerson(base_dir, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(base_dir, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
createPerson(base_dir, 'maxboardroom', otherdomain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'ultrapancake', otherdomain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'drokk', otherdomain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
createPerson(base_dir, 'sausagedog', otherdomain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
|
||||
followPerson(base_dir, 'drokk', otherdomain, nickname, domain,
|
||||
federationList, False, False)
|
||||
|
@ -2550,14 +2552,14 @@ def _testGroupFollowers(base_dir: str) -> None:
|
|||
domain = 'mydomain.com'
|
||||
password = 'somepass'
|
||||
port = 80
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
federationList = []
|
||||
base_dir = currDir + '/.tests_testgroupfollowers'
|
||||
if os.path.isdir(base_dir):
|
||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||
os.mkdir(base_dir)
|
||||
os.chdir(base_dir)
|
||||
createPerson(base_dir, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(base_dir, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
|
||||
clearFollowers(base_dir, nickname, domain)
|
||||
|
@ -2594,14 +2596,14 @@ def _testFollows(base_dir: str) -> None:
|
|||
domain = 'testdomain.com'
|
||||
password = 'mypass'
|
||||
port = 80
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
federationList = ['wild.com', 'mesh.com']
|
||||
base_dir = currDir + '/.tests_testfollows'
|
||||
if os.path.isdir(base_dir):
|
||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||
os.mkdir(base_dir)
|
||||
os.chdir(base_dir)
|
||||
createPerson(base_dir, nickname, domain, port, httpPrefix, True,
|
||||
createPerson(base_dir, nickname, domain, port, http_prefix, True,
|
||||
False, password)
|
||||
|
||||
clearFollows(base_dir, nickname, domain)
|
||||
|
@ -2673,7 +2675,7 @@ def _testCreatePerson(base_dir: str):
|
|||
domain = 'badgerdomain.com'
|
||||
password = 'mypass'
|
||||
port = 80
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
clientToServer = False
|
||||
base_dir = currDir + '/.tests_createperson'
|
||||
if os.path.isdir(base_dir):
|
||||
|
@ -2683,7 +2685,7 @@ def _testCreatePerson(base_dir: str):
|
|||
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(base_dir, nickname, domain, port,
|
||||
httpPrefix, True, False, password)
|
||||
http_prefix, True, False, password)
|
||||
assert os.path.isfile(base_dir + '/accounts/passwords')
|
||||
deleteAllPosts(base_dir, nickname, domain, 'inbox')
|
||||
deleteAllPosts(base_dir, nickname, domain, 'outbox')
|
||||
|
@ -2708,7 +2710,7 @@ def _testCreatePerson(base_dir: str):
|
|||
conversationId = None
|
||||
lowBandwidth = True
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followersOnly, saveToFile, clientToServer,
|
||||
commentsEnabled, attachImageFilename, mediaType,
|
||||
'Not suitable for Vogons', 'London, England',
|
||||
|
@ -2784,7 +2786,7 @@ def testClientToServer(base_dir: str):
|
|||
testServerBobRunning = False
|
||||
|
||||
systemLanguage = 'en'
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
federationList = []
|
||||
lowBandwidth = False
|
||||
|
@ -2890,7 +2892,7 @@ def testClientToServer(base_dir: str):
|
|||
aliceDir, sessionAlice, 'alice', password,
|
||||
aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort, None,
|
||||
httpPrefix, 'Sent from my ActivityPub client',
|
||||
http_prefix, 'Sent from my ActivityPub client',
|
||||
followersOnly, True,
|
||||
attachedImageFilename, mediaType,
|
||||
attachedImageDescription, city,
|
||||
|
@ -2957,7 +2959,7 @@ def testClientToServer(base_dir: str):
|
|||
'alice', password,
|
||||
aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
alicePetnamesFilename = aliceDir + '/accounts/' + \
|
||||
|
@ -2999,7 +3001,7 @@ def testClientToServer(base_dir: str):
|
|||
'bob', 'bobpass',
|
||||
bobDomain, bobPort,
|
||||
'alice', aliceDomain, alicePort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for t in range(10):
|
||||
|
@ -3054,7 +3056,7 @@ def testClientToServer(base_dir: str):
|
|||
sendLikeViaServer(bobDir, sessionBob,
|
||||
'bob', 'bobpass',
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, outboxPostId,
|
||||
http_prefix, outboxPostId,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(20):
|
||||
|
@ -3084,7 +3086,7 @@ def testClientToServer(base_dir: str):
|
|||
sendReactionViaServer(bobDir, sessionBob,
|
||||
'bob', 'bobpass',
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, outboxPostId, '😃',
|
||||
http_prefix, outboxPostId, '😃',
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(20):
|
||||
|
@ -3130,7 +3132,7 @@ def testClientToServer(base_dir: str):
|
|||
signingPrivateKeyPem = None
|
||||
sendAnnounceViaServer(bobDir, sessionBob, 'bob', password,
|
||||
bobDomain, bobPort,
|
||||
httpPrefix, outboxPostId,
|
||||
http_prefix, outboxPostId,
|
||||
cachedWebfingers,
|
||||
personCache, True, __version__,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -3168,7 +3170,7 @@ def testClientToServer(base_dir: str):
|
|||
password = 'alicepass'
|
||||
sendDeleteViaServer(aliceDir, sessionAlice, 'alice', password,
|
||||
aliceDomain, alicePort,
|
||||
httpPrefix, outboxPostId,
|
||||
http_prefix, outboxPostId,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for i in range(30):
|
||||
|
@ -3193,7 +3195,7 @@ def testClientToServer(base_dir: str):
|
|||
'alice', password,
|
||||
aliceDomain, alicePort,
|
||||
'bob', bobDomain, bobPort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
True, __version__, signingPrivateKeyPem)
|
||||
for t in range(10):
|
||||
|
@ -3408,7 +3410,7 @@ def _testWebLinks():
|
|||
def _testAddEmoji(base_dir: str):
|
||||
print('testAddEmoji')
|
||||
content = "Emoji :lemon: :strawberry: :banana:"
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
nickname = 'testuser'
|
||||
domain = 'testdomain.net'
|
||||
port = 3682
|
||||
|
@ -3431,9 +3433,9 @@ def _testAddEmoji(base_dir: str):
|
|||
os.chdir(base_dir)
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(base_dir, nickname, domain, port,
|
||||
httpPrefix, True, False, 'password')
|
||||
http_prefix, True, False, 'password')
|
||||
contentModified = \
|
||||
addHtmlTags(base_dir, httpPrefix,
|
||||
addHtmlTags(base_dir, http_prefix,
|
||||
nickname, domain, content,
|
||||
recipients, hashtags, True)
|
||||
assert ':lemon:' in contentModified
|
||||
|
@ -4229,8 +4231,8 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
|||
nickname = 'test7492362'
|
||||
domain = 'other.site'
|
||||
port = 443
|
||||
httpPrefix = 'https'
|
||||
postId = httpPrefix + '://rat.site/users/ninjarodent/statuses/63746173435'
|
||||
http_prefix = 'https'
|
||||
postId = http_prefix + '://rat.site/users/ninjarodent/statuses/63746173435'
|
||||
content = "@ninjarodent@rat.site This is a test."
|
||||
followersOnly = False
|
||||
saveToFile = False
|
||||
|
@ -4252,7 +4254,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
|||
lowBandwidth = True
|
||||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
reply = \
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followersOnly, saveToFile,
|
||||
clientToServer, commentsEnabled,
|
||||
attachImageFilename, mediaType,
|
||||
|
@ -4281,7 +4283,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
|||
print('reply["object"]["cc"]: ' + str(reply['object']['cc']))
|
||||
assert len(reply['object']['cc']) == 2
|
||||
assert reply['object']['cc'][1] == \
|
||||
httpPrefix + '://rat.site/users/ninjarodent'
|
||||
http_prefix + '://rat.site/users/ninjarodent'
|
||||
|
||||
assert len(reply['to']) == 1
|
||||
assert reply['to'][0].endswith('#Public')
|
||||
|
@ -4290,7 +4292,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
|||
if len(reply['cc']) != 2:
|
||||
print('reply["cc"]: ' + str(reply['cc']))
|
||||
assert len(reply['cc']) == 2
|
||||
assert reply['cc'][1] == httpPrefix + '://rat.site/users/ninjarodent'
|
||||
assert reply['cc'][1] == http_prefix + '://rat.site/users/ninjarodent'
|
||||
|
||||
|
||||
def _getFunctionCallArgs(name: str, lines: [], startLineCtr: int) -> []:
|
||||
|
@ -4774,7 +4776,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
|||
nickname = 'test27636'
|
||||
domain = 'rando.site'
|
||||
port = 443
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
content = 'This is a test post with links.\n\n' + \
|
||||
'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://libreserver.org'
|
||||
followersOnly = False
|
||||
|
@ -4798,7 +4800,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
|||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
||||
postJsonObject = \
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followersOnly, saveToFile,
|
||||
clientToServer, commentsEnabled,
|
||||
attachImageFilename, mediaType,
|
||||
|
@ -4834,7 +4836,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
|||
"taggedthing\" class=\"mention hashtag\" rel=\"tag\" " + \
|
||||
"target=\"_blank\">#<span>taggedthing</span></a></p>"
|
||||
postJsonObject = \
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
content,
|
||||
False, False,
|
||||
False, True,
|
||||
|
@ -5064,7 +5066,7 @@ def testUpdateActor(base_dir: str):
|
|||
global testServerAliceRunning
|
||||
testServerAliceRunning = False
|
||||
|
||||
httpPrefix = 'http'
|
||||
http_prefix = 'http'
|
||||
proxyType = None
|
||||
federationList = []
|
||||
|
||||
|
@ -5144,7 +5146,7 @@ def testUpdateActor(base_dir: str):
|
|||
pgpPublicKeyUpload(aliceDir, sessionAlice,
|
||||
'alice', password,
|
||||
aliceDomain, alicePort,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
cachedWebfingers, personCache,
|
||||
True, pubKey, signingPrivateKeyPem)
|
||||
print('actor update result: ' + str(actorUpdate))
|
||||
|
@ -5761,7 +5763,7 @@ def _testCanReplyTo(base_dir: str) -> None:
|
|||
nickname = 'test27637'
|
||||
domain = 'rando.site'
|
||||
port = 443
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
content = 'This is a test post with links.\n\n' + \
|
||||
'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://libreserver.org'
|
||||
followersOnly = False
|
||||
|
@ -5785,7 +5787,7 @@ def _testCanReplyTo(base_dir: str) -> None:
|
|||
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
|
||||
|
||||
postJsonObject = \
|
||||
createPublicPost(base_dir, nickname, domain, port, httpPrefix,
|
||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followersOnly, saveToFile,
|
||||
clientToServer, commentsEnabled,
|
||||
attachImageFilename, mediaType,
|
||||
|
@ -5919,11 +5921,11 @@ def _testHttpsigBaseNew(withDigest: bool, base_dir: str,
|
|||
nickname = 'socrates'
|
||||
hostDomain = 'someother.instance'
|
||||
domain = 'argumentative.social'
|
||||
httpPrefix = 'https'
|
||||
http_prefix = 'https'
|
||||
port = 5576
|
||||
password = 'SuperSecretPassword'
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
createPerson(path, nickname, domain, port, httpPrefix,
|
||||
createPerson(path, nickname, domain, port, http_prefix,
|
||||
False, False, password)
|
||||
assert privateKeyPem
|
||||
if withDigest:
|
||||
|
@ -5950,7 +5952,7 @@ def _testHttpsigBaseNew(withDigest: bool, base_dir: str,
|
|||
signPostHeadersNew(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
hostDomain, port,
|
||||
boxpath, httpPrefix, messageBodyJsonStr,
|
||||
boxpath, http_prefix, messageBodyJsonStr,
|
||||
algorithm, digestAlgorithm, debug)
|
||||
else:
|
||||
digestPrefix = getDigestPrefix(digestAlgorithm)
|
||||
|
@ -5968,7 +5970,7 @@ def _testHttpsigBaseNew(withDigest: bool, base_dir: str,
|
|||
signPostHeadersNew(dateStr, privateKeyPem, nickname,
|
||||
domain, port,
|
||||
hostDomain, port,
|
||||
boxpath, httpPrefix, messageBodyJsonStr,
|
||||
boxpath, http_prefix, messageBodyJsonStr,
|
||||
algorithm, digestAlgorithm, debug)
|
||||
|
||||
headers['signature'] = signatureHeader
|
||||
|
@ -5977,20 +5979,20 @@ def _testHttpsigBaseNew(withDigest: bool, base_dir: str,
|
|||
|
||||
GETmethod = not withDigest
|
||||
debug = True
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, debug)
|
||||
debug = False
|
||||
if withDigest:
|
||||
# everything correct except for content-length
|
||||
headers['content-length'] = str(contentLength + 2)
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, debug) is False
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
'/parambulator' + boxpath, GETmethod, None,
|
||||
messageBodyJsonStr, debug) is False
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, not GETmethod, None,
|
||||
messageBodyJsonStr, debug) is False
|
||||
if not withDigest:
|
||||
|
@ -6019,7 +6021,7 @@ def _testHttpsigBaseNew(withDigest: bool, base_dir: str,
|
|||
headers['signature'] = signatureHeader
|
||||
headers['signature-input'] = signatureIndexHeader
|
||||
pprint(headers)
|
||||
assert verifyPostHeaders(httpPrefix, publicKeyPem, headers,
|
||||
assert verifyPostHeaders(http_prefix, publicKeyPem, headers,
|
||||
boxpath, not GETmethod, None,
|
||||
messageBodyJsonStr, False) is False
|
||||
|
||||
|
|
4
theme.py
4
theme.py
|
@ -777,7 +777,7 @@ def _setThemeImages(base_dir: str, name: str) -> None:
|
|||
|
||||
|
||||
def setNewsAvatar(base_dir: str, name: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
domain: str, domainFull: str) -> None:
|
||||
"""Sets the avatar for the news account
|
||||
"""
|
||||
|
@ -788,7 +788,7 @@ def setNewsAvatar(base_dir: str, name: str,
|
|||
if not os.path.isfile(newFilename):
|
||||
return
|
||||
avatarFilename = \
|
||||
localActorUrl(httpPrefix, domainFull, nickname) + '.png'
|
||||
localActorUrl(http_prefix, domainFull, nickname) + '.png'
|
||||
avatarFilename = avatarFilename.replace('/', '-')
|
||||
filename = base_dir + '/cache/avatars/' + avatarFilename
|
||||
|
||||
|
|
20
utils.py
20
utils.py
|
@ -28,10 +28,10 @@ invalidCharacters = (
|
|||
)
|
||||
|
||||
|
||||
def localActorUrl(httpPrefix: str, nickname: str, domainFull: str) -> str:
|
||||
def localActorUrl(http_prefix: str, nickname: str, domainFull: str) -> str:
|
||||
"""Returns the url for an actor on this instance
|
||||
"""
|
||||
return httpPrefix + '://' + domainFull + '/users/' + nickname
|
||||
return http_prefix + '://' + domainFull + '/users/' + nickname
|
||||
|
||||
|
||||
def getActorLanguagesList(actorJson: {}) -> []:
|
||||
|
@ -1453,7 +1453,7 @@ def canReplyTo(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
|
||||
|
||||
def _removeAttachment(base_dir: str, httpPrefix: str, domain: str,
|
||||
def _removeAttachment(base_dir: str, http_prefix: str, domain: str,
|
||||
postJson: {}):
|
||||
if not postJson.get('attachment'):
|
||||
return
|
||||
|
@ -1463,7 +1463,7 @@ def _removeAttachment(base_dir: str, httpPrefix: str, domain: str,
|
|||
if not attachmentUrl:
|
||||
return
|
||||
mediaFilename = base_dir + '/' + \
|
||||
attachmentUrl.replace(httpPrefix + '://' + domain + '/', '')
|
||||
attachmentUrl.replace(http_prefix + '://' + domain + '/', '')
|
||||
if os.path.isfile(mediaFilename):
|
||||
try:
|
||||
os.remove(mediaFilename)
|
||||
|
@ -1522,7 +1522,7 @@ def _isReplyToBlogPost(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, postFilename: str,
|
||||
http_prefix: str, postFilename: str,
|
||||
recentPostsCache: {}, debug: bool) -> None:
|
||||
"""Removes replies when deleting a post
|
||||
"""
|
||||
|
@ -1537,7 +1537,7 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
|
|||
if not replyFile:
|
||||
continue
|
||||
if os.path.isfile(replyFile):
|
||||
deletePost(base_dir, httpPrefix,
|
||||
deletePost(base_dir, http_prefix,
|
||||
nickname, domain, replyFile, debug,
|
||||
recentPostsCache)
|
||||
# remove the replies file
|
||||
|
@ -1705,7 +1705,7 @@ def _deleteConversationPost(base_dir: str, nickname: str, domain: str,
|
|||
str(conversationFilename))
|
||||
|
||||
|
||||
def deletePost(base_dir: str, httpPrefix: str,
|
||||
def deletePost(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, postFilename: str,
|
||||
debug: bool, recentPostsCache: {}) -> None:
|
||||
"""Recursively deletes a post and its replies and attachments
|
||||
|
@ -1714,7 +1714,7 @@ def deletePost(base_dir: str, httpPrefix: str,
|
|||
if not postJsonObject:
|
||||
# remove any replies
|
||||
_deletePostRemoveReplies(base_dir, nickname, domain,
|
||||
httpPrefix, postFilename,
|
||||
http_prefix, postFilename,
|
||||
recentPostsCache, debug)
|
||||
# finally, remove the post itself
|
||||
try:
|
||||
|
@ -1741,7 +1741,7 @@ def deletePost(base_dir: str, httpPrefix: str,
|
|||
_deleteConversationPost(base_dir, nickname, domain, postJsonObject)
|
||||
|
||||
# remove any attachment
|
||||
_removeAttachment(base_dir, httpPrefix, domain, postJsonObject)
|
||||
_removeAttachment(base_dir, http_prefix, domain, postJsonObject)
|
||||
|
||||
extensions = ('votes', 'arrived', 'muted', 'tts', 'reject')
|
||||
for ext in extensions:
|
||||
|
@ -1774,7 +1774,7 @@ def deletePost(base_dir: str, httpPrefix: str,
|
|||
|
||||
# remove any replies
|
||||
_deletePostRemoveReplies(base_dir, nickname, domain,
|
||||
httpPrefix, postFilename,
|
||||
http_prefix, postFilename,
|
||||
recentPostsCache, debug)
|
||||
# finally, remove the post itself
|
||||
try:
|
||||
|
|
|
@ -15,7 +15,7 @@ from webapp_utils import htmlFooter
|
|||
from markdown import markdownToHtml
|
||||
|
||||
|
||||
def htmlAbout(cssCache: {}, base_dir: str, httpPrefix: str,
|
||||
def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
||||
domainFull: str, onionDomain: str, translate: {},
|
||||
systemLanguage: str) -> str:
|
||||
"""Show the about screen
|
||||
|
@ -44,7 +44,7 @@ def htmlAbout(cssCache: {}, base_dir: str, httpPrefix: str,
|
|||
getConfigParam(base_dir, 'instanceTitle')
|
||||
aboutForm = \
|
||||
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
systemLanguage)
|
||||
aboutForm += '<div class="container">' + aboutText + '</div>'
|
||||
if onionDomain:
|
||||
|
|
|
@ -32,14 +32,14 @@ from webapp_utils import htmlKeyboardNavigation
|
|||
|
||||
|
||||
def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
||||
path: str, httpPrefix: str,
|
||||
path: str, http_prefix: str,
|
||||
domainFull: str, postId: str, postTime: str,
|
||||
year: int, monthNumber: int,
|
||||
dayNumber: int, callingDomain: str) -> str:
|
||||
"""Shows a screen asking to confirm the deletion of a calendar event
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain, port = getDomainFromActor(actor)
|
||||
messageId = actor + '/statuses/' + postId
|
||||
|
||||
|
@ -245,7 +245,7 @@ def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {},
|
|||
|
||||
def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
||||
base_dir: str, path: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
textModeBanner: str, accessKeys: {}) -> str:
|
||||
"""Show the calendar for a person
|
||||
"""
|
||||
|
@ -254,7 +254,7 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
|||
monthNumber = 0
|
||||
dayNumber = None
|
||||
year = 1970
|
||||
actor = httpPrefix + '://' + domainFull + path.replace('/calendar', '')
|
||||
actor = http_prefix + '://' + domainFull + path.replace('/calendar', '')
|
||||
if '?' in actor:
|
||||
first = True
|
||||
for p in actor.split('?'):
|
||||
|
|
|
@ -33,7 +33,7 @@ def _linksExist(base_dir: str) -> bool:
|
|||
|
||||
|
||||
def _getLeftColumnShares(base_dir: str,
|
||||
httpPrefix: str, domain: str, domainFull: str,
|
||||
http_prefix: str, domain: str, domainFull: str,
|
||||
nickname: str,
|
||||
maxSharesInLeftColumn: int,
|
||||
translate: {},
|
||||
|
@ -41,7 +41,7 @@ def _getLeftColumnShares(base_dir: str,
|
|||
"""get any shares and turn them into the left column links format
|
||||
"""
|
||||
pageNumber = 1
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
# NOTE: this could potentially be slow if the number of federated
|
||||
# shared items is large
|
||||
sharesJson, lastPage = \
|
||||
|
@ -75,7 +75,7 @@ def _getLeftColumnShares(base_dir: str,
|
|||
|
||||
|
||||
def _getLeftColumnWanted(base_dir: str,
|
||||
httpPrefix: str, domain: str, domainFull: str,
|
||||
http_prefix: str, domain: str, domainFull: str,
|
||||
nickname: str,
|
||||
maxSharesInLeftColumn: int,
|
||||
translate: {},
|
||||
|
@ -83,7 +83,7 @@ def _getLeftColumnWanted(base_dir: str,
|
|||
"""get any wanted items and turn them into the left column links format
|
||||
"""
|
||||
pageNumber = 1
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
# NOTE: this could potentially be slow if the number of federated
|
||||
# wanted items is large
|
||||
sharesJson, lastPage = \
|
||||
|
@ -113,7 +113,7 @@ def _getLeftColumnWanted(base_dir: str,
|
|||
|
||||
|
||||
def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
http_prefix: str, translate: {},
|
||||
editor: bool, artist: bool,
|
||||
showBackButton: bool, timelinePath: str,
|
||||
rssIconAtTop: bool, showHeaderImage: bool,
|
||||
|
@ -177,11 +177,11 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
# RSS icon
|
||||
if nickname != 'news':
|
||||
# rss feed for this account
|
||||
rssUrl = httpPrefix + '://' + domainFull + \
|
||||
rssUrl = http_prefix + '://' + domainFull + \
|
||||
'/blog/' + nickname + '/rss.xml'
|
||||
else:
|
||||
# rss feed for all accounts on the instance
|
||||
rssUrl = httpPrefix + '://' + domainFull + '/blog/rss.xml'
|
||||
rssUrl = http_prefix + '://' + domainFull + '/blog/rss.xml'
|
||||
if not frontPage:
|
||||
rssTitle = translate['RSS feed for your blog']
|
||||
else:
|
||||
|
@ -218,7 +218,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
maxSharesInLeftColumn = 3
|
||||
sharesList = \
|
||||
_getLeftColumnShares(base_dir,
|
||||
httpPrefix, domain, domainFull, nickname,
|
||||
http_prefix, domain, domainFull, nickname,
|
||||
maxSharesInLeftColumn, translate,
|
||||
sharedItemsFederatedDomains)
|
||||
if linksList and sharesList:
|
||||
|
@ -226,7 +226,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
wantedList = \
|
||||
_getLeftColumnWanted(base_dir,
|
||||
httpPrefix, domain, domainFull, nickname,
|
||||
http_prefix, domain, domainFull, nickname,
|
||||
maxSharesInLeftColumn, translate,
|
||||
sharedItemsFederatedDomains)
|
||||
if linksList and wantedList:
|
||||
|
@ -350,7 +350,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
def htmlLinksMobile(cssCache: {}, base_dir: str,
|
||||
nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate,
|
||||
http_prefix: str, translate,
|
||||
timelinePath: str, authorized: bool,
|
||||
rssIconAtTop: bool,
|
||||
iconsAsButtons: bool,
|
||||
|
@ -395,7 +395,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
|
|||
iconsAsButtons) + '</center>'
|
||||
htmlStr += \
|
||||
getLeftColumnContent(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
editor, artist,
|
||||
False, timelinePath,
|
||||
rssIconAtTop, False, False,
|
||||
|
@ -414,7 +414,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
|
|||
|
||||
|
||||
def htmlEditLinks(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
defaultTimeline: str, theme: str,
|
||||
accessKeys: {}) -> str:
|
||||
"""Shows the edit links screen
|
||||
|
|
|
@ -48,7 +48,7 @@ def _votesIndicator(totalVotes: int, positiveVoting: bool) -> str:
|
|||
|
||||
|
||||
def getRightColumnContent(base_dir: str, nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
http_prefix: str, translate: {},
|
||||
moderator: bool, editor: bool,
|
||||
newswire: {}, positiveVoting: bool,
|
||||
showBackButton: bool, timelinePath: str,
|
||||
|
@ -327,7 +327,7 @@ def _htmlNewswire(base_dir: str, newswire: {}, nickname: str, moderator: bool,
|
|||
|
||||
|
||||
def htmlCitations(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, defaultTimeline: str,
|
||||
http_prefix: str, defaultTimeline: str,
|
||||
translate: {}, newswire: {}, cssCache: {},
|
||||
blogTitle: str, blogContent: str,
|
||||
blogImageFilename: str,
|
||||
|
@ -444,7 +444,7 @@ def htmlCitations(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
|
||||
domain: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
http_prefix: str, translate: {},
|
||||
newswire: {},
|
||||
positiveVoting: bool,
|
||||
timelinePath: str,
|
||||
|
@ -497,7 +497,7 @@ def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
|
|||
iconsAsButtons) + '</center>'
|
||||
htmlStr += \
|
||||
getRightColumnContent(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positiveVoting,
|
||||
False, timelinePath, showPublishButton,
|
||||
|
@ -517,7 +517,7 @@ def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
|
|||
|
||||
|
||||
def htmlEditNewswire(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
defaultTimeline: str, theme: str,
|
||||
accessKeys: {}) -> str:
|
||||
"""Shows the edit newswire screen
|
||||
|
@ -640,7 +640,7 @@ def htmlEditNewswire(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
|
||||
def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||
domain: str, port: int,
|
||||
httpPrefix: str, postUrl: str,
|
||||
http_prefix: str, postUrl: str,
|
||||
systemLanguage: str) -> str:
|
||||
"""Edits a news post on the news/features timeline
|
||||
"""
|
||||
|
|
|
@ -27,7 +27,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate, pageNumber: int,
|
||||
session, base_dir: str, messageId: str,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
callingDomain: str,
|
||||
YTReplacementDomain: str,
|
||||
|
@ -71,7 +71,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
base_dir, session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, postJsonObject,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'outbox',
|
||||
http_prefix, projectVersion, 'outbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
|
|
@ -185,7 +185,7 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
|
|||
|
||||
|
||||
def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
path: str, inReplyTo: str,
|
||||
mentions: [],
|
||||
shareDescription: str,
|
||||
|
@ -269,7 +269,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
nickname, domain, port,
|
||||
postJsonObject,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion,
|
||||
http_prefix, projectVersion,
|
||||
boxName,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
|
|
@ -24,7 +24,7 @@ from webapp_post import individualPostAsHtml
|
|||
|
||||
def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
projectVersion: str,
|
||||
|
@ -55,7 +55,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
|
|||
outboxFeed = \
|
||||
personBoxJson({}, session, base_dir, domain, port,
|
||||
outboxFeedPathStr,
|
||||
httpPrefix, 10, boxName,
|
||||
http_prefix, 10, boxName,
|
||||
authorized, 0, False, 0)
|
||||
if not outboxFeed:
|
||||
break
|
||||
|
@ -73,7 +73,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
|
|||
personCache,
|
||||
nickname, domain, port, item,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -99,7 +99,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
|
|||
defaultTimeline: str,
|
||||
recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {}, projectVersion: str,
|
||||
base_dir: str, httpPrefix: str, authorized: bool,
|
||||
base_dir: str, http_prefix: str, authorized: bool,
|
||||
profileJson: {}, selected: str,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
YTReplacementDomain: str,
|
||||
|
@ -154,7 +154,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
|
|||
' <td valign="top" class="col-left">\n'
|
||||
profileHeaderStr += \
|
||||
getLeftColumnContent(base_dir, 'news', domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
False, False,
|
||||
False, None, rssIconAtTop, True,
|
||||
True, theme, accessKeys,
|
||||
|
@ -175,7 +175,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
|
|||
profileStr += \
|
||||
_htmlFrontScreenPosts(recentPostsCache, maxRecentPosts,
|
||||
translate,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
nickname, domain, port,
|
||||
session, cachedWebfingers, personCache,
|
||||
projectVersion,
|
||||
|
@ -194,7 +194,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
|
|||
profileFooterStr += ' <td valign="top" class="col-right">\n'
|
||||
profileFooterStr += \
|
||||
getRightColumnContent(base_dir, 'news', domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
False, False, newswire, False,
|
||||
False, None, False, False,
|
||||
False, True, authorized, True, theme,
|
||||
|
|
|
@ -56,7 +56,7 @@ def htmlGetLoginCredentials(loginParams: str,
|
|||
|
||||
def htmlLogin(cssCache: {}, translate: {},
|
||||
base_dir: str,
|
||||
httpPrefix: str, domain: str,
|
||||
http_prefix: str, domain: str,
|
||||
systemLanguage: str,
|
||||
autocomplete: bool) -> str:
|
||||
"""Shows the login screen
|
||||
|
@ -152,7 +152,7 @@ def htmlLogin(cssCache: {}, translate: {},
|
|||
getConfigParam(base_dir, 'instanceTitle')
|
||||
loginForm = \
|
||||
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
|
||||
httpPrefix, domain,
|
||||
http_prefix, domain,
|
||||
systemLanguage)
|
||||
|
||||
nicknamePattern = getNicknameValidationPattern()
|
||||
|
|
|
@ -36,7 +36,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
|
|||
session, base_dir: str, wfRequest: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
|
@ -65,7 +65,8 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
wfRequest, personCache,
|
||||
nickname, domain, port, inboxJson, 'moderation',
|
||||
allowDeletion, httpPrefix, projectVersion, True, False,
|
||||
allowDeletion, http_prefix,
|
||||
projectVersion, True, False,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -80,7 +81,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
|
|||
|
||||
|
||||
def htmlAccountInfo(cssCache: {}, translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
searchHandle: str, debug: bool,
|
||||
systemLanguage: str, signingPrivateKeyPem: str) -> str:
|
||||
|
@ -105,7 +106,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
|
||||
searchHandle = searchNickname + '@' + searchDomain
|
||||
searchActor = \
|
||||
localActorUrl(httpPrefix, searchNickname, searchDomain)
|
||||
localActorUrl(http_prefix, searchNickname, searchDomain)
|
||||
infoForm += \
|
||||
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
|
||||
translate['Account Information'] + ':</a> <a href="' + searchActor + \
|
||||
|
@ -127,7 +128,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
base_dir, searchNickname, searchDomain,
|
||||
originDomain,
|
||||
proxyType, searchPort,
|
||||
httpPrefix, debug,
|
||||
http_prefix, debug,
|
||||
__version__, wordFrequency, systemLanguage,
|
||||
signingPrivateKeyPem)
|
||||
|
||||
|
@ -135,7 +136,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
followersList = \
|
||||
downloadFollowCollection(signingPrivateKeyPem,
|
||||
'followers', session,
|
||||
httpPrefix, searchActor, 1, 5, debug)
|
||||
http_prefix, searchActor, 1, 5, debug)
|
||||
blockedFollowers = []
|
||||
for followerActor in followersList:
|
||||
followerNickname = getNicknameFromActor(followerActor)
|
||||
|
@ -149,7 +150,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
followingList = \
|
||||
downloadFollowCollection(signingPrivateKeyPem,
|
||||
'following', session,
|
||||
httpPrefix, searchActor, 1, 5, debug)
|
||||
http_prefix, searchActor, 1, 5, debug)
|
||||
blockedFollowing = []
|
||||
for followingActor in followingList:
|
||||
followingNickname = getNicknameFromActor(followingActor)
|
||||
|
@ -164,7 +165,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
ctr = 1
|
||||
for postDomain, blockedPostUrls in domainDict.items():
|
||||
infoForm += '<a href="' + \
|
||||
httpPrefix + '://' + postDomain + '" ' + \
|
||||
http_prefix + '://' + postDomain + '" ' + \
|
||||
'target="_blank" rel="nofollow noopener noreferrer">' + \
|
||||
postDomain + '</a> '
|
||||
if isBlockedDomain(base_dir, postDomain):
|
||||
|
@ -271,7 +272,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
|
||||
|
||||
def htmlModerationInfo(cssCache: {}, translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str) -> str:
|
||||
msgStr1 = \
|
||||
'These are globally blocked for all accounts on this instance'
|
||||
|
|
|
@ -269,7 +269,7 @@ def _saveIndividualPostAsHtmlToCache(base_dir: str,
|
|||
|
||||
def _getPostFromRecentCache(session,
|
||||
base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
postJsonObject: {},
|
||||
postActor: str,
|
||||
|
@ -310,7 +310,7 @@ def _getPostFromRecentCache(session,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '2.1')
|
||||
|
||||
updateAvatarImageCache(signingPrivateKeyPem,
|
||||
session, base_dir, httpPrefix,
|
||||
session, base_dir, http_prefix,
|
||||
postActor, avatarUrl, personCache,
|
||||
allowDownloads)
|
||||
|
||||
|
@ -945,7 +945,7 @@ def _announceWithDisplayNameHtml(translate: {},
|
|||
|
||||
|
||||
def _getPostTitleAnnounceHtml(base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
showRepeatIcon: bool,
|
||||
isAnnounced: bool,
|
||||
|
@ -1006,7 +1006,8 @@ def _getPostTitleAnnounceHtml(base_dir: str,
|
|||
# add any emoji to the display name
|
||||
if ':' in announceDisplayName:
|
||||
announceDisplayName = \
|
||||
addEmojiToDisplayName(None, base_dir, httpPrefix, nickname, domain,
|
||||
addEmojiToDisplayName(None, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
announceDisplayName, False)
|
||||
_logPostTiming(enableTimingLog, postStartTime, '13.3.1')
|
||||
titleStr += \
|
||||
|
@ -1111,7 +1112,7 @@ def _getReplyHtml(translate: {},
|
|||
|
||||
|
||||
def _getPostTitleReplyHtml(base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
showRepeatIcon: bool,
|
||||
isAnnounced: bool,
|
||||
|
@ -1188,7 +1189,8 @@ def _getPostTitleReplyHtml(base_dir: str,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '13.5')
|
||||
|
||||
replyDisplayName = \
|
||||
addEmojiToDisplayName(None, base_dir, httpPrefix, nickname, domain,
|
||||
addEmojiToDisplayName(None, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
replyDisplayName, False)
|
||||
_logPostTiming(enableTimingLog, postStartTime, '13.6')
|
||||
|
||||
|
@ -1222,7 +1224,7 @@ def _getPostTitleReplyHtml(base_dir: str,
|
|||
|
||||
|
||||
def _getPostTitleHtml(base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
showRepeatIcon: bool,
|
||||
isAnnounced: bool,
|
||||
|
@ -1250,7 +1252,7 @@ def _getPostTitleHtml(base_dir: str,
|
|||
|
||||
if isAnnounced:
|
||||
return _getPostTitleAnnounceHtml(base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
showRepeatIcon,
|
||||
isAnnounced,
|
||||
|
@ -1269,7 +1271,7 @@ def _getPostTitleHtml(base_dir: str,
|
|||
containerClass)
|
||||
|
||||
return _getPostTitleReplyHtml(base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
showRepeatIcon,
|
||||
isAnnounced,
|
||||
|
@ -1327,7 +1329,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
postJsonObject: {},
|
||||
avatarUrl: str, showAvatarOptions: bool,
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
boxName: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1388,7 +1390,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
# get the html post from the recent posts cache if it exists there
|
||||
postHtml = \
|
||||
_getPostFromRecentCache(session, base_dir,
|
||||
httpPrefix, nickname, domain,
|
||||
http_prefix, nickname, domain,
|
||||
postJsonObject,
|
||||
postActor,
|
||||
personCache,
|
||||
|
@ -1412,7 +1414,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
|
||||
avatarUrl = \
|
||||
getAvatarImageUrl(session,
|
||||
base_dir, httpPrefix,
|
||||
base_dir, http_prefix,
|
||||
postActor, personCache,
|
||||
avatarUrl, allowDownloads,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1427,7 +1429,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
postActorDomainFull = getFullDomain(postActorDomain, postActorPort)
|
||||
postActorHandle = postActorNickname + '@' + postActorDomainFull
|
||||
postActorWf = \
|
||||
webfingerHandle(session, postActorHandle, httpPrefix,
|
||||
webfingerHandle(session, postActorHandle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, __version__, False, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -1443,7 +1445,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
postActorWf,
|
||||
personCache,
|
||||
projectVersion,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
'outbox', 72367)
|
||||
|
||||
|
@ -1455,7 +1457,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
# add any emoji to the display name
|
||||
if ':' in displayName:
|
||||
displayName = \
|
||||
addEmojiToDisplayName(session, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
displayName, False)
|
||||
|
||||
|
@ -1494,7 +1496,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
announceJsonObject = postJsonObject.copy()
|
||||
blockedCache = {}
|
||||
postJsonAnnounce = \
|
||||
downloadAnnounce(session, base_dir, httpPrefix,
|
||||
downloadAnnounce(session, base_dir, http_prefix,
|
||||
nickname, domain, postJsonObject,
|
||||
projectVersion, translate,
|
||||
YTReplacementDomain,
|
||||
|
@ -1516,7 +1518,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
# is the announced post in the html cache?
|
||||
postHtml = \
|
||||
_getPostFromRecentCache(session, base_dir,
|
||||
httpPrefix, nickname, domain,
|
||||
http_prefix, nickname, domain,
|
||||
postJsonObject,
|
||||
postActor,
|
||||
personCache,
|
||||
|
@ -1545,7 +1547,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
if isRecentPost(postJsonObject, 3):
|
||||
if postJsonObject.get('actor'):
|
||||
if not os.path.isfile(announceFilename + '.tts'):
|
||||
updateSpeaker(base_dir, httpPrefix,
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
postJsonObject, personCache,
|
||||
translate, postJsonObject['actor'],
|
||||
|
@ -1581,7 +1583,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
if displayName:
|
||||
if ':' in displayName:
|
||||
displayName = \
|
||||
addEmojiToDisplayName(session, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
displayName, False)
|
||||
titleStr += \
|
||||
|
@ -1750,7 +1752,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
replyAvatarImageInPost,
|
||||
containerClassIcons,
|
||||
containerClass) = _getPostTitleHtml(base_dir,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
nickname, domain,
|
||||
showRepeatIcon,
|
||||
isAnnounced,
|
||||
|
@ -1847,7 +1849,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
postJsonObject['object']['content']
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actorJson = \
|
||||
getPersonFromCache(base_dir, personUrl, personCache, False)
|
||||
languagesUnderstood = []
|
||||
|
@ -1903,7 +1905,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
if postJsonObject['object'].get('summary'):
|
||||
cwStr = str(postJsonObject['object']['summary'])
|
||||
cwStr = \
|
||||
addEmojiToDisplayName(session, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
cwStr, False)
|
||||
contentStr += \
|
||||
|
@ -1994,7 +1996,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
base_dir: str, session, cachedWebfingers: {},
|
||||
personCache: {},
|
||||
nickname: str, domain: str, port: int, authorized: bool,
|
||||
postJsonObject: {}, httpPrefix: str,
|
||||
postJsonObject: {}, http_prefix: str,
|
||||
projectVersion: str, likedBy: str,
|
||||
reactBy: str, reactEmoji: str,
|
||||
YTReplacementDomain: str,
|
||||
|
@ -2061,7 +2063,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
base_dir, session, cachedWebfingers, personCache,
|
||||
nickname, domain, port, postJsonObject,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -2092,7 +2094,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
nickname, domain, port,
|
||||
postJsonObject,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -2127,7 +2129,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
personCache,
|
||||
nickname, domain, port, item,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -2155,7 +2157,7 @@ def htmlPostReplies(cssCache: {},
|
|||
translate: {}, base_dir: str,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, repliesJson: {},
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
|
@ -2179,7 +2181,7 @@ def htmlPostReplies(cssCache: {},
|
|||
personCache,
|
||||
nickname, domain, port, item,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -2207,7 +2209,7 @@ def htmlEmojiReactionPicker(cssCache: {},
|
|||
base_dir: str, session, cachedWebfingers: {},
|
||||
personCache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
postJsonObject: {}, httpPrefix: str,
|
||||
postJsonObject: {}, http_prefix: str,
|
||||
projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -2231,7 +2233,7 @@ def htmlEmojiReactionPicker(cssCache: {},
|
|||
personCache,
|
||||
nickname, domain, port, postJsonObject,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
|
|
@ -124,7 +124,7 @@ def _validProfilePreviewPost(postJsonObject: {},
|
|||
def htmlProfileAfterSearch(cssCache: {},
|
||||
recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {},
|
||||
base_dir: str, path: str, httpPrefix: str,
|
||||
base_dir: str, path: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
profileHandle: str,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
|
@ -145,9 +145,9 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
"""
|
||||
http = False
|
||||
gnunet = False
|
||||
if httpPrefix == 'http':
|
||||
if http_prefix == 'http':
|
||||
http = True
|
||||
elif httpPrefix == 'gnunet':
|
||||
elif http_prefix == 'gnunet':
|
||||
gnunet = True
|
||||
profileJson, asHeader = \
|
||||
getActorJson(domain, profileHandle, http, gnunet, debug, False,
|
||||
|
@ -323,7 +323,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
userFeed = \
|
||||
parseUserFeed(signingPrivateKeyPem,
|
||||
session, outboxUrl, asHeader, projectVersion,
|
||||
httpPrefix, domain, debug)
|
||||
http_prefix, domain, debug)
|
||||
if userFeed:
|
||||
i = 0
|
||||
for item in userFeed:
|
||||
|
@ -339,7 +339,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
session, cachedWebfingers, personCache,
|
||||
nickname, domain, port,
|
||||
postJsonObject, avatarUrl, False, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -358,7 +358,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
profileStr + htmlFooter()
|
||||
|
||||
|
||||
def _getProfileHeader(base_dir: str, httpPrefix: str,
|
||||
def _getProfileHeader(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, translate: {},
|
||||
defaultTimeline: str,
|
||||
|
@ -416,7 +416,7 @@ def _getProfileHeader(base_dir: str, httpPrefix: str,
|
|||
otherAccountsHtml = \
|
||||
' <p>' + translate['Other accounts'] + ': '
|
||||
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
ctr = 0
|
||||
if isinstance(alsoKnownAs, list):
|
||||
for altActor in alsoKnownAs:
|
||||
|
@ -544,7 +544,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
defaultTimeline: str,
|
||||
recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {}, projectVersion: str,
|
||||
base_dir: str, httpPrefix: str, authorized: bool,
|
||||
base_dir: str, http_prefix: str, authorized: bool,
|
||||
profileJson: {}, selected: str,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
YTReplacementDomain: str,
|
||||
|
@ -573,7 +573,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
defaultTimeline,
|
||||
recentPostsCache, maxRecentPosts,
|
||||
translate, projectVersion,
|
||||
base_dir, httpPrefix, authorized,
|
||||
base_dir, http_prefix, authorized,
|
||||
profileJson, selected,
|
||||
session, cachedWebfingers, personCache,
|
||||
YTReplacementDomain,
|
||||
|
@ -590,12 +590,12 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
if not domain:
|
||||
return ""
|
||||
displayName = \
|
||||
addEmojiToDisplayName(session, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
profileJson['name'], True)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
profileDescription = \
|
||||
addEmojiToDisplayName(session, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
profileJson['summary'], False)
|
||||
postsButton = 'button'
|
||||
|
@ -752,7 +752,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
nick = followerHandle.split('@')[0]
|
||||
dom = followerHandle.split('@')[1]
|
||||
followerActor = \
|
||||
localActorUrl(httpPrefix, nick, dom)
|
||||
localActorUrl(http_prefix, nick, dom)
|
||||
|
||||
# is this a new domain?
|
||||
# if so then append a new instance indicator
|
||||
|
@ -839,7 +839,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
pinnedContent = pinFile.read()
|
||||
|
||||
profileHeaderStr = \
|
||||
_getProfileHeader(base_dir, httpPrefix,
|
||||
_getProfileHeader(base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
domainFull, translate,
|
||||
defaultTimeline, displayName,
|
||||
|
@ -954,7 +954,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
profileStr += \
|
||||
_htmlProfilePosts(recentPostsCache, maxRecentPosts,
|
||||
translate,
|
||||
base_dir, httpPrefix, authorized,
|
||||
base_dir, http_prefix, authorized,
|
||||
nickname, domain, port,
|
||||
session, cachedWebfingers, personCache,
|
||||
projectVersion,
|
||||
|
@ -970,7 +970,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
if not isGroup:
|
||||
if selected == 'following':
|
||||
profileStr += \
|
||||
_htmlProfileFollowing(translate, base_dir, httpPrefix,
|
||||
_htmlProfileFollowing(translate, base_dir, http_prefix,
|
||||
authorized, nickname,
|
||||
domain, port, session,
|
||||
cachedWebfingers, personCache, extraJson,
|
||||
|
@ -980,7 +980,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
signingPrivateKeyPem)
|
||||
if selected == 'followers':
|
||||
profileStr += \
|
||||
_htmlProfileFollowing(translate, base_dir, httpPrefix,
|
||||
_htmlProfileFollowing(translate, base_dir, http_prefix,
|
||||
authorized, nickname,
|
||||
domain, port, session,
|
||||
cachedWebfingers, personCache, extraJson,
|
||||
|
@ -1021,7 +1021,7 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
|
||||
def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||
translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
authorized: bool,
|
||||
nickname: str, domain: str, port: int,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
|
@ -1052,7 +1052,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
|||
personBoxJson({}, session, base_dir, domain,
|
||||
port,
|
||||
outboxFeedPathStr,
|
||||
httpPrefix,
|
||||
http_prefix,
|
||||
10, boxName,
|
||||
authorized, 0, False, 0)
|
||||
if not outboxFeed:
|
||||
|
@ -1070,7 +1070,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
|||
personCache,
|
||||
nickname, domain, port, item,
|
||||
None, True, False,
|
||||
httpPrefix, projectVersion, 'inbox',
|
||||
http_prefix, projectVersion, 'inbox',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -1090,7 +1090,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
|||
return profileStr
|
||||
|
||||
|
||||
def _htmlProfileFollowing(translate: {}, base_dir: str, httpPrefix: str,
|
||||
def _htmlProfileFollowing(translate: {}, base_dir: str, http_prefix: str,
|
||||
authorized: bool,
|
||||
nickname: str, domain: str, port: int,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
|
@ -1132,7 +1132,7 @@ def _htmlProfileFollowing(translate: {}, base_dir: str, httpPrefix: str,
|
|||
cachedWebfingers, personCache,
|
||||
domain, followingActor,
|
||||
authorized, nickname,
|
||||
httpPrefix, projectVersion, dormant,
|
||||
http_prefix, projectVersion, dormant,
|
||||
debug, buttons)
|
||||
|
||||
if authorized and maxItemsPerPage and pageNumber:
|
||||
|
@ -2084,7 +2084,7 @@ def _htmlEditProfileTopBanner(base_dir: str,
|
|||
|
||||
|
||||
def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
defaultTimeline: str, theme: str,
|
||||
peertubeInstances: [],
|
||||
textModeBanner: str, city: str,
|
||||
|
@ -2340,7 +2340,7 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str,
|
|||
followUrl: str,
|
||||
authorized: bool,
|
||||
actorNickname: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
projectVersion: str,
|
||||
dormant: bool,
|
||||
debug: bool,
|
||||
|
@ -2361,7 +2361,7 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str,
|
|||
# lookup the correct webfinger for the followUrl
|
||||
followUrlHandle = followUrlNickname + '@' + followUrlDomainFull
|
||||
followUrlWf = \
|
||||
webfingerHandle(session, followUrlHandle, httpPrefix,
|
||||
webfingerHandle(session, followUrlHandle, http_prefix,
|
||||
cachedWebfingers,
|
||||
domain, __version__, debug, False,
|
||||
signingPrivateKeyPem)
|
||||
|
@ -2373,14 +2373,14 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str,
|
|||
base_dir, session,
|
||||
followUrlWf,
|
||||
personCache, projectVersion,
|
||||
httpPrefix, followUrlNickname,
|
||||
http_prefix, followUrlNickname,
|
||||
domain, 'outbox', 43036)
|
||||
if avatarUrl2:
|
||||
avatarUrl = avatarUrl2
|
||||
|
||||
if displayName:
|
||||
displayName = \
|
||||
addEmojiToDisplayName(None, base_dir, httpPrefix,
|
||||
addEmojiToDisplayName(None, base_dir, http_prefix,
|
||||
actorNickname, domain,
|
||||
displayName, False)
|
||||
titleStr = displayName
|
||||
|
|
|
@ -43,7 +43,7 @@ from webapp_hashtagswarm import htmlHashTagSwarm
|
|||
|
||||
|
||||
def htmlSearchEmoji(cssCache: {}, translate: {},
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
searchStr: str) -> str:
|
||||
"""Search results for emoji
|
||||
"""
|
||||
|
@ -172,7 +172,7 @@ def _htmlSearchResultSharePage(actor: str, domainFull: str,
|
|||
def _htmlSharesResult(base_dir: str,
|
||||
sharesJson: {}, pageNumber: int, resultsPerPage: int,
|
||||
searchStrLowerList: [], currPage: int, ctr: int,
|
||||
callingDomain: str, httpPrefix: str, domainFull: str,
|
||||
callingDomain: str, http_prefix: str, domainFull: str,
|
||||
contactNickname: str, actor: str,
|
||||
resultsExist: bool, searchStrLower: str, translate: {},
|
||||
sharesFileType: str) -> (bool, int, int, str):
|
||||
|
@ -188,7 +188,7 @@ def _htmlSharesResult(base_dir: str,
|
|||
# show individual search result
|
||||
sharedItemsForm += \
|
||||
htmlSearchResultShare(base_dir, sharedItem, translate,
|
||||
httpPrefix, domainFull,
|
||||
http_prefix, domainFull,
|
||||
contactNickname,
|
||||
name, actor, sharesFileType,
|
||||
sharedItem['category'])
|
||||
|
@ -221,7 +221,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
base_dir: str, searchStr: str,
|
||||
pageNumber: int,
|
||||
resultsPerPage: int,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
domainFull: str, actor: str,
|
||||
callingDomain: str,
|
||||
sharedItemsFederatedDomains: [],
|
||||
|
@ -269,7 +269,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
resultsPerPage,
|
||||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, httpPrefix,
|
||||
callingDomain, http_prefix,
|
||||
domainFull,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
|
@ -307,7 +307,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
resultsPerPage,
|
||||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, httpPrefix,
|
||||
callingDomain, http_prefix,
|
||||
domainFull,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
|
@ -456,7 +456,7 @@ def htmlSearch(cssCache: {}, translate: {},
|
|||
|
||||
def htmlSkillsSearch(actor: str,
|
||||
cssCache: {}, translate: {}, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
skillsearch: str, instanceOnly: bool,
|
||||
postsPerPage: int) -> str:
|
||||
"""Show a page containing search results for a skill
|
||||
|
@ -586,7 +586,7 @@ def htmlSkillsSearch(actor: str,
|
|||
|
||||
|
||||
def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
|
||||
httpPrefix: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
historysearch: str,
|
||||
postsPerPage: int, pageNumber: int,
|
||||
|
@ -630,7 +630,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
|
|||
|
||||
# add the page title
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
historySearchTitle = '🔍 ' + translate['Your Posts']
|
||||
if boxName == 'bookmarks':
|
||||
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
||||
|
@ -682,7 +682,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
|
|||
nickname, domain, port,
|
||||
postJsonObject,
|
||||
None, True, allowDeletion,
|
||||
httpPrefix, projectVersion,
|
||||
http_prefix, projectVersion,
|
||||
'search',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -709,7 +709,7 @@ def htmlHashtagSearch(cssCache: {},
|
|||
base_dir: str, hashtag: str, pageNumber: int,
|
||||
postsPerPage: int,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
|
@ -865,7 +865,7 @@ def htmlHashtagSearch(cssCache: {},
|
|||
postJsonObject,
|
||||
avatarUrl, showAvatarOptions,
|
||||
allowDeletion,
|
||||
httpPrefix, projectVersion,
|
||||
http_prefix, projectVersion,
|
||||
'search',
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -902,7 +902,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
|||
base_dir: str, hashtag: str,
|
||||
postsPerPage: int,
|
||||
session, cachedWebfingers: {}, personCache: {},
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
systemLanguage: str) -> str:
|
||||
|
@ -937,7 +937,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
|||
|
||||
maxFeedLength = 10
|
||||
hashtagFeed = \
|
||||
rss2TagHeader(hashtag, httpPrefix, domainFull)
|
||||
rss2TagHeader(hashtag, http_prefix, domainFull)
|
||||
for index in range(len(lines)):
|
||||
postId = lines[index].strip('\n').strip('\r')
|
||||
if ' ' not in postId:
|
||||
|
|
|
@ -357,7 +357,7 @@ def _htmlTimelineKeyboard(moderator: bool, textModeBanner: str, usersPath: str,
|
|||
|
||||
|
||||
def _htmlTimelineEnd(base_dir: str, nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
http_prefix: str, translate: {},
|
||||
moderator: bool, editor: bool,
|
||||
newswire: {}, positiveVoting: bool,
|
||||
showPublishAsIcon: bool,
|
||||
|
@ -376,7 +376,7 @@ def _htmlTimelineEnd(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
# right column
|
||||
rightColumnStr = getRightColumnContent(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positiveVoting,
|
||||
False, None, True,
|
||||
|
@ -424,7 +424,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, timelineJson: {},
|
||||
boxName: str, allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
manuallyApproveFollowers: bool,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
|
@ -612,7 +612,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
fullDomain = getFullDomain(domain, port)
|
||||
|
||||
usersPath = '/users/' + nickname
|
||||
actor = httpPrefix + '://' + fullDomain + usersPath
|
||||
actor = http_prefix + '://' + fullDomain + usersPath
|
||||
|
||||
showIndividualPostIcons = True
|
||||
|
||||
|
@ -744,7 +744,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
# left column
|
||||
leftColumnStr = \
|
||||
getLeftColumnContent(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
editor, artist, False, None, rssIconAtTop,
|
||||
True, False, theme, accessKeys,
|
||||
sharedItemsFederatedDomains)
|
||||
|
@ -785,10 +785,10 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
return (tlStr +
|
||||
_htmlSharesTimeline(translate, pageNumber, itemsPerPage,
|
||||
base_dir, actor, nickname, domain, port,
|
||||
maxSharesPerAccount, httpPrefix,
|
||||
maxSharesPerAccount, http_prefix,
|
||||
sharedItemsFederatedDomains, 'shares') +
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positiveVoting,
|
||||
showPublishAsIcon,
|
||||
|
@ -803,10 +803,10 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
return (tlStr +
|
||||
_htmlSharesTimeline(translate, pageNumber, itemsPerPage,
|
||||
base_dir, actor, nickname, domain, port,
|
||||
maxSharesPerAccount, httpPrefix,
|
||||
maxSharesPerAccount, http_prefix,
|
||||
sharedItemsFederatedDomains, 'wanted') +
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positiveVoting,
|
||||
showPublishAsIcon,
|
||||
|
@ -903,7 +903,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
nickname, domain, port,
|
||||
item, None, True,
|
||||
allowDeletion,
|
||||
httpPrefix, projectVersion,
|
||||
http_prefix, projectVersion,
|
||||
boxName,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -954,7 +954,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
|
||||
tlStr += \
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positiveVoting,
|
||||
showPublishAsIcon,
|
||||
|
@ -1042,7 +1042,7 @@ def htmlIndividualShare(domain: str, shareId: str,
|
|||
def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
||||
base_dir: str, actor: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
maxSharesPerAccount: int, httpPrefix: str,
|
||||
maxSharesPerAccount: int, http_prefix: str,
|
||||
sharedItemsFederatedDomains: [],
|
||||
sharesFileType: str) -> str:
|
||||
"""Show shared items timeline as html
|
||||
|
@ -1052,12 +1052,12 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
|||
base_dir, domain, nickname, maxSharesPerAccount,
|
||||
sharedItemsFederatedDomains, sharesFileType)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
adminActor = ''
|
||||
if adminNickname:
|
||||
adminActor = \
|
||||
localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||
localActorUrl(http_prefix, adminNickname, domainFull)
|
||||
timelineStr = ''
|
||||
|
||||
if pageNumber > 1:
|
||||
|
@ -1124,7 +1124,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
|
@ -1156,7 +1156,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, None,
|
||||
'tlshares', allowDeletion,
|
||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||
http_prefix, projectVersion, manuallyApproveFollowers,
|
||||
False,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1179,7 +1179,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
showPublishedDateOnly: bool,
|
||||
|
@ -1211,7 +1211,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, None,
|
||||
'tlwanted', allowDeletion,
|
||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||
http_prefix, projectVersion, manuallyApproveFollowers,
|
||||
False,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1234,7 +1234,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1267,7 +1267,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson,
|
||||
'inbox', allowDeletion,
|
||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||
http_prefix, projectVersion, manuallyApproveFollowers,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1290,7 +1290,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, bookmarksJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1323,7 +1323,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, bookmarksJson,
|
||||
'tlbookmarks', allowDeletion,
|
||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||
http_prefix, projectVersion, manuallyApproveFollowers,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1346,7 +1346,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1375,7 +1375,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'dm', allowDeletion,
|
||||
httpPrefix, projectVersion, False, minimal,
|
||||
http_prefix, projectVersion, False, minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
showPublishedDateOnly,
|
||||
|
@ -1397,7 +1397,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1426,7 +1426,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'tlreplies',
|
||||
allowDeletion, httpPrefix, projectVersion, False,
|
||||
allowDeletion, http_prefix, projectVersion, False,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1449,7 +1449,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1478,7 +1478,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'tlmedia',
|
||||
allowDeletion, httpPrefix, projectVersion, False,
|
||||
allowDeletion, http_prefix, projectVersion, False,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1501,7 +1501,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1530,7 +1530,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'tlblogs',
|
||||
allowDeletion, httpPrefix, projectVersion, False,
|
||||
allowDeletion, http_prefix, projectVersion, False,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1553,7 +1553,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1582,7 +1582,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'tlfeatures',
|
||||
allowDeletion, httpPrefix, projectVersion, False,
|
||||
allowDeletion, http_prefix, projectVersion, False,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1605,7 +1605,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, inboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1633,7 +1633,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, inboxJson, 'tlnews',
|
||||
allowDeletion, httpPrefix, projectVersion, False,
|
||||
allowDeletion, http_prefix, projectVersion, False,
|
||||
minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
@ -1656,7 +1656,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
nickname: str, domain: str, port: int, outboxJson: {},
|
||||
allowDeletion: bool,
|
||||
httpPrefix: str, projectVersion: str,
|
||||
http_prefix: str, projectVersion: str,
|
||||
minimal: bool,
|
||||
YTReplacementDomain: str,
|
||||
twitterReplacementDomain: str,
|
||||
|
@ -1687,7 +1687,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
|
|||
itemsPerPage, session, base_dir,
|
||||
cachedWebfingers, personCache,
|
||||
nickname, domain, port, outboxJson, 'outbox',
|
||||
allowDeletion, httpPrefix, projectVersion,
|
||||
allowDeletion, http_prefix, projectVersion,
|
||||
manuallyApproveFollowers, minimal,
|
||||
YTReplacementDomain,
|
||||
twitterReplacementDomain,
|
||||
|
|
|
@ -17,7 +17,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlTermsOfService(cssCache: {}, base_dir: str,
|
||||
httpPrefix: str, domainFull: str) -> str:
|
||||
http_prefix: str, domainFull: str) -> str:
|
||||
"""Show the terms of service screen
|
||||
"""
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
|
@ -45,7 +45,7 @@ def htmlTermsOfService(cssCache: {}, base_dir: str,
|
|||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||
if adminNickname:
|
||||
adminActor = localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||
adminActor = localActorUrl(http_prefix, adminNickname, domainFull)
|
||||
TOSForm += \
|
||||
'<div class="container"><center>\n' + \
|
||||
'<p class="administeredby">Administered by <a href="' + \
|
||||
|
|
|
@ -234,7 +234,7 @@ def setBlogAddress(actorJson: {}, blogAddress: str) -> None:
|
|||
|
||||
|
||||
def updateAvatarImageCache(signingPrivateKeyPem: str,
|
||||
session, base_dir: str, httpPrefix: str,
|
||||
session, base_dir: str, http_prefix: str,
|
||||
actor: str, avatarUrl: str,
|
||||
personCache: {}, allowDownloads: bool,
|
||||
force: bool = False, debug: bool = False) -> str:
|
||||
|
@ -306,7 +306,7 @@ def updateAvatarImageCache(signingPrivateKeyPem: str,
|
|||
}
|
||||
personJson = \
|
||||
getJson(signingPrivateKeyPem, session, actor, sessionHeaders, None,
|
||||
debug, __version__, httpPrefix, None)
|
||||
debug, __version__, http_prefix, None)
|
||||
if personJson:
|
||||
if not personJson.get('id'):
|
||||
return None
|
||||
|
@ -735,7 +735,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
|||
|
||||
|
||||
def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
|
||||
httpPrefix: str, domain: str,
|
||||
http_prefix: str, domain: str,
|
||||
systemLanguage: str) -> str:
|
||||
"""html header which includes website markup
|
||||
https://schema.org/WebSite
|
||||
|
@ -751,7 +751,7 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
|
|||
' "@context" : "http://schema.org",\n' + \
|
||||
' "@type" : "WebSite",\n' + \
|
||||
' "name": "' + instanceTitle + '",\n' + \
|
||||
' "url": "' + httpPrefix + '://' + domain + '",\n' + \
|
||||
' "url": "' + http_prefix + '://' + domain + '",\n' + \
|
||||
' "license": "' + licenseUrl + '",\n' + \
|
||||
' "inLanguage": "' + systemLanguage + '",\n' + \
|
||||
' "isAccessibleForFree": true,\n' + \
|
||||
|
@ -774,12 +774,12 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
|
|||
ogMetadata = \
|
||||
' <meta content="Epicyon hosted on ' + domain + \
|
||||
'" property="og:site_name" />\n' + \
|
||||
' <meta content="' + httpPrefix + '://' + domain + \
|
||||
' <meta content="' + http_prefix + '://' + domain + \
|
||||
'/about" property="og:url" />\n' + \
|
||||
' <meta content="website" property="og:type" />\n' + \
|
||||
' <meta content="' + instanceTitle + \
|
||||
'" property="og:title" />\n' + \
|
||||
' <meta content="' + httpPrefix + '://' + domain + \
|
||||
' <meta content="' + http_prefix + '://' + domain + \
|
||||
'/logo.png" property="og:image" />\n' + \
|
||||
' <meta content="' + systemLanguage + \
|
||||
'" property="og:locale" />\n' + \
|
||||
|
@ -793,7 +793,7 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
|
|||
|
||||
|
||||
def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
|
||||
httpPrefix: str, domain: str, nickname: str,
|
||||
http_prefix: str, domain: str, nickname: str,
|
||||
systemLanguage: str,
|
||||
published: str, modified: str,
|
||||
title: str, snippet: str,
|
||||
|
@ -802,8 +802,8 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
|
|||
"""html header which includes blog post markup
|
||||
https://schema.org/BlogPosting
|
||||
"""
|
||||
authorUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||
aboutUrl = httpPrefix + '://' + domain + '/about.html'
|
||||
authorUrl = localActorUrl(http_prefix, nickname, domain)
|
||||
aboutUrl = http_prefix + '://' + domain + '/about.html'
|
||||
|
||||
# license for content on the site may be different from
|
||||
# the software license
|
||||
|
@ -888,7 +888,7 @@ def loadIndividualPostAsHtmlFromCache(base_dir: str,
|
|||
return postHtml
|
||||
|
||||
|
||||
def addEmojiToDisplayName(session, base_dir: str, httpPrefix: str,
|
||||
def addEmojiToDisplayName(session, base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
displayName: str, inProfileName: bool) -> str:
|
||||
"""Adds emoji icons to display names or CW on individual posts
|
||||
|
@ -900,7 +900,7 @@ def addEmojiToDisplayName(session, base_dir: str, httpPrefix: str,
|
|||
emojiTags = {}
|
||||
# print('TAG: displayName before tags: ' + displayName)
|
||||
displayName = \
|
||||
addHtmlTags(base_dir, httpPrefix,
|
||||
addHtmlTags(base_dir, http_prefix,
|
||||
nickname, domain, displayName, [], emojiTags)
|
||||
displayName = displayName.replace('<p>', '').replace('</p>', '')
|
||||
# print('TAG: displayName after tags: ' + displayName)
|
||||
|
@ -1231,7 +1231,7 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str:
|
|||
|
||||
|
||||
def getAvatarImageUrl(session,
|
||||
base_dir: str, httpPrefix: str,
|
||||
base_dir: str, http_prefix: str,
|
||||
postActor: str, personCache: {},
|
||||
avatarUrl: str, allowDownloads: bool,
|
||||
signingPrivateKeyPem: str) -> str:
|
||||
|
@ -1244,12 +1244,12 @@ def getAvatarImageUrl(session,
|
|||
allowDownloads)
|
||||
avatarUrl = \
|
||||
updateAvatarImageCache(signingPrivateKeyPem,
|
||||
session, base_dir, httpPrefix,
|
||||
session, base_dir, http_prefix,
|
||||
postActor, avatarUrl, personCache,
|
||||
allowDownloads)
|
||||
else:
|
||||
updateAvatarImageCache(signingPrivateKeyPem,
|
||||
session, base_dir, httpPrefix,
|
||||
session, base_dir, http_prefix,
|
||||
postActor, avatarUrl, personCache,
|
||||
allowDownloads)
|
||||
|
||||
|
@ -1406,7 +1406,7 @@ def editTextArea(label: str, name: str, value: str,
|
|||
|
||||
|
||||
def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
contactNickname: str, itemID: str,
|
||||
actor: str, sharesFileType: str,
|
||||
category: str) -> str:
|
||||
|
@ -1448,7 +1448,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
|||
contactTitleStr = translate['Buy']
|
||||
sharedItemsForm += '</p>\n'
|
||||
contactActor = \
|
||||
localActorUrl(httpPrefix, contactNickname, domainFull)
|
||||
localActorUrl(http_prefix, contactNickname, domainFull)
|
||||
buttonStyleStr = 'button'
|
||||
if category == 'accommodation':
|
||||
contactTitleStr = translate['Request to stay']
|
||||
|
@ -1493,7 +1493,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
|||
|
||||
|
||||
def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
itemID: str, translate: {},
|
||||
sharedItemsFederatedDomains: [],
|
||||
defaultTimeline: str, theme: str,
|
||||
|
@ -1545,7 +1545,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
if not sharesJson.get(itemID):
|
||||
return None
|
||||
sharedItem = sharesJson[itemID]
|
||||
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
|
||||
# filename of the banner shown at the top
|
||||
bannerFile, bannerFilename = \
|
||||
|
@ -1560,7 +1560,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
'src="/users/' + nickname + '/' + bannerFile + '" /></a>\n' + \
|
||||
'</header><br>\n'
|
||||
shareStr += \
|
||||
htmlSearchResultShare(base_dir, sharedItem, translate, httpPrefix,
|
||||
htmlSearchResultShare(base_dir, sharedItem, translate, http_prefix,
|
||||
domainFull, contactNickname, itemID,
|
||||
actor, sharesFileType, category)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlWelcomeFinal(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
language: str, translate: {},
|
||||
themeName: str) -> str:
|
||||
"""Returns the final welcome screen after first login
|
||||
|
|
|
@ -23,7 +23,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
||||
httpPrefix: str, domainFull: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
language: str, translate: {},
|
||||
themeName: str) -> str:
|
||||
"""Returns the welcome profile screen to set avatar and bio
|
||||
|
@ -76,7 +76,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
|||
if os.path.isfile(avatarFilename):
|
||||
break
|
||||
avatarUrl = \
|
||||
localActorUrl(httpPrefix, nickname, domainFull) + '/avatar.' + ext
|
||||
localActorUrl(http_prefix, nickname, domainFull) + '/avatar.' + ext
|
||||
|
||||
imageFormats = getImageFormats()
|
||||
profileForm += '<div class="container">' + profileText + '</div>\n'
|
||||
|
|
28
webfinger.py
28
webfinger.py
|
@ -60,7 +60,7 @@ def _parseHandle(handle: str) -> (str, str, bool):
|
|||
return None, None, False
|
||||
|
||||
|
||||
def webfingerHandle(session, handle: str, httpPrefix: str,
|
||||
def webfingerHandle(session, handle: str, http_prefix: str,
|
||||
cachedWebfingers: {},
|
||||
fromDomain: str, projectVersion: str,
|
||||
debug: bool, groupAccount: bool,
|
||||
|
@ -83,7 +83,7 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
|
|||
if debug:
|
||||
print('Webfinger from cache: ' + str(wf))
|
||||
return wf
|
||||
url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain)
|
||||
url = '{}://{}/.well-known/webfinger'.format(http_prefix, domain)
|
||||
hdr = {
|
||||
'Accept': 'application/jrd+json'
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
|
|||
try:
|
||||
result = \
|
||||
getJson(signingPrivateKeyPem, session, url, hdr, par,
|
||||
debug, projectVersion, httpPrefix, fromDomain)
|
||||
debug, projectVersion, http_prefix, fromDomain)
|
||||
except Exception as ex:
|
||||
print('ERROR: webfingerHandle ' + str(ex))
|
||||
return None
|
||||
|
@ -131,7 +131,7 @@ def storeWebfingerEndpoint(nickname: str, domain: str, port: int,
|
|||
|
||||
|
||||
def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
||||
httpPrefix: str, publicKeyPem: str,
|
||||
http_prefix: str, publicKeyPem: str,
|
||||
groupAccount: bool) -> {}:
|
||||
"""Creates a webfinger endpoint for a user
|
||||
"""
|
||||
|
@ -139,17 +139,17 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
|||
domain = getFullDomain(domain, port)
|
||||
|
||||
personName = nickname
|
||||
personId = localActorUrl(httpPrefix, personName, domain)
|
||||
personId = localActorUrl(http_prefix, personName, domain)
|
||||
subjectStr = "acct:" + personName + "@" + originalDomain
|
||||
profilePageHref = httpPrefix + "://" + domain + "/@" + nickname
|
||||
profilePageHref = http_prefix + "://" + domain + "/@" + nickname
|
||||
if nickname == 'inbox' or nickname == originalDomain:
|
||||
personName = 'actor'
|
||||
personId = httpPrefix + "://" + domain + "/" + personName
|
||||
personId = http_prefix + "://" + domain + "/" + personName
|
||||
subjectStr = "acct:" + originalDomain + "@" + originalDomain
|
||||
profilePageHref = httpPrefix + '://' + domain + \
|
||||
profilePageHref = http_prefix + '://' + domain + \
|
||||
'/about/more?instance_actor=true'
|
||||
|
||||
personLink = httpPrefix + "://" + domain + "/@" + personName
|
||||
personLink = http_prefix + "://" + domain + "/@" + personName
|
||||
account = {
|
||||
"aliases": [
|
||||
personLink,
|
||||
|
@ -162,7 +162,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
|||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"href": httpPrefix + "://" + domain + "/blog/" + personName,
|
||||
"href": http_prefix + "://" + domain + "/blog/" + personName,
|
||||
"rel": "http://webfinger.net/rel/blog"
|
||||
},
|
||||
{
|
||||
|
@ -181,13 +181,13 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
|||
return account
|
||||
|
||||
|
||||
def webfingerNodeInfo(httpPrefix: str, domainFull: str) -> {}:
|
||||
def webfingerNodeInfo(http_prefix: str, domainFull: str) -> {}:
|
||||
""" /.well-known/nodeinfo endpoint
|
||||
"""
|
||||
nodeinfo = {
|
||||
'links': [
|
||||
{
|
||||
'href': httpPrefix + '://' + domainFull + '/nodeinfo/2.0',
|
||||
'href': http_prefix + '://' + domainFull + '/nodeinfo/2.0',
|
||||
'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.0'
|
||||
}
|
||||
]
|
||||
|
@ -195,7 +195,7 @@ def webfingerNodeInfo(httpPrefix: str, domainFull: str) -> {}:
|
|||
return nodeinfo
|
||||
|
||||
|
||||
def webfingerMeta(httpPrefix: str, domainFull: str) -> str:
|
||||
def webfingerMeta(http_prefix: str, domainFull: str) -> str:
|
||||
"""Return /.well-known/host-meta
|
||||
"""
|
||||
metaStr = \
|
||||
|
@ -206,7 +206,7 @@ def webfingerMeta(httpPrefix: str, domainFull: str) -> str:
|
|||
"<hm:Host>" + domainFull + "</hm:Host>" + \
|
||||
"" + \
|
||||
"<Link rel=’lrdd’" + \
|
||||
" template=’" + httpPrefix + "://" + domainFull + \
|
||||
" template=’" + http_prefix + "://" + domainFull + \
|
||||
"/describe?uri={uri}'>" + \
|
||||
" <Title>Resource Descriptor</Title>" + \
|
||||
" </Link>" + \
|
||||
|
|
Loading…
Reference in New Issue