Snake case

main
Bob Mottram 2021-12-25 20:50:24 +00:00
parent 2e157b5441
commit ed8d83c6c7
8 changed files with 310 additions and 305 deletions

518
daemon.py

File diff suppressed because it is too large Load Diff

View File

@ -165,7 +165,7 @@ parser.add_argument('-o', '--onion', dest='onion', type=str,
default=None,
help='Onion domain name of the server if ' +
'primarily on clearnet')
parser.add_argument('--i2pDomain', dest='i2pDomain', type=str,
parser.add_argument('--i2p_domain', dest='i2p_domain', type=str,
default=None,
help='i2p domain name of the server if ' +
'primarily on clearnet')
@ -1058,15 +1058,15 @@ if args.onion:
onion_domain = args.onion
setConfigParam(base_dir, 'onion', onion_domain)
i2pDomain = None
if args.i2pDomain:
if not args.i2pDomain.endswith('.i2p'):
print(args.i2pDomain + ' does not look like an i2p domain')
i2p_domain = None
if args.i2p_domain:
if not args.i2p_domain.endswith('.i2p'):
print(args.i2p_domain + ' does not look like an i2p domain')
sys.exit()
if '://' in args.i2pDomain:
if '://' in args.i2p_domain:
args.onion = args.onion.split('://')[1]
i2pDomain = args.i2pDomain
setConfigParam(base_dir, 'i2pDomain', i2pDomain)
i2p_domain = args.i2p_domain
setConfigParam(base_dir, 'i2p_domain', i2p_domain)
if not args.language:
languageCode = getConfigParam(base_dir, 'language')
@ -1121,11 +1121,11 @@ else:
onion_domain = None
# get i2p domain name from configuration
configi2pDomain = getConfigParam(base_dir, 'i2pDomain')
if configi2pDomain:
i2pDomain = configi2pDomain
configi2p_domain = getConfigParam(base_dir, 'i2p_domain')
if configi2p_domain:
i2p_domain = configi2p_domain
else:
i2pDomain = None
i2p_domain = None
# get port number from configuration
configPort = getConfigParam(base_dir, 'port')
@ -3247,7 +3247,7 @@ if __name__ == "__main__":
not args.nosharedinbox,
registration, args.language, __version__,
instance_id, args.client, base_dir,
domain, onion_domain, i2pDomain,
domain, onion_domain, i2p_domain,
args.yt_replace_domain,
args.twitterReplacementDomain,
port, proxyPort, http_prefix,

View File

@ -2611,7 +2611,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
sendThreads: [], postLog: [], cachedWebfingers: {},
personCache: {}, debug: bool,
systemLanguage: str,
onion_domain: str, i2pDomain: str,
onion_domain: str, i2p_domain: 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,
onion_domain, i2pDomain, port,
onion_domain, i2p_domain, port,
http_prefix, federationList,
sendThreads, postLog,
cachedWebfingers, personCache,
@ -2974,7 +2974,8 @@ 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, onion_domain: str, i2pDomain: str, port: int,
session, onion_domain: str,
i2p_domain: str, port: int,
federationList: [], sendThreads: [], postLog: [],
cachedWebfingers: {}, personCache: {},
signingPrivateKeyPem: str,
@ -3050,7 +3051,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
shared_items_federated_domains = []
sharedItemFederationTokens = {}
sendToFollowersThread(session, base_dir, nickname, domain,
onion_domain, i2pDomain, port,
onion_domain, i2p_domain, port,
http_prefix, federationList,
sendThreads, postLog,
cachedWebfingers, personCache,
@ -3180,7 +3181,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
base_dir: str, http_prefix: str, sendThreads: [],
postLog: [], cachedWebfingers: {}, personCache: {},
queue: [], domain: str,
onion_domain: str, i2pDomain: str,
onion_domain: str, i2p_domain: str,
port: int, proxyType: str,
federationList: [], debug: bool,
queueFilename: str, destinationFilename: str,
@ -3450,7 +3451,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
_receiveQuestionVote(base_dir, nickname, domain,
http_prefix, handle, debug,
postJsonObject, recentPostsCache,
session, onion_domain, i2pDomain, port,
session, onion_domain, i2p_domain, port,
federationList, sendThreads, postLog,
cachedWebfingers, personCache,
signingPrivateKeyPem,
@ -3610,7 +3611,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
http_prefix, federationList, sendThreads,
postLog, cachedWebfingers, personCache,
debug, systemLanguage,
onion_domain, i2pDomain,
onion_domain, i2p_domain,
signingPrivateKeyPem)
# if the post wasn't saved
@ -4064,7 +4065,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
sendThreads: [], postLog: [],
cachedWebfingers: {}, personCache: {}, queue: [],
domain: str,
onion_domain: str, i2pDomain: str,
onion_domain: str, i2p_domain: str,
port: int, proxyType: str,
federationList: [], maxReplies: int,
domainMaxPostsPerDay: int,
@ -4494,7 +4495,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
cachedWebfingers,
personCache, queue,
domain,
onion_domain, i2pDomain,
onion_domain, i2p_domain,
port, proxyType,
federationList,
debug,

View File

@ -87,7 +87,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
http_prefix: str,
base_dir: str, nickname: str, domain: str,
domainFull: str,
onion_domain: str, i2pDomain: str,
onion_domain: str, i2p_domain: str,
translate: {},
registration: bool,
systemLanguage: str,
@ -211,8 +211,8 @@ def mastoApiV1Response(path: str, callingDomain: str,
if callingDomain.endswith('.onion') and onion_domain:
domainFull = onion_domain
http_prefix = 'http'
elif (callingDomain.endswith('.i2p') and i2pDomain):
domainFull = i2pDomain
elif (callingDomain.endswith('.i2p') and i2p_domain):
domainFull = i2p_domain
http_prefix = 'http'
if broch_mode:

View File

@ -181,7 +181,7 @@ def postMessageToOutbox(session, translate: {},
messageJson: {}, postToNickname: str,
server, base_dir: str, http_prefix: str,
domain: str, domainFull: str,
onion_domain: str, i2pDomain: str, port: int,
onion_domain: str, i2p_domain: str, port: int,
recentPostsCache: {}, followersThreads: [],
federationList: [], sendThreads: [],
postLog: [], cachedWebfingers: {},
@ -512,7 +512,7 @@ def postMessageToOutbox(session, translate: {},
sendToFollowersThread(server.session,
base_dir,
postToNickname,
domain, onion_domain, i2pDomain,
domain, onion_domain, i2p_domain,
port, http_prefix,
federationList,
sendThreads,
@ -653,7 +653,7 @@ def postMessageToOutbox(session, translate: {},
namedAddressesThread = \
sendToNamedAddressesThread(server.session, base_dir,
postToNickname,
domain, onion_domain, i2pDomain, port,
domain, onion_domain, i2p_domain, port,
http_prefix,
federationList,
sendThreads,

View File

@ -2858,7 +2858,7 @@ def _isProfileUpdate(postJsonObject: {}) -> bool:
def _sendToNamedAddresses(session, base_dir: str,
nickname: str, domain: str,
onion_domain: str, i2pDomain: str, port: int,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
sendThreads: [], postLog: [],
cachedWebfingers: {}, personCache: {},
@ -2979,10 +2979,10 @@ def _sendToNamedAddresses(session, base_dir: str,
fromDomain = onion_domain
fromDomainFull = onion_domain
fromHttpPrefix = 'http'
elif i2pDomain:
elif i2p_domain:
if toDomain.endswith('.i2p'):
fromDomain = i2pDomain
fromDomainFull = i2pDomain
fromDomain = i2p_domain
fromDomainFull = i2p_domain
fromHttpPrefix = 'http'
cc = []
@ -3009,7 +3009,7 @@ def _sendToNamedAddresses(session, base_dir: str,
def sendToNamedAddressesThread(session, base_dir: str,
nickname: str, domain: str,
onion_domain: str, i2pDomain: str, port: int,
onion_domain: str, i2p_domain: 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,
onion_domain, i2pDomain, port,
onion_domain, i2p_domain, 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,
onion_domain: str, i2pDomain: str, port: int,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
sendThreads: [], postLog: [],
cachedWebfingers: {}, personCache: {},
@ -3178,9 +3178,9 @@ def sendToFollowers(session, base_dir: str,
if toDomain.endswith('.onion'):
fromDomain = onion_domain
fromHttpPrefix = 'http'
elif i2pDomain:
elif i2p_domain:
if toDomain.endswith('.i2p'):
fromDomain = i2pDomain
fromDomain = i2p_domain
fromHttpPrefix = 'http'
if withSharedInbox:
@ -3258,7 +3258,7 @@ def sendToFollowers(session, base_dir: str,
def sendToFollowersThread(session, base_dir: str,
nickname: str,
domain: str,
onion_domain: str, i2pDomain: str, port: int,
onion_domain: str, i2p_domain: 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,
onion_domain, i2pDomain, port,
onion_domain, i2p_domain, port,
http_prefix, federationList,
sendThreads, postLog,
cachedWebfingers, personCache,

View File

@ -101,7 +101,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.domain,
httpd.domainFull,
httpd.onion_domain,
httpd.i2pDomain,
httpd.i2p_domain,
httpd.port,
httpd.recentPostsCache,
httpd.followersThreads,

View File

@ -778,7 +778,7 @@ def createServerAlice(path: str, domain: str, port: int,
maxMentions = 10
maxEmoji = 10
onion_domain = None
i2pDomain = None
i2p_domain = None
allow_local_network_access = True
max_newswire_posts = 20
dormant_months = 3
@ -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,
onion_domain, i2pDomain, None, None, port, port,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,
@ -920,7 +920,7 @@ def createServerBob(path: str, domain: str, port: int,
maxMentions = 10
maxEmoji = 10
onion_domain = None
i2pDomain = None
i2p_domain = None
allow_local_network_access = True
max_newswire_posts = 20
dormant_months = 3
@ -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,
onion_domain, i2pDomain, None, None, port, port,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,
@ -989,7 +989,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
maxMentions = 10
maxEmoji = 10
onion_domain = None
i2pDomain = None
i2p_domain = None
allow_local_network_access = True
max_newswire_posts = 20
dormant_months = 3
@ -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,
onion_domain, i2pDomain, None, None, port, port,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies, allowDeletion, True, True, False,
sendThreads, False)
@ -1061,7 +1061,7 @@ def createServerGroup(path: str, domain: str, port: int,
maxMentions = 10
maxEmoji = 10
onion_domain = None
i2pDomain = None
i2p_domain = None
allow_local_network_access = True
max_newswire_posts = 20
dormant_months = 3
@ -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,
onion_domain, i2pDomain, None, None, port, port,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,