mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
0203107e1a
commit
2e157b5441
6
cache.py
6
cache.py
|
@ -139,7 +139,7 @@ def getWebfingerFromCache(handle: str, cachedWebfingers: {}) -> {}:
|
|||
def getPersonPubKey(base_dir: str, session, personUrl: str,
|
||||
personCache: {}, debug: bool,
|
||||
project_version: str, http_prefix: str,
|
||||
domain: str, onionDomain: str,
|
||||
domain: str, onion_domain: str,
|
||||
signingPrivateKeyPem: str) -> str:
|
||||
if not personUrl:
|
||||
return None
|
||||
|
@ -158,9 +158,9 @@ def getPersonPubKey(base_dir: str, session, personUrl: str,
|
|||
if debug:
|
||||
print('DEBUG: Obtaining public key for ' + personUrl)
|
||||
personDomain = domain
|
||||
if onionDomain:
|
||||
if onion_domain:
|
||||
if '.onion/' in personUrl:
|
||||
personDomain = onionDomain
|
||||
personDomain = onion_domain
|
||||
profileStr = 'https://www.w3.org/ns/activitystreams'
|
||||
asHeader = {
|
||||
'Accept': 'application/activity+json; profile="' + profileStr + '"'
|
||||
|
|
10
epicyon.py
10
epicyon.py
|
@ -1055,8 +1055,8 @@ if args.onion:
|
|||
sys.exit()
|
||||
if '://' in args.onion:
|
||||
args.onion = args.onion.split('://')[1]
|
||||
onionDomain = args.onion
|
||||
setConfigParam(base_dir, 'onion', onionDomain)
|
||||
onion_domain = args.onion
|
||||
setConfigParam(base_dir, 'onion', onion_domain)
|
||||
|
||||
i2pDomain = None
|
||||
if args.i2pDomain:
|
||||
|
@ -1116,9 +1116,9 @@ else:
|
|||
# get onion domain name from configuration
|
||||
configOnionDomain = getConfigParam(base_dir, 'onion')
|
||||
if configOnionDomain:
|
||||
onionDomain = configOnionDomain
|
||||
onion_domain = configOnionDomain
|
||||
else:
|
||||
onionDomain = None
|
||||
onion_domain = None
|
||||
|
||||
# get i2p domain name from configuration
|
||||
configi2pDomain = getConfigParam(base_dir, 'i2pDomain')
|
||||
|
@ -3247,7 +3247,7 @@ if __name__ == "__main__":
|
|||
not args.nosharedinbox,
|
||||
registration, args.language, __version__,
|
||||
instance_id, args.client, base_dir,
|
||||
domain, onionDomain, i2pDomain,
|
||||
domain, onion_domain, i2pDomain,
|
||||
args.yt_replace_domain,
|
||||
args.twitterReplacementDomain,
|
||||
port, proxyPort, http_prefix,
|
||||
|
|
68
inbox.py
68
inbox.py
|
@ -992,7 +992,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
|
|||
def _receiveLike(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
onionDomain: str,
|
||||
onion_domain: str,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool,
|
||||
|
@ -1050,7 +1050,7 @@ def _receiveLike(recentPostsCache: {},
|
|||
handleName, handleDom,
|
||||
postLikedId,
|
||||
likeActor):
|
||||
_likeNotify(base_dir, domain, onionDomain, handle,
|
||||
_likeNotify(base_dir, domain, onion_domain, handle,
|
||||
likeActor, postLikedId)
|
||||
updateLikesCollection(recentPostsCache, base_dir, postFilename,
|
||||
postLikedId, likeActor,
|
||||
|
@ -1226,7 +1226,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
|||
def _receiveReaction(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
http_prefix: str, domain: str, port: int,
|
||||
onionDomain: str,
|
||||
onion_domain: str,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool,
|
||||
|
@ -1308,7 +1308,7 @@ def _receiveReaction(recentPostsCache: {},
|
|||
postReactionId,
|
||||
reactionActor,
|
||||
emojiContent):
|
||||
_reactionNotify(base_dir, domain, onionDomain, handle,
|
||||
_reactionNotify(base_dir, domain, onion_domain, handle,
|
||||
reactionActor, postReactionId, emojiContent)
|
||||
updateReactionCollection(recentPostsCache, base_dir, postFilename,
|
||||
postReactionId, reactionActor,
|
||||
|
@ -1796,7 +1796,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
def _receiveAnnounce(recentPostsCache: {},
|
||||
session, handle: str, isGroup: bool, base_dir: str,
|
||||
http_prefix: str,
|
||||
domain: str, onionDomain: str, port: int,
|
||||
domain: str, onion_domain: str, port: int,
|
||||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, messageJson: {}, federationList: [],
|
||||
debug: bool, translate: {},
|
||||
|
@ -1946,8 +1946,8 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
if not postJsonObject:
|
||||
print('WARN: unable to download announce: ' + str(messageJson))
|
||||
notInOnion = True
|
||||
if onionDomain:
|
||||
if onionDomain in messageJson['object']:
|
||||
if onion_domain:
|
||||
if onion_domain in messageJson['object']:
|
||||
notInOnion = False
|
||||
if domain not in messageJson['object'] and notInOnion:
|
||||
if os.path.isfile(postFilename):
|
||||
|
@ -2004,7 +2004,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
getPersonPubKey(base_dir, session, lookupActor,
|
||||
personCache, debug,
|
||||
__version__, http_prefix,
|
||||
domain, onionDomain,
|
||||
domain, onion_domain,
|
||||
signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
if debug:
|
||||
|
@ -2290,7 +2290,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
|
||||
domain: str, onionDomain: str, personCache: {},
|
||||
domain: str, onion_domain: str, personCache: {},
|
||||
postJsonObject: {}, debug: bool,
|
||||
signingPrivateKeyPem: str) -> None:
|
||||
"""Tries to obtain the actor for the person being replied to
|
||||
|
@ -2323,7 +2323,7 @@ def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
|
|||
getPersonPubKey(base_dir, session, lookupActor,
|
||||
personCache, debug,
|
||||
__version__, http_prefix,
|
||||
domain, onionDomain, signingPrivateKeyPem)
|
||||
domain, onion_domain, signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
if debug:
|
||||
print('DEBUG: public key obtained for reply: ' + lookupActor)
|
||||
|
@ -2413,7 +2413,7 @@ def _alreadyReacted(base_dir: str, nickname: str, domain: str,
|
|||
return False
|
||||
|
||||
|
||||
def _likeNotify(base_dir: str, domain: str, onionDomain: str,
|
||||
def _likeNotify(base_dir: str, domain: str, onion_domain: str,
|
||||
handle: str, actor: str, url: str) -> None:
|
||||
"""Creates a notification that a like has arrived
|
||||
"""
|
||||
|
@ -2424,9 +2424,9 @@ def _likeNotify(base_dir: str, domain: str, onionDomain: str,
|
|||
# check that the liked post was by this handle
|
||||
nickname = handle.split('@')[0]
|
||||
if '/' + domain + '/users/' + nickname not in url:
|
||||
if not onionDomain:
|
||||
if not onion_domain:
|
||||
return
|
||||
if '/' + onionDomain + '/users/' + nickname not in url:
|
||||
if '/' + onion_domain + '/users/' + nickname not in url:
|
||||
return
|
||||
|
||||
accountDir = base_dir + '/accounts/' + handle
|
||||
|
@ -2474,7 +2474,7 @@ def _likeNotify(base_dir: str, domain: str, onionDomain: str,
|
|||
likeFile)
|
||||
|
||||
|
||||
def _reactionNotify(base_dir: str, domain: str, onionDomain: str,
|
||||
def _reactionNotify(base_dir: str, domain: str, onion_domain: str,
|
||||
handle: str, actor: str,
|
||||
url: str, emojiContent: str) -> None:
|
||||
"""Creates a notification that an emoji reaction has arrived
|
||||
|
@ -2486,9 +2486,9 @@ def _reactionNotify(base_dir: str, domain: str, onionDomain: str,
|
|||
# check that the reaction post was by this handle
|
||||
nickname = handle.split('@')[0]
|
||||
if '/' + domain + '/users/' + nickname not in url:
|
||||
if not onionDomain:
|
||||
if not onion_domain:
|
||||
return
|
||||
if '/' + onionDomain + '/users/' + nickname not in url:
|
||||
if '/' + onion_domain + '/users/' + nickname not in url:
|
||||
return
|
||||
|
||||
accountDir = base_dir + '/accounts/' + handle
|
||||
|
@ -2611,7 +2611,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
sendThreads: [], postLog: [], cachedWebfingers: {},
|
||||
personCache: {}, debug: bool,
|
||||
systemLanguage: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
onion_domain: str, i2pDomain: str,
|
||||
signingPrivateKeyPem: str) -> None:
|
||||
"""When a post arrives for a group send it out to the group members
|
||||
"""
|
||||
|
@ -2666,7 +2666,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
debug, __version__, signingPrivateKeyPem)
|
||||
|
||||
sendToFollowersThread(session, base_dir, nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
onion_domain, i2pDomain, port,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
|
@ -2974,7 +2974,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, handle: str, debug: bool,
|
||||
postJsonObject: {}, recentPostsCache: {},
|
||||
session, onionDomain: str, i2pDomain: str, port: int,
|
||||
session, onion_domain: str, i2pDomain: str, port: int,
|
||||
federationList: [], sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
signingPrivateKeyPem: str,
|
||||
|
@ -3050,7 +3050,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
|||
shared_items_federated_domains = []
|
||||
sharedItemFederationTokens = {}
|
||||
sendToFollowersThread(session, base_dir, nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
onion_domain, i2pDomain, port,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
|
@ -3180,7 +3180,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
base_dir: str, http_prefix: str, sendThreads: [],
|
||||
postLog: [], cachedWebfingers: {}, personCache: {},
|
||||
queue: [], domain: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
onion_domain: str, i2pDomain: str,
|
||||
port: int, proxyType: str,
|
||||
federationList: [], debug: bool,
|
||||
queueFilename: str, destinationFilename: str,
|
||||
|
@ -3214,7 +3214,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
session, handle, isGroup,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
onionDomain,
|
||||
onion_domain,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -3259,7 +3259,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
session, handle, isGroup,
|
||||
base_dir, http_prefix,
|
||||
domain, port,
|
||||
onionDomain,
|
||||
onion_domain,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -3350,7 +3350,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
if _receiveAnnounce(recentPostsCache,
|
||||
session, handle, isGroup,
|
||||
base_dir, http_prefix,
|
||||
domain, onionDomain, port,
|
||||
domain, onion_domain, port,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers,
|
||||
personCache,
|
||||
|
@ -3450,7 +3450,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
_receiveQuestionVote(base_dir, nickname, domain,
|
||||
http_prefix, handle, debug,
|
||||
postJsonObject, recentPostsCache,
|
||||
session, onionDomain, i2pDomain, port,
|
||||
session, onion_domain, i2pDomain, port,
|
||||
federationList, sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
signingPrivateKeyPem,
|
||||
|
@ -3511,7 +3511,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
|
||||
# get the avatar for a reply/announce
|
||||
_obtainAvatarForReplyPost(session, base_dir,
|
||||
http_prefix, domain, onionDomain,
|
||||
http_prefix, domain, onion_domain,
|
||||
personCache, postJsonObject, debug,
|
||||
signingPrivateKeyPem)
|
||||
|
||||
|
@ -3610,7 +3610,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
http_prefix, federationList, sendThreads,
|
||||
postLog, cachedWebfingers, personCache,
|
||||
debug, systemLanguage,
|
||||
onionDomain, i2pDomain,
|
||||
onion_domain, i2pDomain,
|
||||
signingPrivateKeyPem)
|
||||
|
||||
# if the post wasn't saved
|
||||
|
@ -3848,7 +3848,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
cachedWebfingers: {}, personCache: {},
|
||||
messageJson: {}, federationList: [],
|
||||
debug: bool, project_version: str,
|
||||
max_followers: int, onionDomain: str,
|
||||
max_followers: int, onion_domain: str,
|
||||
signingPrivateKeyPem: str, unitTest: bool) -> bool:
|
||||
"""Receives a follow request within the POST section of HTTPServer
|
||||
"""
|
||||
|
@ -3968,7 +3968,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
print('Obtaining the following actor: ' + messageJson['actor'])
|
||||
if not getPersonPubKey(base_dir, session, messageJson['actor'],
|
||||
personCache, debug, project_version,
|
||||
http_prefix, domainToFollow, onionDomain,
|
||||
http_prefix, domainToFollow, onion_domain,
|
||||
signingPrivateKeyPem):
|
||||
if debug:
|
||||
print('Unable to obtain following actor: ' +
|
||||
|
@ -4005,7 +4005,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
print('Obtaining the following actor: ' + messageJson['actor'])
|
||||
if not getPersonPubKey(base_dir, session, messageJson['actor'],
|
||||
personCache, debug, project_version,
|
||||
http_prefix, domainToFollow, onionDomain,
|
||||
http_prefix, domainToFollow, onion_domain,
|
||||
signingPrivateKeyPem):
|
||||
if debug:
|
||||
print('Unable to obtain following actor: ' +
|
||||
|
@ -4064,7 +4064,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {}, queue: [],
|
||||
domain: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
onion_domain: str, i2pDomain: str,
|
||||
port: int, proxyType: str,
|
||||
federationList: [], maxReplies: int,
|
||||
domainMaxPostsPerDay: int,
|
||||
|
@ -4233,7 +4233,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
getPersonPubKey(base_dir, session, keyId,
|
||||
personCache, debug,
|
||||
project_version, http_prefix,
|
||||
domain, onionDomain, signingPrivateKeyPem)
|
||||
domain, onion_domain, signingPrivateKeyPem)
|
||||
if pubKey:
|
||||
if debug:
|
||||
print('DEBUG: public key: ' + str(pubKey))
|
||||
|
@ -4371,7 +4371,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
queueJson['post'],
|
||||
federationList,
|
||||
debug, project_version,
|
||||
max_followers, onionDomain,
|
||||
max_followers, onion_domain,
|
||||
signingPrivateKeyPem, unitTest):
|
||||
if os.path.isfile(queueFilename):
|
||||
try:
|
||||
|
@ -4494,7 +4494,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
cachedWebfingers,
|
||||
personCache, queue,
|
||||
domain,
|
||||
onionDomain, i2pDomain,
|
||||
onion_domain, i2pDomain,
|
||||
port, proxyType,
|
||||
federationList,
|
||||
debug,
|
||||
|
|
|
@ -87,7 +87,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
http_prefix: str,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
onionDomain: str, i2pDomain: str,
|
||||
onion_domain: str, i2pDomain: str,
|
||||
translate: {},
|
||||
registration: bool,
|
||||
systemLanguage: str,
|
||||
|
@ -208,8 +208,8 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
'instanceDescription')
|
||||
instanceTitle = getConfigParam(base_dir, 'instanceTitle')
|
||||
|
||||
if callingDomain.endswith('.onion') and onionDomain:
|
||||
domainFull = onionDomain
|
||||
if callingDomain.endswith('.onion') and onion_domain:
|
||||
domainFull = onion_domain
|
||||
http_prefix = 'http'
|
||||
elif (callingDomain.endswith('.i2p') and i2pDomain):
|
||||
domainFull = i2pDomain
|
||||
|
|
|
@ -181,7 +181,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
messageJson: {}, postToNickname: str,
|
||||
server, base_dir: str, http_prefix: str,
|
||||
domain: str, domainFull: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
onion_domain: str, i2pDomain: str, port: int,
|
||||
recentPostsCache: {}, followersThreads: [],
|
||||
federationList: [], sendThreads: [],
|
||||
postLog: [], cachedWebfingers: {},
|
||||
|
@ -512,7 +512,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
sendToFollowersThread(server.session,
|
||||
base_dir,
|
||||
postToNickname,
|
||||
domain, onionDomain, i2pDomain,
|
||||
domain, onion_domain, i2pDomain,
|
||||
port, http_prefix,
|
||||
federationList,
|
||||
sendThreads,
|
||||
|
@ -653,7 +653,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
namedAddressesThread = \
|
||||
sendToNamedAddressesThread(server.session, base_dir,
|
||||
postToNickname,
|
||||
domain, onionDomain, i2pDomain, port,
|
||||
domain, onion_domain, i2pDomain, port,
|
||||
http_prefix,
|
||||
federationList,
|
||||
sendThreads,
|
||||
|
|
22
posts.py
22
posts.py
|
@ -2858,7 +2858,7 @@ def _isProfileUpdate(postJsonObject: {}) -> bool:
|
|||
|
||||
def _sendToNamedAddresses(session, base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
onion_domain: str, i2pDomain: str, port: int,
|
||||
http_prefix: str, federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
|
@ -2974,10 +2974,10 @@ def _sendToNamedAddresses(session, base_dir: str,
|
|||
fromDomain = domain
|
||||
fromDomainFull = getFullDomain(domain, port)
|
||||
fromHttpPrefix = http_prefix
|
||||
if onionDomain:
|
||||
if onion_domain:
|
||||
if toDomain.endswith('.onion'):
|
||||
fromDomain = onionDomain
|
||||
fromDomainFull = onionDomain
|
||||
fromDomain = onion_domain
|
||||
fromDomainFull = onion_domain
|
||||
fromHttpPrefix = 'http'
|
||||
elif i2pDomain:
|
||||
if toDomain.endswith('.i2p'):
|
||||
|
@ -3009,7 +3009,7 @@ def _sendToNamedAddresses(session, base_dir: str,
|
|||
|
||||
def sendToNamedAddressesThread(session, base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
onion_domain: str, i2pDomain: str, port: int,
|
||||
http_prefix: str, federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
|
@ -3024,7 +3024,7 @@ def sendToNamedAddressesThread(session, base_dir: str,
|
|||
threadWithTrace(target=_sendToNamedAddresses,
|
||||
args=(session, base_dir,
|
||||
nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
onion_domain, i2pDomain, port,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
|
@ -3085,7 +3085,7 @@ def _sendingProfileUpdate(postJsonObject: {}) -> bool:
|
|||
def sendToFollowers(session, base_dir: str,
|
||||
nickname: str,
|
||||
domain: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
onion_domain: str, i2pDomain: str, port: int,
|
||||
http_prefix: str, federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
|
@ -3174,9 +3174,9 @@ def sendToFollowers(session, base_dir: str,
|
|||
# have an alt onion domain then use the alt
|
||||
fromDomain = domain
|
||||
fromHttpPrefix = http_prefix
|
||||
if onionDomain:
|
||||
if onion_domain:
|
||||
if toDomain.endswith('.onion'):
|
||||
fromDomain = onionDomain
|
||||
fromDomain = onion_domain
|
||||
fromHttpPrefix = 'http'
|
||||
elif i2pDomain:
|
||||
if toDomain.endswith('.i2p'):
|
||||
|
@ -3258,7 +3258,7 @@ def sendToFollowers(session, base_dir: str,
|
|||
def sendToFollowersThread(session, base_dir: str,
|
||||
nickname: str,
|
||||
domain: str,
|
||||
onionDomain: str, i2pDomain: str, port: int,
|
||||
onion_domain: str, i2pDomain: str, port: int,
|
||||
http_prefix: str, federationList: [],
|
||||
sendThreads: [], postLog: [],
|
||||
cachedWebfingers: {}, personCache: {},
|
||||
|
@ -3273,7 +3273,7 @@ def sendToFollowersThread(session, base_dir: str,
|
|||
threadWithTrace(target=sendToFollowers,
|
||||
args=(session, base_dir,
|
||||
nickname, domain,
|
||||
onionDomain, i2pDomain, port,
|
||||
onion_domain, i2pDomain, port,
|
||||
http_prefix, federationList,
|
||||
sendThreads, postLog,
|
||||
cachedWebfingers, personCache,
|
||||
|
|
|
@ -100,7 +100,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
|
|||
httpd.http_prefix,
|
||||
httpd.domain,
|
||||
httpd.domainFull,
|
||||
httpd.onionDomain,
|
||||
httpd.onion_domain,
|
||||
httpd.i2pDomain,
|
||||
httpd.port,
|
||||
httpd.recentPostsCache,
|
||||
|
|
16
tests.py
16
tests.py
|
@ -777,7 +777,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
testServerAliceRunning = True
|
||||
maxMentions = 10
|
||||
maxEmoji = 10
|
||||
onionDomain = None
|
||||
onion_domain = None
|
||||
i2pDomain = None
|
||||
allow_local_network_access = True
|
||||
max_newswire_posts = 20
|
||||
|
@ -814,7 +814,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instance_id", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
onion_domain, i2pDomain, None, None, port, port,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
|
@ -919,7 +919,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
testServerBobRunning = True
|
||||
maxMentions = 10
|
||||
maxEmoji = 10
|
||||
onionDomain = None
|
||||
onion_domain = None
|
||||
i2pDomain = None
|
||||
allow_local_network_access = True
|
||||
max_newswire_posts = 20
|
||||
|
@ -956,7 +956,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instance_id", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
onion_domain, i2pDomain, None, None, port, port,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
|
@ -988,7 +988,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
testServerEveRunning = True
|
||||
maxMentions = 10
|
||||
maxEmoji = 10
|
||||
onionDomain = None
|
||||
onion_domain = None
|
||||
i2pDomain = None
|
||||
allow_local_network_access = True
|
||||
max_newswire_posts = 20
|
||||
|
@ -1026,7 +1026,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instance_id", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
onion_domain, i2pDomain, None, None, port, port,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies, allowDeletion, True, True, False,
|
||||
sendThreads, False)
|
||||
|
@ -1060,7 +1060,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
testServerGroupRunning = True
|
||||
maxMentions = 10
|
||||
maxEmoji = 10
|
||||
onionDomain = None
|
||||
onion_domain = None
|
||||
i2pDomain = None
|
||||
allow_local_network_access = True
|
||||
max_newswire_posts = 20
|
||||
|
@ -1098,7 +1098,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instance_id", False, path, domain,
|
||||
onionDomain, i2pDomain, None, None, port, port,
|
||||
onion_domain, i2pDomain, None, None, port, port,
|
||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
||||
proxyType, maxReplies,
|
||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||
|
|
4
utils.py
4
utils.py
|
@ -684,7 +684,7 @@ def loadJson(filename: str, delaySec: int = 2, maxTries: int = 5) -> {}:
|
|||
return jsonObject
|
||||
|
||||
|
||||
def loadJsonOnionify(filename: str, domain: str, onionDomain: str,
|
||||
def loadJsonOnionify(filename: str, domain: str, onion_domain: str,
|
||||
delaySec: int = 2) -> {}:
|
||||
"""Makes a few attempts to load a json formatted file
|
||||
This also converts the domain name to the onion domain
|
||||
|
@ -696,7 +696,7 @@ def loadJsonOnionify(filename: str, domain: str, onionDomain: str,
|
|||
with open(filename, 'r') as fp:
|
||||
data = fp.read()
|
||||
if data:
|
||||
data = data.replace(domain, onionDomain)
|
||||
data = data.replace(domain, onion_domain)
|
||||
data = data.replace('https:', 'http:')
|
||||
print('*****data: ' + data)
|
||||
jsonObject = json.loads(data)
|
||||
|
|
|
@ -16,7 +16,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
||||
domainFull: str, onionDomain: str, translate: {},
|
||||
domainFull: str, onion_domain: str, translate: {},
|
||||
systemLanguage: str) -> str:
|
||||
"""Show the about screen
|
||||
"""
|
||||
|
@ -47,11 +47,11 @@ def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
|||
http_prefix, domainFull,
|
||||
systemLanguage)
|
||||
aboutForm += '<div class="container">' + aboutText + '</div>'
|
||||
if onionDomain:
|
||||
if onion_domain:
|
||||
aboutForm += \
|
||||
'<div class="container"><center>\n' + \
|
||||
'<p class="administeredby">' + \
|
||||
'http://' + onionDomain + '</p>\n</center></div>\n'
|
||||
'http://' + onion_domain + '</p>\n</center></div>\n'
|
||||
if adminNickname:
|
||||
adminActor = '/users/' + adminNickname
|
||||
aboutForm += \
|
||||
|
|
20
webfinger.py
20
webfinger.py
|
@ -215,7 +215,7 @@ def webfingerMeta(http_prefix: str, domainFull: str) -> str:
|
|||
|
||||
|
||||
def webfingerLookup(path: str, base_dir: str,
|
||||
domain: str, onionDomain: str,
|
||||
domain: str, onion_domain: str,
|
||||
port: int, debug: bool) -> {}:
|
||||
"""Lookup the webfinger endpoint for an account
|
||||
"""
|
||||
|
@ -253,9 +253,9 @@ def webfingerLookup(path: str, base_dir: str,
|
|||
# if this is a lookup for a handle using its onion domain
|
||||
# then swap the onion domain for the clearnet version
|
||||
onionify = False
|
||||
if onionDomain:
|
||||
if onionDomain in handle:
|
||||
handle = handle.replace(onionDomain, domain)
|
||||
if onion_domain:
|
||||
if onion_domain in handle:
|
||||
handle = handle.replace(onion_domain, domain)
|
||||
onionify = True
|
||||
# instance actor
|
||||
if handle.startswith('actor@'):
|
||||
|
@ -273,7 +273,7 @@ def webfingerLookup(path: str, base_dir: str,
|
|||
wfJson = loadJson(filename)
|
||||
else:
|
||||
print('Webfinger request for onionified ' + handle)
|
||||
wfJson = loadJsonOnionify(filename, domain, onionDomain)
|
||||
wfJson = loadJsonOnionify(filename, domain, onion_domain)
|
||||
if not wfJson:
|
||||
wfJson = {"nickname": "unknown"}
|
||||
return wfJson
|
||||
|
@ -421,7 +421,7 @@ def _webfingerUpdateFromProfile(wfJson: {}, actorJson: {}) -> bool:
|
|||
|
||||
|
||||
def webfingerUpdate(base_dir: str, nickname: str, domain: str,
|
||||
onionDomain: str,
|
||||
onion_domain: str,
|
||||
cachedWebfingers: {}) -> None:
|
||||
handle = nickname + '@' + domain
|
||||
wfSubdir = '/wfendpoints'
|
||||
|
@ -430,14 +430,14 @@ def webfingerUpdate(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
filename = base_dir + wfSubdir + '/' + handle + '.json'
|
||||
onionify = False
|
||||
if onionDomain:
|
||||
if onionDomain in handle:
|
||||
handle = handle.replace(onionDomain, domain)
|
||||
if onion_domain:
|
||||
if onion_domain in handle:
|
||||
handle = handle.replace(onion_domain, domain)
|
||||
onionify = True
|
||||
if not onionify:
|
||||
wfJson = loadJson(filename)
|
||||
else:
|
||||
wfJson = loadJsonOnionify(filename, domain, onionDomain)
|
||||
wfJson = loadJsonOnionify(filename, domain, onion_domain)
|
||||
if not wfJson:
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue