Snake case

main
Bob Mottram 2021-12-25 23:45:30 +00:00
parent f087b8589c
commit 77fc7ddc8e
18 changed files with 280 additions and 274 deletions

View File

@ -23,10 +23,10 @@ from utils import hasActor
from utils import hasObjectStringType
def _createAcceptReject(base_dir: str, federationList: [],
nickname: str, domain: str, port: int,
toUrl: str, ccUrl: str, http_prefix: str,
objectJson: {}, acceptType: str) -> {}:
def _create_accept_reject(base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
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
and ccUrl might be a specific person favorited or repeated and
@ -36,7 +36,7 @@ def _createAcceptReject(base_dir: str, federationList: [],
if not objectJson.get('actor'):
return None
if not urlPermitted(objectJson['actor'], federationList):
if not urlPermitted(objectJson['actor'], federation_list):
return None
domain = getFullDomain(domain, port)
@ -55,28 +55,28 @@ def _createAcceptReject(base_dir: str, federationList: [],
return newAccept
def createAccept(base_dir: str, federationList: [],
def createAccept(base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
toUrl: str, ccUrl: str, http_prefix: str,
objectJson: {}) -> {}:
return _createAcceptReject(base_dir, federationList,
nickname, domain, port,
toUrl, ccUrl, http_prefix,
objectJson, 'Accept')
return _create_accept_reject(base_dir, federation_list,
nickname, domain, port,
toUrl, ccUrl, http_prefix,
objectJson, 'Accept')
def createReject(base_dir: str, federationList: [],
def createReject(base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
toUrl: str, ccUrl: str, http_prefix: str,
objectJson: {}) -> {}:
return _createAcceptReject(base_dir, federationList,
nickname, domain, port,
toUrl, ccUrl,
http_prefix, objectJson, 'Reject')
return _create_accept_reject(base_dir, federation_list,
nickname, domain, port,
toUrl, ccUrl,
http_prefix, objectJson, 'Reject')
def _acceptFollow(base_dir: str, domain: str, messageJson: {},
federationList: [], debug: bool) -> None:
federation_list: [], debug: bool) -> None:
"""Receiving a follow Accept activity
"""
if not hasObjectStringType(messageJson, debug):
@ -170,7 +170,7 @@ def _acceptFollow(base_dir: str, domain: str, messageJson: {},
if followPerson(base_dir,
nickname, acceptedDomainFull,
followedNickname, followedDomainFull,
federationList, debug, groupAccount):
federation_list, debug, groupAccount):
if debug:
print('DEBUG: ' + nickname + '@' + acceptedDomainFull +
' followed ' + followedNickname + '@' + followedDomainFull)
@ -184,7 +184,7 @@ def _acceptFollow(base_dir: str, domain: str, messageJson: {},
def receiveAcceptReject(session, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool) -> bool:
"""Receives an Accept or Reject within the POST section of HTTPServer
"""
@ -197,7 +197,7 @@ def receiveAcceptReject(session, base_dir: str,
print('DEBUG: "users" or "profile" missing from actor in ' +
messageJson['type'] + '. Assuming single user instance.')
domain, tempPort = getDomainFromActor(messageJson['actor'])
if not domainPermitted(domain, federationList):
if not domainPermitted(domain, federation_list):
if debug:
print('DEBUG: ' + messageJson['type'] +
' from domain not permitted - ' + domain)
@ -211,7 +211,7 @@ def receiveAcceptReject(session, base_dir: str,
' does not contain a nickname. ' +
'Assuming single user instance.')
# receive follow accept
_acceptFollow(base_dir, domain, messageJson, federationList, debug)
_acceptFollow(base_dir, domain, messageJson, federation_list, debug)
if debug:
print('DEBUG: Uh, ' + messageJson['type'] + ', I guess')
return True

View File

@ -115,7 +115,7 @@ def announcedByPerson(isAnnounced: bool, postActor: str,
return False
def createAnnounce(session, base_dir: str, federationList: [],
def createAnnounce(session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
toUrl: str, ccUrl: str, http_prefix: str,
objectUrl: str, saveToFile: bool,
@ -130,7 +130,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
followers url objectUrl is typically the url of the message,
corresponding to url or atomUri in createPostBase
"""
if not urlPermitted(objectUrl, federationList):
if not urlPermitted(objectUrl, federation_list):
return None
domain = removeDomainPort(domain)
@ -178,7 +178,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
sendSignedJson(newAnnounce, session, base_dir,
nickname, domain, port,
announceNickname, announceDomain, announcePort, None,
http_prefix, True, client_to_server, federationList,
http_prefix, True, client_to_server, federation_list,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signing_priv_key_pem, 639633)
@ -186,7 +186,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
return newAnnounce
def announcePublic(session, base_dir: str, federationList: [],
def announcePublic(session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str,
objectUrl: str, client_to_server: bool,
send_threads: [], postLog: [],
@ -199,7 +199,7 @@ def announcePublic(session, base_dir: str, federationList: [],
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
ccUrl = localActorUrl(http_prefix, nickname, fromDomain) + '/followers'
return createAnnounce(session, base_dir, federationList,
return createAnnounce(session, base_dir, federation_list,
nickname, domain, port,
toUrl, ccUrl, http_prefix,
objectUrl, True, client_to_server,

View File

@ -249,7 +249,7 @@ def updateBookmarksCollection(recentPostsCache: {},
def bookmark(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
objectUrl: str, actorBookmarked: str,
@ -262,7 +262,7 @@ def bookmark(recentPostsCache: {},
'to' might be a specific person (actor) whose post was bookmarked
object is typically the url of the message which was bookmarked
"""
if not urlPermitted(objectUrl, federationList):
if not urlPermitted(objectUrl, federation_list):
return None
fullDomain = getFullDomain(domain, port)
@ -308,7 +308,7 @@ def bookmark(recentPostsCache: {},
def undoBookmark(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
objectUrl: str, actorBookmarked: str,
@ -321,7 +321,7 @@ def undoBookmark(recentPostsCache: {},
'to' might be a specific person (actor) whose post was bookmarked
object is typically the url of the message which was bookmarked
"""
if not urlPermitted(objectUrl, federationList):
if not urlPermitted(objectUrl, federation_list):
return None
fullDomain = getFullDomain(domain, port)

View File

@ -722,7 +722,7 @@ class PubServer(BaseHTTPRequestHandler):
return False
# is the keyId (actor) valid?
if not urlPermitted(keyId, self.server.federationList):
if not urlPermitted(keyId, self.server.federation_list):
if self.server.debug:
print('AUTH: Secure mode GET request not permitted: ' + keyId)
return False
@ -1285,7 +1285,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port,
self.server.recentPostsCache,
self.server.followers_threads,
self.server.federationList,
self.server.federation_list,
self.server.send_threads,
self.server.postLog,
self.server.cached_webfingers,
@ -3046,7 +3046,7 @@ class PubServer(BaseHTTPRequestHandler):
followingDomain,
followingActor,
followingPort, http_prefix,
False, self.server.federationList,
False, self.server.federation_list,
self.server.send_threads,
self.server.postLog,
self.server.cached_webfingers,
@ -7690,7 +7690,7 @@ class PubServer(BaseHTTPRequestHandler):
announceJson = \
createAnnounce(self.server.session,
base_dir,
self.server.federationList,
self.server.federation_list,
self.postToNickname,
domain, port,
announceToStr,
@ -7909,7 +7909,7 @@ class PubServer(BaseHTTPRequestHandler):
followerNickname,
domain, port,
followingHandle,
self.server.federationList,
self.server.federation_list,
self.server.send_threads,
self.server.postLog,
self.server.cached_webfingers,
@ -8064,7 +8064,7 @@ class PubServer(BaseHTTPRequestHandler):
followerNickname,
domain, port,
followingHandle,
self.server.federationList,
self.server.federation_list,
self.server.send_threads,
self.server.postLog,
self.server.cached_webfingers,
@ -8901,7 +8901,7 @@ class PubServer(BaseHTTPRequestHandler):
bookmark(self.server.recentPostsCache,
self.server.session,
base_dir,
self.server.federationList,
self.server.federation_list,
self.postToNickname,
domain, port,
ccList,
@ -9027,7 +9027,7 @@ class PubServer(BaseHTTPRequestHandler):
undoBookmark(self.server.recentPostsCache,
self.server.session,
base_dir,
self.server.federationList,
self.server.federation_list,
self.postToNickname,
domain, port,
ccList,
@ -18288,7 +18288,7 @@ class PubServer(BaseHTTPRequestHandler):
if not self.server.unit_test:
if not inboxPermittedMessage(self.server.domain,
messageJson,
self.server.federationList):
self.server.federation_list):
if self.server.debug:
# https://www.youtube.com/watch?v=K3PrSj9XEu4
print('DEBUG: Ah Ah Ah')
@ -18734,7 +18734,7 @@ def runDaemon(content_license_url: str,
saveDomainQrcode(base_dir, http_prefix, httpd.domainFull)
httpd.http_prefix = http_prefix
httpd.debug = debug
httpd.federationList = fed_list.copy()
httpd.federation_list = fed_list.copy()
httpd.shared_items_federated_domains = \
shared_items_federated_domains.copy()
httpd.base_dir = base_dir
@ -18928,7 +18928,7 @@ def runDaemon(content_license_url: str,
httpd.person_cache, httpd.inbox_queue,
domain, onion_domain, i2p_domain,
port, proxy_type,
httpd.federationList,
httpd.federation_list,
max_replies,
domain_max_posts_per_day,
account_max_posts_per_day,

View File

@ -295,7 +295,7 @@ parser.add_argument('--htmlpost', dest='htmlpost', type=str, default=None,
help='Show the html for a given activitypub url')
parser.add_argument('--rss', dest='rss', type=str, default=None,
help='Show an rss feed for a given url')
parser.add_argument('-f', '--federate', nargs='+', dest='federationList',
parser.add_argument('-f', '--federate', nargs='+', dest='federation_list',
help='Specify federation list separated by spaces')
parser.add_argument('--federateshares', nargs='+',
dest='shared_items_federated_domains',
@ -1148,23 +1148,23 @@ nickname = None
if args.nickname:
nickname = nickname
federationList = []
if args.federationList:
if len(args.federationList) == 1:
if not (args.federationList[0].lower() == 'any' or
args.federationList[0].lower() == 'all' or
args.federationList[0].lower() == '*'):
for federationDomain in args.federationList:
federation_list = []
if args.federation_list:
if len(args.federation_list) == 1:
if not (args.federation_list[0].lower() == 'any' or
args.federation_list[0].lower() == 'all' or
args.federation_list[0].lower() == '*'):
for federationDomain in args.federation_list:
if '@' in federationDomain:
print(federationDomain +
': Federate with domains, not individual accounts')
sys.exit()
federationList = args.federationList.copy()
setConfigParam(base_dir, 'federationList', federationList)
federation_list = args.federation_list.copy()
setConfigParam(base_dir, 'federation_list', federation_list)
else:
configFederationList = getConfigParam(base_dir, 'federationList')
configFederationList = getConfigParam(base_dir, 'federation_list')
if configFederationList:
federationList = configFederationList
federation_list = configFederationList
proxy_type = None
if args.tor or domain.endswith('.onion'):
@ -1195,7 +1195,7 @@ if args.approve:
http_prefix,
args.nickname, domain, port,
args.approve,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
debug, __version__,
@ -1223,7 +1223,7 @@ if args.deny:
http_prefix,
args.nickname, domain, port,
args.deny,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
debug, __version__,
@ -2601,8 +2601,8 @@ if args.desktop:
args.debug, args.low_bandwidth)
sys.exit()
if federationList:
print('Federating with: ' + str(federationList))
if federation_list:
print('Federating with: ' + str(federation_list))
if args.shared_items_federated_domains:
print('Federating shared items with: ' +
args.shared_items_federated_domains)
@ -2983,17 +2983,17 @@ if args.testdata:
domainFull = domain + ':' + str(port)
clearFollows(base_dir, nickname, domain)
followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'ultrapancake', domainFull,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'sausagedog', domainFull,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'drokk', domainFull,
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'drokk', domainFull,
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
federationList, False, False)
federation_list, False, False)
setConfigParam(base_dir, 'admin', nickname)
# set a lower bound to the maximum mentions
@ -3251,7 +3251,7 @@ if __name__ == "__main__":
args.yt_replace_domain,
args.twitter_replacement_domain,
port, proxy_port, http_prefix,
federationList, args.max_mentions,
federation_list, args.max_mentions,
args.max_emoji, args.secure_mode,
proxy_type, args.max_replies,
args.domain_max_posts_per_day,

View File

@ -208,13 +208,13 @@ def getMutualsOfPerson(base_dir: str,
def followerOfPerson(base_dir: str, nickname: str, domain: str,
followerNickname: str, followerDomain: str,
federationList: [], debug: bool,
federation_list: [], debug: bool,
groupAccount: bool) -> bool:
"""Adds a follower of the given person
"""
return followPerson(base_dir, nickname, domain,
followerNickname, followerDomain,
federationList, debug, groupAccount, 'followers.txt')
federation_list, debug, groupAccount, 'followers.txt')
def getFollowerDomains(base_dir: str, nickname: str, domain: str) -> []:
@ -717,7 +717,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
nicknameToFollow: str, domainToFollow: str,
port: int,
nickname: str, domain: str, fromPort: int,
personUrl: str, federationList: [],
personUrl: str, federation_list: [],
followJson: {}, send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
@ -734,7 +734,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
'follow request which arrived at ' +
nicknameToFollow + '@' + domainToFollow +
' back to ' + acceptHandle)
acceptJson = createAccept(base_dir, federationList,
acceptJson = createAccept(base_dir, federation_list,
nicknameToFollow, domainToFollow, port,
personUrl, '', http_prefix,
followJson)
@ -769,7 +769,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
nicknameToFollow, domainToFollow, port,
nickname, domain, fromPort, '',
http_prefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version, None,
groupAccount, signing_priv_key_pem,
@ -780,7 +780,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
nicknameToFollow: str, domainToFollow: str,
port: int,
nickname: str, domain: str, fromPort: int,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
@ -809,7 +809,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
# create the reject activity
rejectJson = \
createReject(base_dir, federationList,
createReject(base_dir, federation_list,
nicknameToFollow, domainToFollow, port,
personUrl, '', http_prefix, followJson)
if debug:
@ -837,7 +837,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
nicknameToFollow, domainToFollow, port,
nickname, domain, fromPort, '',
http_prefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version, None,
groupAccount, signing_priv_key_pem,
@ -849,7 +849,7 @@ def sendFollowRequest(session, base_dir: str,
followNickname: str, followDomain: str,
followedActor: str,
followPort: int, followHttpPrefix: str,
client_to_server: bool, federationList: [],
client_to_server: bool, federation_list: [],
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool,
project_version: str, signing_priv_key_pem: str) -> {}:
@ -858,7 +858,7 @@ def sendFollowRequest(session, base_dir: str,
if not signing_priv_key_pem:
print('WARN: follow request without signing key')
if not domainPermitted(followDomain, federationList):
if not domainPermitted(followDomain, federation_list):
print('You are not permitted to follow the domain ' + followDomain)
return None
@ -929,7 +929,7 @@ def sendFollowRequest(session, base_dir: str,
followNickname, followDomain, followPort,
'https://www.w3.org/ns/activitystreams#Public',
http_prefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signing_priv_key_pem, 8234389)

108
inbox.py
View File

@ -419,7 +419,7 @@ def inboxMessageHasParams(messageJson: {}) -> bool:
def inboxPermittedMessage(domain: str, messageJson: {},
federationList: []) -> bool:
federation_list: []) -> bool:
""" check that we are receiving from a permitted domain
"""
if not hasActor(messageJson, False):
@ -430,7 +430,7 @@ def inboxPermittedMessage(domain: str, messageJson: {},
if domain in actor:
return True
if not urlPermitted(actor, federationList):
if not urlPermitted(actor, federation_list):
return False
alwaysAllowedTypes = (
@ -443,7 +443,7 @@ def inboxPermittedMessage(domain: str, messageJson: {},
inReplyTo = messageJson['object']['inReplyTo']
if not isinstance(inReplyTo, str):
return False
if not urlPermitted(inReplyTo, federationList):
if not urlPermitted(inReplyTo, federation_list):
return False
return True
@ -740,7 +740,7 @@ def _inboxPostRecipients(base_dir: str, post_json_object: {},
def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
port: int, messageJson: {},
federationList: [],
federation_list: [],
debug: bool) -> bool:
if not messageJson['object'].get('actor'):
if debug:
@ -796,7 +796,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
def _receiveUndo(session, base_dir: str, http_prefix: str,
port: int, send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
messageJson: {}, federationList: [],
messageJson: {}, federation_list: [],
debug: bool) -> bool:
"""Receives an undo request within the POST section of HTTPServer
"""
@ -818,7 +818,7 @@ def _receiveUndo(session, base_dir: str, http_prefix: str,
messageJson['object']['type'] == 'Join':
return _receiveUndoFollow(session, base_dir, http_prefix,
port, messageJson,
federationList, debug)
federation_list, debug)
return False
@ -942,7 +942,7 @@ def _receiveUpdateToQuestion(recentPostsCache: {}, messageJson: {},
def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
nickname: str, debug: bool) -> bool:
"""Receives an Update activity within the POST section of HTTPServer
"""
@ -996,7 +996,7 @@ def _receiveLike(recentPostsCache: {},
http_prefix: str, domain: str, port: int,
onion_domain: str,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
@ -1118,7 +1118,7 @@ def _receiveUndoLike(recentPostsCache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
@ -1230,7 +1230,7 @@ def _receiveReaction(recentPostsCache: {},
http_prefix: str, domain: str, port: int,
onion_domain: str,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
@ -1376,8 +1376,10 @@ def _receiveReaction(recentPostsCache: {},
def _receiveUndoReaction(recentPostsCache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
send_threads: [], postLog: [],
cached_webfingers: {},
person_cache: {}, messageJson: {},
federation_list: [],
debug: bool,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
@ -1504,7 +1506,7 @@ def _receiveBookmark(recentPostsCache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool, signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
@ -1613,8 +1615,10 @@ def _receiveBookmark(recentPostsCache: {},
def _receiveUndoBookmark(recentPostsCache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
send_threads: [], postLog: [],
cached_webfingers: {},
person_cache: {}, messageJson: {},
federation_list: [],
debug: bool, signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
@ -1723,7 +1727,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool, allow_deletion: bool,
recentPostsCache: {}) -> bool:
"""Receives a Delete activity within the POST section of HTTPServer
@ -1800,7 +1804,7 @@ def _receiveAnnounce(recentPostsCache: {},
http_prefix: str,
domain: str, onion_domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
person_cache: {}, messageJson: {}, federation_list: [],
debug: bool, translate: {},
yt_replace_domain: str,
twitter_replacement_domain: str,
@ -2026,8 +2030,10 @@ def _receiveAnnounce(recentPostsCache: {},
def _receiveUndoAnnounce(recentPostsCache: {},
session, handle: str, isGroup: bool, base_dir: str,
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
send_threads: [], postLog: [],
cached_webfingers: {},
person_cache: {}, messageJson: {},
federation_list: [],
debug: bool) -> bool:
"""Receives an undo announce activity within the POST section of HTTPServer
"""
@ -2609,7 +2615,7 @@ def _groupHandle(base_dir: str, handle: str) -> bool:
def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
post_json_object: {},
http_prefix: str, federationList: [],
http_prefix: str, federation_list: [],
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool,
system_language: str,
@ -2659,7 +2665,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
if debug:
print('Group announce: ' + postId)
announceJson = \
createAnnounce(session, base_dir, federationList,
createAnnounce(session, base_dir, federation_list,
nickname, domain, port,
groupActor + '/followers', cc,
http_prefix, postId, False, False,
@ -2669,7 +2675,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
sendToFollowersThread(session, base_dir, nickname, domain,
onion_domain, i2p_domain, port,
http_prefix, federationList,
http_prefix, federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
announceJson, debug, __version__,
@ -2791,7 +2797,7 @@ def _updateLastSeen(base_dir: str, handle: str, actor: str) -> None:
def _bounceDM(senderPostId: str, session, http_prefix: str,
base_dir: str, nickname: str, domain: str, port: int,
sendingHandle: str, federationList: [],
sendingHandle: str, federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
translate: {}, debug: bool,
@ -2866,7 +2872,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
sendSignedJson(post_json_object, session, base_dir,
nickname, domain, port,
senderNickname, senderDomain, senderPort, cc,
http_prefix, False, False, federationList,
http_prefix, False, False, federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, __version__, None, groupAccount,
signing_priv_key_pem, 7238634)
@ -2876,7 +2882,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
post_json_object: {}, updateIndexList: [],
session, http_prefix: str,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {},
person_cache: {},
@ -2955,7 +2961,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
base_dir,
nickname, domain,
port, sendH,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers,
person_cache,
@ -2978,7 +2984,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
post_json_object: {}, recentPostsCache: {},
session, onion_domain: str,
i2p_domain: str, port: int,
federationList: [], send_threads: [], postLog: [],
federation_list: [], send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
@ -3054,7 +3060,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
sharedItemFederationTokens = {}
sendToFollowersThread(session, base_dir, nickname, domain,
onion_domain, i2p_domain, port,
http_prefix, federationList,
http_prefix, federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
post_json_object, debug, __version__,
@ -3185,7 +3191,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
queue: [], domain: str,
onion_domain: str, i2p_domain: str,
port: int, proxy_type: str,
federationList: [], debug: bool,
federation_list: [], debug: bool,
queueFilename: str, destinationFilename: str,
max_replies: int, allow_deletion: bool,
max_mentions: int, max_emoji: int, translate: {},
@ -3222,7 +3228,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3244,7 +3250,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3267,7 +3273,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3289,7 +3295,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3311,7 +3317,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3333,7 +3339,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
@ -3358,7 +3364,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, translate,
yt_replace_domain,
twitter_replacement_domain,
@ -3380,7 +3386,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug):
if debug:
print('DEBUG: Undo announce accepted from ' + actor)
@ -3393,7 +3399,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
messageJson,
federationList,
federation_list,
debug, allow_deletion,
recentPostsCache):
if debug:
@ -3454,7 +3460,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
http_prefix, handle, debug,
post_json_object, recentPostsCache,
session, onion_domain, i2p_domain, port,
federationList, send_threads, postLog,
federation_list, send_threads, postLog,
cached_webfingers, person_cache,
signing_priv_key_pem,
max_recent_posts, translate,
@ -3476,7 +3482,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if not _isValidDM(base_dir, nickname, domain, port,
post_json_object, updateIndexList,
session, http_prefix,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers,
person_cache,
@ -3610,7 +3616,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if isGroup:
_sendToGroupMembers(session, base_dir, handle, port,
post_json_object,
http_prefix, federationList, send_threads,
http_prefix, federation_list, send_threads,
postLog, cached_webfingers, person_cache,
debug, system_language,
onion_domain, i2p_domain,
@ -3849,7 +3855,7 @@ def _checkJsonSignature(base_dir: str, queueJson: {}) -> (bool, bool):
def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
port: int, send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
messageJson: {}, federationList: [],
messageJson: {}, federation_list: [],
debug: bool, project_version: str,
max_followers: int, onion_domain: str,
signing_priv_key_pem: str, unit_test: bool) -> bool:
@ -3870,7 +3876,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
domainFull = getFullDomain(domain, tempPort)
if tempPort:
fromPort = tempPort
if not domainPermitted(domain, federationList):
if not domainPermitted(domain, federation_list):
if debug:
print('DEBUG: follower from domain not permitted - ' + domain)
return False
@ -3889,7 +3895,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
'not found within object')
return False
domainToFollow, tempPort = getDomainFromActor(messageJson['object'])
if not domainPermitted(domainToFollow, federationList):
if not domainPermitted(domainToFollow, federation_list):
if debug:
print('DEBUG: follow domain not permitted ' + domainToFollow)
return True
@ -4054,7 +4060,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
return followedAccountAccepts(session, base_dir, http_prefix,
nicknameToFollow, domainToFollow, port,
nickname, domain, fromPort,
messageJson['actor'], federationList,
messageJson['actor'], federation_list,
messageJson, send_threads, postLog,
cached_webfingers, person_cache,
debug, project_version, True,
@ -4069,7 +4075,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
domain: str,
onion_domain: str, i2p_domain: str,
port: int, proxy_type: str,
federationList: [], max_replies: int,
federation_list: [], max_replies: int,
domain_max_posts_per_day: int,
account_max_posts_per_day: int,
allow_deletion: bool, debug: bool, max_mentions: int,
@ -4351,7 +4357,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
queueJson['post'],
federationList,
federation_list,
debug):
print('Queue: Undo accepted from ' + keyId)
if os.path.isfile(queueFilename):
@ -4372,7 +4378,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
queueJson['post'],
federationList,
federation_list,
debug, project_version,
max_followers, onion_domain,
signing_priv_key_pem, unit_test):
@ -4396,7 +4402,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
send_threads, postLog,
cached_webfingers, person_cache,
queueJson['post'],
federationList, debug):
federation_list, debug):
print('Queue: Accept/Reject received from ' + keyId)
if os.path.isfile(queueFilename):
try:
@ -4415,7 +4421,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
cached_webfingers,
person_cache,
queueJson['post'],
federationList,
federation_list,
queueJson['postNickname'],
debug):
if debug:
@ -4499,7 +4505,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
domain,
onion_domain, i2p_domain,
port, proxy_type,
federationList,
federation_list,
debug,
queueFilename, destination,
max_replies, allow_deletion,

10
like.py
View File

@ -69,7 +69,7 @@ def likedByPerson(post_json_object: {}, nickname: str, domain: str) -> bool:
def _like(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
objectUrl: str, actorLiked: str,
@ -83,7 +83,7 @@ def _like(recentPostsCache: {},
'to' might be a specific person (actor) whose post was liked
object is typically the url of the message which was liked
"""
if not urlPermitted(objectUrl, federationList):
if not urlPermitted(objectUrl, federation_list):
return None
fullDomain = getFullDomain(domain, port)
@ -135,7 +135,7 @@ def _like(recentPostsCache: {},
nickname, domain, port,
likedPostNickname, likedPostDomain, likedPostPort,
'https://www.w3.org/ns/activitystreams#Public',
http_prefix, True, client_to_server, federationList,
http_prefix, True, client_to_server, federation_list,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signing_priv_key_pem, 7367374)
@ -144,7 +144,7 @@ def _like(recentPostsCache: {},
def likePost(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str,
likeNickname: str, likeDomain: str, likePort: int,
ccList: [],
@ -161,7 +161,7 @@ def likePost(recentPostsCache: {},
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
return _like(recentPostsCache,
session, base_dir, federationList, nickname, domain, port,
session, base_dir, federation_list, nickname, domain, port,
ccList, http_prefix, objectUrl, actorLiked, client_to_server,
send_threads, postLog, person_cache, cached_webfingers,
debug, project_version, signing_priv_key_pem)

View File

@ -23,7 +23,7 @@ def manualDenyFollowRequest(session, base_dir: str,
http_prefix: str,
nickname: str, domain: str, port: int,
denyHandle: str,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool,
@ -62,7 +62,7 @@ def manualDenyFollowRequest(session, base_dir: str,
followedAccountRejects(session, base_dir, http_prefix,
nickname, domain, port,
denyNickname, denyDomain, denyPort,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
debug, project_version,
@ -75,7 +75,7 @@ def manualDenyFollowRequestThread(session, base_dir: str,
http_prefix: str,
nickname: str, domain: str, port: int,
denyHandle: str,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool,
@ -90,7 +90,7 @@ def manualDenyFollowRequestThread(session, base_dir: str,
http_prefix,
nickname, domain, port,
denyHandle,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
debug,
@ -124,7 +124,7 @@ def manualApproveFollowRequest(session, base_dir: str,
http_prefix: str,
nickname: str, domain: str, port: int,
approveHandle: str,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool,
@ -212,7 +212,7 @@ def manualApproveFollowRequest(session, base_dir: str,
approveDomain,
approvePort,
followJson['actor'],
federationList,
federation_list,
followJson,
send_threads, postLog,
cached_webfingers,
@ -281,7 +281,7 @@ def manualApproveFollowRequestThread(session, base_dir: str,
http_prefix: str,
nickname: str, domain: str, port: int,
approveHandle: str,
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool,
@ -296,7 +296,7 @@ def manualApproveFollowRequestThread(session, base_dir: str,
http_prefix,
nickname, domain, port,
approveHandle,
federationList,
federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
debug,

View File

@ -378,7 +378,7 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
domain: str, port: int,
person_cache: {},
cached_webfingers: {},
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
moderated: bool, url: str,
system_language: str,
@ -540,7 +540,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
recentPostsCache: {}, max_recent_posts: int,
session, cached_webfingers: {},
person_cache: {},
federationList: [],
federation_list: [],
send_threads: [], postLog: [],
max_mirrored_articles: int,
allow_local_network_access: bool,
@ -683,7 +683,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
blog, hashtags,
http_prefix, domain, port,
person_cache, cached_webfingers,
federationList,
federation_list,
send_threads, postLog,
moderated, url, system_language,
translate)
@ -830,7 +830,7 @@ def runNewswireDaemon(base_dir: str, httpd,
httpd.session,
httpd.cached_webfingers,
httpd.person_cache,
httpd.federationList,
httpd.federation_list,
httpd.send_threads,
httpd.postLog,
httpd.max_mirrored_articles,

View File

@ -183,7 +183,7 @@ def postMessageToOutbox(session, translate: {},
domain: str, domainFull: str,
onion_domain: str, i2p_domain: str, port: int,
recentPostsCache: {}, followers_threads: [],
federationList: [], send_threads: [],
federation_list: [], send_threads: [],
postLog: [], cached_webfingers: {},
person_cache: {}, allow_deletion: bool,
proxy_type: str, version: str, debug: bool,
@ -515,7 +515,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname,
domain, onion_domain, i2p_domain,
port, http_prefix,
federationList,
federation_list,
send_threads,
postLog,
cached_webfingers,
@ -656,7 +656,7 @@ def postMessageToOutbox(session, translate: {},
postToNickname,
domain, onion_domain, i2p_domain, port,
http_prefix,
federationList,
federation_list,
send_threads,
postLog,
cached_webfingers,

View File

@ -526,7 +526,7 @@ def isCreateInsideAnnounce(item: {}) -> bool:
def _getPosts(session, outboxUrl: str, maxPosts: int,
max_mentions: int,
max_emoji: int, maxAttachments: int,
federationList: [],
federation_list: [],
person_cache: {}, raw: bool,
simple: bool, debug: bool,
project_version: str, http_prefix: str,
@ -611,7 +611,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
if tagItem['icon'].get('url'):
# No emoji from non-permitted domains
if urlPermitted(tagItem['icon']['url'],
federationList):
federation_list):
emojiName = tagItem['name']
emojiIcon = tagItem['icon']['url']
emoji[emojiName] = emojiIcon
@ -641,7 +641,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
if isinstance(thisItem['inReplyTo'], str):
# No replies to non-permitted domains
if not urlPermitted(thisItem['inReplyTo'],
federationList):
federation_list):
if debug:
print('url not permitted ' +
thisItem['inReplyTo'])
@ -654,7 +654,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
if attach.get('name') and attach.get('url'):
# no attachments from non-permitted domains
if urlPermitted(attach['url'],
federationList):
federation_list):
attachment.append([attach['name'],
attach['url']])
else:
@ -745,7 +745,7 @@ def _updateWordFrequency(content: str, wordFrequency: {}) -> None:
def getPostDomains(session, outboxUrl: str, maxPosts: int,
max_mentions: int,
max_emoji: int, maxAttachments: int,
federationList: [],
federation_list: [],
person_cache: {},
debug: bool,
project_version: str, http_prefix: str,
@ -812,7 +812,7 @@ def _getPostsForBlockedDomains(base_dir: str,
session, outboxUrl: str, maxPosts: int,
max_mentions: int,
max_emoji: int, maxAttachments: int,
federationList: [],
federation_list: [],
person_cache: {},
debug: bool,
project_version: str, http_prefix: str,
@ -2198,7 +2198,7 @@ def createReportPost(base_dir: str,
return post_json_object
def threadSendPost(session, postJsonStr: str, federationList: [],
def threadSendPost(session, postJsonStr: str, federation_list: [],
inboxUrl: str, base_dir: str,
signatureHeaderJson: {}, postLog: [],
debug: bool) -> None:
@ -2213,7 +2213,7 @@ def threadSendPost(session, postJsonStr: str, federationList: [],
print('Getting postJsonString for ' + inboxUrl)
try:
postResult, unauthorized, returnCode = \
postJsonString(session, postJsonStr, federationList,
postJsonString(session, postJsonStr, federation_list,
inboxUrl, signatureHeaderJson,
debug)
if returnCode >= 500 and returnCode < 600:
@ -2271,7 +2271,7 @@ def sendPost(signing_priv_key_pem: str, project_version: str,
commentsEnabled: bool,
attachImageFilename: str, mediaType: str,
imageDescription: str, city: str,
federationList: [], send_threads: [], postLog: [],
federation_list: [], send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
isArticle: bool, system_language: str,
shared_items_federated_domains: [],
@ -2404,7 +2404,7 @@ def sendPost(signing_priv_key_pem: str, project_version: str,
threadWithTrace(target=threadSendPost,
args=(session,
postJsonStr,
federationList,
federation_list,
inboxUrl, base_dir,
signatureHeaderJson.copy(),
postLog,
@ -2612,7 +2612,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str,
nickname: str, domain: str, port: int,
toNickname: str, toDomain: str, toPort: int, cc: str,
http_prefix: str, saveToFile: bool, client_to_server: bool,
federationList: [],
federation_list: [],
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool, project_version: str,
sharedItemsToken: str, groupAccount: bool,
@ -2769,7 +2769,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str,
threadWithTrace(target=threadSendPost,
args=(session,
postJsonStr,
federationList,
federation_list,
inboxUrl, base_dir,
signatureHeaderJson.copy(),
postLog,
@ -2861,7 +2861,7 @@ def _isProfileUpdate(post_json_object: {}) -> bool:
def _sendToNamedAddresses(session, base_dir: str,
nickname: str, domain: str,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
http_prefix: str, federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
post_json_object: {}, debug: bool,
@ -3004,7 +3004,7 @@ def _sendToNamedAddresses(session, base_dir: str,
nickname, fromDomain, port,
toNickname, toDomain, toPort,
cc, fromHttpPrefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
@ -3014,7 +3014,7 @@ def _sendToNamedAddresses(session, base_dir: str,
def sendToNamedAddressesThread(session, base_dir: str,
nickname: str, domain: str,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
http_prefix: str, federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
post_json_object: {}, debug: bool,
@ -3029,7 +3029,7 @@ def sendToNamedAddressesThread(session, base_dir: str,
args=(session, base_dir,
nickname, domain,
onion_domain, i2p_domain, port,
http_prefix, federationList,
http_prefix, federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
post_json_object, debug,
@ -3090,7 +3090,7 @@ def sendToFollowers(session, base_dir: str,
nickname: str,
domain: str,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
http_prefix: str, federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
post_json_object: {}, debug: bool,
@ -3214,7 +3214,7 @@ def sendToFollowers(session, base_dir: str,
nickname, fromDomain, port,
toNickname, toDomain, toPort,
cc, fromHttpPrefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
@ -3243,7 +3243,7 @@ def sendToFollowers(session, base_dir: str,
nickname, fromDomain, port,
toNickname, toDomain, toPort,
cc, fromHttpPrefix, True, client_to_server,
federationList,
federation_list,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
@ -3263,7 +3263,7 @@ def sendToFollowersThread(session, base_dir: str,
nickname: str,
domain: str,
onion_domain: str, i2p_domain: str, port: int,
http_prefix: str, federationList: [],
http_prefix: str, federation_list: [],
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
post_json_object: {}, debug: bool,
@ -3278,7 +3278,7 @@ def sendToFollowersThread(session, base_dir: str,
args=(session, base_dir,
nickname, domain,
onion_domain, i2p_domain, port,
http_prefix, federationList,
http_prefix, federation_list,
send_threads, postLog,
cached_webfingers, person_cache,
post_json_object.copy(), debug,
@ -4081,7 +4081,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
return
person_cache = {}
cached_webfingers = {}
federationList = []
federation_list = []
groupAccount = False
if nickname.startswith('!'):
nickname = nickname[1:]
@ -4121,7 +4121,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
max_emoji = 10
maxAttachments = 5
_getPosts(session, personUrl, 30, max_mentions, max_emoji,
maxAttachments, federationList,
maxAttachments, federation_list,
person_cache, raw, simple, debug,
project_version, http_prefix, originDomain, system_language,
signing_priv_key_pem)
@ -4142,7 +4142,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
return domainList
person_cache = {}
cached_webfingers = {}
federationList = []
federation_list = []
domainFull = getFullDomain(domain, port)
handle = http_prefix + "://" + domainFull + "/@" + nickname
@ -4170,7 +4170,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
maxAttachments = 5
postDomains = \
getPostDomains(session, personUrl, 64, max_mentions, max_emoji,
maxAttachments, federationList,
maxAttachments, federation_list,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, domainList, system_language,
@ -4238,7 +4238,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
return {}
person_cache = {}
cached_webfingers = {}
federationList = []
federation_list = []
domainFull = getFullDomain(domain, port)
handle = http_prefix + "://" + domainFull + "/@" + nickname
@ -4268,7 +4268,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
postDomains = \
getPostDomains(session, personUrl, maxPosts,
max_mentions, max_emoji,
maxAttachments, federationList,
maxAttachments, federation_list,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, [], system_language,
@ -4283,7 +4283,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
_getPostsForBlockedDomains(base_dir, session, personUrl, maxPosts,
max_mentions,
max_emoji, maxAttachments,
federationList,
federation_list,
person_cache,
debug,
project_version, http_prefix,

View File

@ -61,7 +61,7 @@ def validEmojiContent(emojiContent: str) -> bool:
def _reaction(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int,
ccList: [], http_prefix: str,
objectUrl: str, emojiContent: str,
@ -76,7 +76,7 @@ def _reaction(recentPostsCache: {},
'to' might be a specific person (actor) whose post was reaction
object is typically the url of the message which was reaction
"""
if not urlPermitted(objectUrl, federationList):
if not urlPermitted(objectUrl, federation_list):
return None
if not validEmojiContent(emojiContent):
print('_reaction: Invalid emoji reaction: "' + emojiContent + '"')
@ -137,7 +137,7 @@ def _reaction(recentPostsCache: {},
reactionPostNickname,
reactionPostDomain, reactionPostPort,
'https://www.w3.org/ns/activitystreams#Public',
http_prefix, True, client_to_server, federationList,
http_prefix, True, client_to_server, federation_list,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signing_priv_key_pem, 7165392)
@ -146,7 +146,7 @@ def _reaction(recentPostsCache: {},
def reactionPost(recentPostsCache: {},
session, base_dir: str, federationList: [],
session, base_dir: str, federation_list: [],
nickname: str, domain: str, port: int, http_prefix: str,
reactionNickname: str, reactionDomain: str, reactionPort: int,
ccList: [],
@ -165,7 +165,7 @@ def reactionPost(recentPostsCache: {},
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
return _reaction(recentPostsCache,
session, base_dir, federationList,
session, base_dir, federation_list,
nickname, domain, port,
ccList, http_prefix, objectUrl, emojiContent,
actorReaction, client_to_server,

View File

@ -105,7 +105,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.port,
httpd.recentPostsCache,
httpd.followers_threads,
httpd.federationList,
httpd.federation_list,
httpd.send_threads,
httpd.postLog,
httpd.cached_webfingers,

View File

@ -291,13 +291,13 @@ def downloadHtml(signing_priv_key_pem: str,
def postJson(http_prefix: str, domainFull: str,
session, post_json_object: {}, federationList: [],
session, post_json_object: {}, federation_list: [],
inboxUrl: str, headers: {}, timeoutSec: int = 60,
quiet: bool = False) -> str:
"""Post a json message to the inbox of another person
"""
# check that we are posting to a permitted domain
if not urlPermitted(inboxUrl, federationList):
if not urlPermitted(inboxUrl, federation_list):
if not quiet:
print('postJson: ' + inboxUrl + ' not permitted')
return None
@ -340,7 +340,7 @@ def postJson(http_prefix: str, domainFull: str,
def postJsonString(session, postJsonStr: str,
federationList: [],
federation_list: [],
inboxUrl: str,
headers: {},
debug: bool,
@ -389,12 +389,12 @@ def postJsonString(session, postJsonStr: str,
return True, False, 0
def postImage(session, attachImageFilename: str, federationList: [],
def postImage(session, attachImageFilename: str, federation_list: [],
inboxUrl: str, headers: {}) -> str:
"""Post an image to the inbox of another person or outbox via c2s
"""
# check that we are posting to a permitted domain
if not urlPermitted(inboxUrl, federationList):
if not urlPermitted(inboxUrl, federation_list):
print('postJson: ' + inboxUrl + ' not permitted')
return None

View File

@ -33,7 +33,7 @@ def instancesGraph(base_dir: str, handles: str,
person_cache = {}
cached_webfingers = {}
federationList = []
federation_list = []
max_mentions = 99
max_emoji = 99
maxAttachments = 5
@ -75,7 +75,7 @@ def instancesGraph(base_dir: str, handles: str,
wordFrequency = {}
postDomains = \
getPostDomains(session, personUrl, 64, max_mentions, max_emoji,
maxAttachments, federationList,
maxAttachments, federation_list,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, [], system_language,

160
tests.py
View File

@ -679,7 +679,7 @@ def _testThreads():
def createServerAlice(path: str, domain: str, port: int,
bobAddress: str, federationList: [],
bobAddress: str, federation_list: [],
hasFollows: bool, hasPosts: bool,
send_threads: []):
print('Creating test server: Alice on port ' + str(port))
@ -707,9 +707,9 @@ def createServerAlice(path: str, domain: str, port: int,
assert setRole(path, nickname, domain, 'guru')
if hasFollows:
followPerson(path, nickname, domain, 'bob', bobAddress,
federationList, False, False)
federation_list, False, False)
followerOfPerson(path, nickname, domain, 'bob', bobAddress,
federationList, False, False)
federation_list, False, False)
if hasPosts:
testFollowersOnly = False
testSaveToFile = True
@ -815,7 +815,7 @@ def createServerAlice(path: str, domain: str, port: int,
5, True, True, 'en', __version__,
"instance_id", False, path, domain,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, max_mentions, max_emoji, False,
http_prefix, federation_list, max_mentions, max_emoji, False,
proxy_type, max_replies,
domain_max_posts_per_day, account_max_posts_per_day,
allow_deletion, True, True, False, send_threads,
@ -823,7 +823,7 @@ def createServerAlice(path: str, domain: str, port: int,
def createServerBob(path: str, domain: str, port: int,
aliceAddress: str, federationList: [],
aliceAddress: str, federation_list: [],
hasFollows: bool, hasPosts: bool,
send_threads: []):
print('Creating test server: Bob on port ' + str(port))
@ -850,9 +850,9 @@ def createServerBob(path: str, domain: str, port: int,
deleteAllPosts(path, nickname, domain, 'outbox')
if hasFollows and aliceAddress:
followPerson(path, nickname, domain,
'alice', aliceAddress, federationList, False, False)
'alice', aliceAddress, federation_list, False, False)
followerOfPerson(path, nickname, domain,
'alice', aliceAddress, federationList, False, False)
'alice', aliceAddress, federation_list, False, False)
if hasPosts:
testFollowersOnly = False
testSaveToFile = True
@ -957,14 +957,14 @@ def createServerBob(path: str, domain: str, port: int,
5, True, True, 'en', __version__,
"instance_id", False, path, domain,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, max_mentions, max_emoji, False,
http_prefix, federation_list, max_mentions, max_emoji, False,
proxy_type, max_replies,
domain_max_posts_per_day, account_max_posts_per_day,
allow_deletion, True, True, False, send_threads,
False)
def createServerEve(path: str, domain: str, port: int, federationList: [],
def createServerEve(path: str, domain: str, port: int, federation_list: [],
hasFollows: bool, hasPosts: bool,
send_threads: []):
print('Creating test server: Eve on port ' + str(port))
@ -1027,13 +1027,13 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
5, True, True, 'en', __version__,
"instance_id", False, path, domain,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, max_mentions, max_emoji, False,
http_prefix, federation_list, max_mentions, max_emoji, False,
proxy_type, max_replies, allow_deletion, True, True, False,
send_threads, False)
def createServerGroup(path: str, domain: str, port: int,
federationList: [],
federation_list: [],
hasFollows: bool, hasPosts: bool,
send_threads: []):
print('Creating test server: Group on port ' + str(port))
@ -1099,7 +1099,7 @@ def createServerGroup(path: str, domain: str, port: int,
5, True, True, 'en', __version__,
"instance_id", False, path, domain,
onion_domain, i2p_domain, None, None, port, port,
http_prefix, federationList, max_mentions, max_emoji, False,
http_prefix, federation_list, max_mentions, max_emoji, False,
proxy_type, max_replies,
domain_max_posts_per_day, account_max_posts_per_day,
allow_deletion, True, True, False, send_threads,
@ -1132,7 +1132,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
bobDir = base_dir + '/.tests/bob'
bobDomain = '127.0.0.100'
bobPort = 61936
federationList = [bobDomain, aliceDomain]
federation_list = [bobDomain, aliceDomain]
aliceSendThreads = []
bobSendThreads = []
bobAddress = bobDomain + ':' + str(bobPort)
@ -1147,7 +1147,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
thrAlice = \
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort, bobAddress,
federationList, False, False,
federation_list, False, False,
aliceSendThreads),
daemon=True)
@ -1161,7 +1161,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
thrBob = \
threadWithTrace(target=createServerBob,
args=(bobDir, bobDomain, bobPort, aliceAddress,
federationList, False, False,
federation_list, False, False,
bobSendThreads),
daemon=True)
@ -1216,7 +1216,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
followersOnly,
saveToFile, client_to_server, True,
attachedImageFilename, mediaType,
attachedImageDescription, city, federationList,
attachedImageDescription, city, federation_list,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
@ -1308,10 +1308,10 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
aliceDomainStr = aliceDomain + ':' + str(alicePort)
followerOfPerson(bobDir, 'bob', bobDomain, 'alice',
aliceDomainStr, federationList, False, False)
aliceDomainStr, federation_list, False, False)
bobDomainStr = bobDomain + ':' + str(bobPort)
followPerson(aliceDir, 'alice', aliceDomain, 'bob',
bobDomainStr, federationList, False, False)
bobDomainStr, federation_list, False, False)
sessionBob = createSession(proxy_type)
bobPostLog = []
@ -1327,7 +1327,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
outboxPostFilename = outboxPath + '/' + name
assert statusNumber > 0
assert outboxPostFilename
assert likePost({}, sessionBob, bobDir, federationList,
assert likePost({}, sessionBob, bobDir, federation_list,
'bob', bobDomain, bobPort, http_prefix,
'alice', aliceDomain, alicePort, [],
statusNumber, False, bobSendThreads, bobPostLog,
@ -1348,7 +1348,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
print('\n\n*******************************************************')
print("Bob reacts to Alice's post")
assert reactionPost({}, sessionBob, bobDir, federationList,
assert reactionPost({}, sessionBob, bobDir, federation_list,
'bob', bobDomain, bobPort, http_prefix,
'alice', aliceDomain, alicePort, [],
statusNumber, '😀',
@ -1384,7 +1384,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
print('outbox items before announce: ' + str(outboxBeforeAnnounceCount))
assert outboxBeforeAnnounceCount == 0
assert beforeAnnounceCount == 0
announcePublic(sessionBob, bobDir, federationList,
announcePublic(sessionBob, bobDir, federation_list,
'bob', bobDomain, bobPort, http_prefix,
objectUrl,
False, bobSendThreads, bobPostLog,
@ -1441,7 +1441,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
if os.path.isdir(base_dir + '/.tests'):
@ -1471,7 +1471,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
thrAlice = \
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort, bobAddress,
federationList, False, False,
federation_list, False, False,
aliceSendThreads),
daemon=True)
@ -1485,7 +1485,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
thrBob = \
threadWithTrace(target=createServerBob,
args=(bobDir, bobDomain, bobPort, aliceAddress,
federationList, False, False,
federation_list, False, False,
bobSendThreads),
daemon=True)
@ -1530,7 +1530,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
'alice', aliceDomain, alicePort, http_prefix,
'bob', bobDomain, bobActor,
bobPort, http_prefix,
client_to_server, federationList,
client_to_server, federation_list,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signing_priv_key_pem)
@ -1577,7 +1577,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
'bob', bobDomain, bobPort, ccUrl,
http_prefix, 'Alice message', followersOnly, saveToFile,
client_to_server, True,
None, None, None, city, federationList,
None, None, None, city, federation_list,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
@ -1630,7 +1630,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
if os.path.isdir(base_dir + '/.tests'):
@ -1663,7 +1663,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
thrAlice = \
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort, bobAddress,
federationList, False, False,
federation_list, False, False,
aliceSendThreads),
daemon=True)
@ -1677,7 +1677,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
thrBob = \
threadWithTrace(target=createServerBob,
args=(bobDir, bobDomain, bobPort, aliceAddress,
federationList, False, False,
federation_list, False, False,
bobSendThreads),
daemon=True)
@ -1747,7 +1747,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
'alice', aliceDomain, alicePort, http_prefix,
'bob', bobDomain, bobActor,
bobPort, http_prefix,
client_to_server, federationList,
client_to_server, federation_list,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signing_priv_key_pem)
@ -1928,7 +1928,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
'bob', bobDomain, bobPort, ccUrl,
http_prefix, 'Alice message', followersOnly, saveToFile,
client_to_server, True,
None, None, None, city, federationList,
None, None, None, city, federation_list,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
@ -2036,7 +2036,7 @@ def testGroupFollow(base_dir: str) -> None:
# system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
if os.path.isdir(base_dir + '/.tests'):
@ -2073,7 +2073,7 @@ def testGroupFollow(base_dir: str) -> None:
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort,
testgroupAddress,
federationList, False, True,
federation_list, False, True,
aliceSendThreads),
daemon=True)
@ -2087,7 +2087,7 @@ def testGroupFollow(base_dir: str) -> None:
thrBob = \
threadWithTrace(target=createServerBob,
args=(bobDir, bobDomain, bobPort, None,
federationList, False, False,
federation_list, False, False,
bobSendThreads),
daemon=True)
@ -2101,7 +2101,7 @@ def testGroupFollow(base_dir: str) -> None:
thrGroup = \
threadWithTrace(target=createServerGroup,
args=(testgroupDir, testgroupDomain, testgroupPort,
federationList, False, False,
federation_list, False, False,
testgroupSendThreads),
daemon=True)
@ -2186,7 +2186,7 @@ def testGroupFollow(base_dir: str) -> None:
'alice', aliceDomain, alicePort, http_prefix,
'testgroup', testgroupDomain, testgroupActor,
testgroupPort, http_prefix,
client_to_server, federationList,
client_to_server, federation_list,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signing_priv_key_pem)
@ -2263,7 +2263,7 @@ def testGroupFollow(base_dir: str) -> None:
'bob', bobDomain, bobPort, http_prefix,
'testgroup', testgroupDomain, testgroupActor,
testgroupPort, http_prefix,
client_to_server, federationList,
client_to_server, federation_list,
bobSendThreads, bobPostLog,
bobCachedWebfingers, bobPersonCache,
True, __version__, signing_priv_key_pem)
@ -2351,7 +2351,7 @@ def testGroupFollow(base_dir: str) -> None:
'testgroup', testgroupDomain, testgroupPort, ccUrl,
http_prefix, "Alice group message", followersOnly,
saveToFile, client_to_server, True,
None, None, None, city, federationList,
None, None, None, city, federation_list,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
@ -2441,7 +2441,7 @@ def _testFollowersOfPerson(base_dir: str) -> None:
password = 'birb'
port = 80
http_prefix = 'https'
federationList = []
federation_list = []
base_dir = currDir + '/.tests_followersofperson'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
@ -2460,18 +2460,18 @@ def _testFollowersOfPerson(base_dir: str) -> None:
clearFollows(base_dir, nickname, domain)
followPerson(base_dir, nickname, domain, 'maxboardroom', domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, 'drokk', domain, 'ultrapancake', domain,
federationList, False, False)
federation_list, False, False)
# deliberate duplication
followPerson(base_dir, 'drokk', domain, 'ultrapancake', domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, 'sausagedog', domain, 'ultrapancake', domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'ultrapancake', domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'someother', 'randodomain.net',
federationList, False, False)
federation_list, False, False)
followList = getFollowersOfPerson(base_dir, 'ultrapancake', domain)
assert len(followList) == 3
@ -2491,7 +2491,7 @@ def _testNoOfFollowersOnDomain(base_dir: str) -> None:
password = 'birb'
port = 80
http_prefix = 'https'
federationList = []
federation_list = []
base_dir = currDir + '/.tests_nooffollowersOndomain'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
@ -2509,26 +2509,26 @@ def _testNoOfFollowersOnDomain(base_dir: str) -> None:
http_prefix, True, False, password)
followPerson(base_dir, 'drokk', otherdomain, nickname, domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, 'sausagedog', otherdomain, nickname, domain,
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, 'maxboardroom', otherdomain, nickname, domain,
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain,
'cucumber', 'sandwiches.party',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain,
'captainsensible', 'damned.zone',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'pilchard', 'zombies.attack',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'drokk', otherdomain,
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'sausagedog', otherdomain,
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'maxboardroom', otherdomain,
federationList, False, False)
federation_list, False, False)
followersOnOtherDomain = \
noOfFollowersOnDomain(base_dir, nickname + '@' + domain, otherdomain)
@ -2553,7 +2553,7 @@ def _testGroupFollowers(base_dir: str) -> None:
password = 'somepass'
port = 80
http_prefix = 'https'
federationList = []
federation_list = []
base_dir = currDir + '/.tests_testgroupfollowers'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
@ -2564,17 +2564,17 @@ def _testGroupFollowers(base_dir: str) -> None:
clearFollowers(base_dir, nickname, domain)
followerOfPerson(base_dir, nickname, domain, 'badger', 'wild.domain',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'squirrel', 'wild.domain',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'rodent', 'wild.domain',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'utterly', 'clutterly.domain',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'zonked', 'zzz.domain',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'nap', 'zzz.domain',
federationList, False, False)
federation_list, False, False)
grouped = groupFollowersByDomain(base_dir, nickname, domain)
assert len(grouped.items()) == 3
@ -2597,7 +2597,7 @@ def _testFollows(base_dir: str) -> None:
password = 'mypass'
port = 80
http_prefix = 'https'
federationList = ['wild.com', 'mesh.com']
federation_list = ['wild.com', 'mesh.com']
base_dir = currDir + '/.tests_testfollows'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
@ -2608,15 +2608,15 @@ def _testFollows(base_dir: str) -> None:
clearFollows(base_dir, nickname, domain)
followPerson(base_dir, nickname, domain, 'badger', 'wild.com',
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'squirrel', 'secret.com',
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'rodent', 'drainpipe.com',
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'batman', 'mesh.com',
federationList, False, False)
federation_list, False, False)
followPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
federationList, False, False)
federation_list, False, False)
accountDir = acctDir(base_dir, nickname, domain)
f = open(accountDir + '/following.txt', 'r')
@ -2626,7 +2626,7 @@ def _testFollows(base_dir: str) -> None:
testDomain = testDomain.replace('\n', '').replace('\r', '')
if testDomain == 'mesh.com':
domainFound = True
if testDomain not in federationList:
if testDomain not in federation_list:
print(testDomain)
assert(False)
@ -2644,22 +2644,22 @@ def _testFollows(base_dir: str) -> None:
clearFollowers(base_dir, nickname, domain)
followerOfPerson(base_dir, nickname, domain, 'badger', 'wild.com',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'squirrel', 'secret.com',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'rodent', 'drainpipe.com',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'batman', 'mesh.com',
federationList, False, False)
federation_list, False, False)
followerOfPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
federationList, False, False)
federation_list, False, False)
accountDir = acctDir(base_dir, nickname, domain)
f = open(accountDir + '/followers.txt', 'r')
for followerDomain in f:
testDomain = followerDomain.split('@')[1]
testDomain = testDomain.replace('\n', '').replace('\r', '')
if testDomain not in federationList:
if testDomain not in federation_list:
print(testDomain)
assert(False)
@ -2788,7 +2788,7 @@ def testClientToServer(base_dir: str):
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
federation_list = []
low_bandwidth = False
if os.path.isdir(base_dir + '/.tests'):
@ -2818,7 +2818,7 @@ def testClientToServer(base_dir: str):
thrAlice = \
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort, bobAddress,
federationList, False, False,
federation_list, False, False,
aliceSendThreads),
daemon=True)
@ -2832,7 +2832,7 @@ def testClientToServer(base_dir: str):
thrBob = \
threadWithTrace(target=createServerBob,
args=(bobDir, bobDomain, bobPort, aliceAddress,
federationList, False, False,
federation_list, False, False,
bobSendThreads),
daemon=True)
@ -5068,7 +5068,7 @@ def testUpdateActor(base_dir: str):
http_prefix = 'http'
proxy_type = None
federationList = []
federation_list = []
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests',
@ -5092,7 +5092,7 @@ def testUpdateActor(base_dir: str):
thrAlice = \
threadWithTrace(target=createServerAlice,
args=(aliceDir, aliceDomain, alicePort, bobAddress,
federationList, False, False,
federation_list, False, False,
aliceSendThreads),
daemon=True)

View File

@ -807,21 +807,21 @@ def createInboxQueueDir(nickname: str, domain: str, base_dir: str) -> str:
return createPersonDir(nickname, domain, base_dir, 'queue')
def domainPermitted(domain: str, federationList: []):
if len(federationList) == 0:
def domainPermitted(domain: str, federation_list: []):
if len(federation_list) == 0:
return True
domain = removeDomainPort(domain)
if domain in federationList:
if domain in federation_list:
return True
return False
def urlPermitted(url: str, federationList: []):
def urlPermitted(url: str, federation_list: []):
if isEvil(url):
return False
if not federationList:
if not federation_list:
return True
for domain in federationList:
for domain in federation_list:
if domain in url:
return True
return False
@ -1130,14 +1130,14 @@ def _setDefaultPetName(base_dir: str, nickname: str, domain: str,
def followPerson(base_dir: str, nickname: str, domain: str,
followNickname: str, followDomain: str,
federationList: [], debug: bool,
federation_list: [], debug: bool,
groupAccount: bool,
followFile: str = 'following.txt') -> bool:
"""Adds a person to the follow list
"""
followDomainStrLower = followDomain.lower().replace('\n', '')
if not domainPermitted(followDomainStrLower,
federationList):
federation_list):
if debug:
print('DEBUG: follow of domain ' +
followDomain + ' not permitted')