Snake case

main
Bob Mottram 2021-12-25 23:03:28 +00:00
parent 869ba0ccf9
commit 3a26274342
48 changed files with 1202 additions and 1191 deletions

View File

@ -123,7 +123,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates an announce message
Typically toUrl will be https://www.w3.org/ns/activitystreams#Public
and ccUrl might be a specific person favorited or repeated and the
@ -181,7 +181,7 @@ def createAnnounce(session, base_dir: str, federationList: [],
http_prefix, True, client_to_server, federationList,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signingPrivateKeyPem, 639633)
signing_priv_key_pem, 639633)
return newAnnounce
@ -192,7 +192,7 @@ def announcePublic(session, base_dir: str, federationList: [],
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Makes a public announcement
"""
fromDomain = getFullDomain(domain, port)
@ -206,7 +206,7 @@ def announcePublic(session, base_dir: str, federationList: [],
send_threads, postLog,
person_cache, cached_webfingers,
debug, project_version,
signingPrivateKeyPem)
signing_priv_key_pem)
def sendAnnounceViaServer(base_dir: str, session,
@ -215,7 +215,7 @@ def sendAnnounceViaServer(base_dir: str, session,
http_prefix: str, repeatObjectUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates an announce message via c2s
"""
if not session:
@ -248,7 +248,7 @@ def sendAnnounceViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
@ -264,7 +264,7 @@ def sendAnnounceViaServer(base_dir: str, session,
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId,
sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -308,7 +308,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
http_prefix: str, repeatObjectUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undo an announce message via c2s
"""
if not session:
@ -333,7 +333,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: undo announce webfinger failed for ' + handle)
@ -349,7 +349,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId,
sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,

View File

@ -83,7 +83,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
status: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Sets the availability for a person via c2s
"""
if not session:
@ -109,7 +109,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: availability webfinger failed for ' + handle)
@ -124,7 +124,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,

44
blog.py
View File

@ -191,7 +191,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
post_json_object: {},
handle: str, restrictToDomain: bool,
peertubeInstances: [],
systemLanguage: str,
system_language: str,
person_cache: {},
blogSeparator: str = '<hr>') -> str:
"""Returns the content for a single blog post
@ -271,7 +271,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
languagesUnderstood = []
if actorJson:
languagesUnderstood = getActorLanguagesList(actorJson)
jsonContent = getContentFromPost(post_json_object, systemLanguage,
jsonContent = getContentFromPost(post_json_object, system_language,
languagesUnderstood)
if jsonContent:
contentStr = addEmbeddedElements(translate, jsonContent,
@ -351,7 +351,7 @@ def _htmlBlogPostRSS2(authorized: bool,
nickname: str, domain: str, domainFull: str,
post_json_object: {},
handle: str, restrictToDomain: bool,
systemLanguage: str) -> str:
system_language: str) -> str:
"""Returns the RSS version 2 feed for a single blog post
"""
rssStr = ''
@ -368,7 +368,7 @@ def _htmlBlogPostRSS2(authorized: bool,
titleStr = post_json_object['object']['summary']
rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT")
content = \
getBaseContentFromPost(post_json_object, systemLanguage)
getBaseContentFromPost(post_json_object, system_language)
description = firstParagraphFromString(content)
rssStr = ' <item>'
rssStr += ' <title>' + titleStr + '</title>'
@ -385,7 +385,7 @@ def _htmlBlogPostRSS3(authorized: bool,
nickname: str, domain: str, domainFull: str,
post_json_object: {},
handle: str, restrictToDomain: bool,
systemLanguage: str) -> str:
system_language: str) -> str:
"""Returns the RSS version 3 feed for a single blog post
"""
rssStr = ''
@ -402,7 +402,7 @@ def _htmlBlogPostRSS3(authorized: bool,
titleStr = post_json_object['object']['summary']
rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT")
content = \
getBaseContentFromPost(post_json_object, systemLanguage)
getBaseContentFromPost(post_json_object, system_language)
description = firstParagraphFromString(content)
rssStr = 'title: ' + titleStr + '\n'
rssStr += 'link: ' + messageLink + '\n'
@ -424,10 +424,10 @@ def _htmlBlogRemoveCwButton(blogStr: str, translate: {}) -> str:
def _getSnippetFromBlogContent(post_json_object: {},
systemLanguage: str) -> str:
system_language: str) -> str:
"""Returns a snippet of text from the blog post as a preview
"""
content = getBaseContentFromPost(post_json_object, systemLanguage)
content = getBaseContentFromPost(post_json_object, system_language)
if '<p>' in content:
content = content.split('<p>', 1)[1]
if '</p>' in content:
@ -445,7 +445,7 @@ def htmlBlogPost(session, authorized: bool,
nickname: str, domain: str, domainFull: str,
post_json_object: {},
peertubeInstances: [],
systemLanguage: str, person_cache: {},
system_language: str, person_cache: {},
debug: bool, content_license_url: str) -> str:
"""Returns a html blog post
"""
@ -464,10 +464,10 @@ def htmlBlogPost(session, authorized: bool,
url = ''
if post_json_object['object'].get('url'):
url = post_json_object['object']['url']
snippet = _getSnippetFromBlogContent(post_json_object, systemLanguage)
snippet = _getSnippetFromBlogContent(post_json_object, system_language)
blogStr = htmlHeaderWithBlogMarkup(cssFilename, instanceTitle,
http_prefix, domainFull, nickname,
systemLanguage, published, modified,
system_language, published, modified,
title, snippet, translate, url,
content_license_url)
_htmlBlogRemoveCwButton(blogStr, translate)
@ -477,7 +477,7 @@ def htmlBlogPost(session, authorized: bool,
nickname, domain,
domainFull, post_json_object,
None, False,
peertubeInstances, systemLanguage,
peertubeInstances, system_language,
person_cache)
# show rss links
@ -506,7 +506,7 @@ def htmlBlogPage(authorized: bool, session,
base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, port: int,
noOfItems: int, pageNumber: int,
peertubeInstances: [], systemLanguage: str,
peertubeInstances: [], system_language: str,
person_cache: {}, debug: bool) -> str:
"""Returns a html blog page containing posts
"""
@ -570,7 +570,7 @@ def htmlBlogPage(authorized: bool, session,
domainFull, item,
None, True,
peertubeInstances,
systemLanguage,
system_language,
person_cache)
if len(timelineJson['orderedItems']) >= noOfItems:
@ -599,7 +599,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, port: int,
noOfItems: int, pageNumber: int,
includeHeader: bool, systemLanguage: str) -> str:
includeHeader: bool, system_language: str) -> str:
"""Returns an RSS version 2 feed containing posts
"""
if ' ' in nickname or '@' in nickname or \
@ -642,7 +642,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
http_prefix, translate,
nickname, domain,
domainFull, item,
None, True, systemLanguage)
None, True, system_language)
if includeHeader:
return blogRSS2 + rss2Footer()
@ -654,7 +654,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
base_dir: str, http_prefix: str, translate: {},
nickname: str, domain: str, port: int,
noOfItems: int, pageNumber: int,
systemLanguage: str) -> str:
system_language: str) -> str:
"""Returns an RSS version 3 feed containing posts
"""
if ' ' in nickname or '@' in nickname or \
@ -689,7 +689,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
nickname, domain,
domainFull, item,
None, True,
systemLanguage)
system_language)
return blogRSS3
@ -729,7 +729,7 @@ def htmlBlogView(authorized: bool,
session, base_dir: str, http_prefix: str,
translate: {}, domain: str, port: int,
noOfItems: int,
peertubeInstances: [], systemLanguage: str,
peertubeInstances: [], system_language: str,
person_cache: {}, debug: bool) -> str:
"""Show the blog main page
"""
@ -749,7 +749,7 @@ def htmlBlogView(authorized: bool,
base_dir, http_prefix, translate,
nickname, domain, port,
noOfItems, 1, peertubeInstances,
systemLanguage, person_cache, debug)
system_language, person_cache, debug)
domainFull = getFullDomain(domain, port)
@ -775,7 +775,7 @@ def htmlEditBlog(media_instance: bool, translate: {},
path: str,
pageNumber: int,
nickname: str, domain: str,
postUrl: str, systemLanguage: str) -> str:
postUrl: str, system_language: str) -> str:
"""Edit a blog post after it was created
"""
postFilename = locatePost(base_dir, nickname, domain, postUrl)
@ -896,7 +896,7 @@ def htmlEditBlog(media_instance: bool, translate: {},
editBlogForm += ' <br>'
messageBoxHeight = 800
contentStr = getBaseContentFromPost(post_json_object, systemLanguage)
contentStr = getBaseContentFromPost(post_json_object, system_language)
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
editBlogForm += \

View File

@ -376,7 +376,7 @@ def sendBookmarkViaServer(base_dir: str, session,
http_prefix: str, bookmarkUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a bookmark via c2s
"""
if not session:
@ -406,7 +406,7 @@ def sendBookmarkViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: bookmark webfinger failed for ' + handle)
@ -421,7 +421,7 @@ def sendBookmarkViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -466,7 +466,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
http_prefix: str, bookmarkUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Removes a bookmark via c2s
"""
if not session:
@ -496,7 +496,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unbookmark webfinger failed for ' + handle)
@ -511,7 +511,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,

View File

@ -140,7 +140,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str,
person_cache: {}, debug: bool,
project_version: str, http_prefix: str,
domain: str, onion_domain: str,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
if not personUrl:
return None
personUrl = personUrl.replace('#main-key', '')
@ -166,7 +166,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str,
'Accept': 'application/activity+json; profile="' + profileStr + '"'
}
personJson = \
getJson(signingPrivateKeyPem,
getJson(signing_priv_key_pem,
session, personUrl, asHeader, None, debug,
project_version, http_prefix, personDomain)
if not personJson:

334
daemon.py

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ def sendDeleteViaServer(base_dir: str, session,
http_prefix: str, deleteObjectUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a delete request message via c2s
"""
if not session:
@ -60,7 +60,7 @@ def sendDeleteViaServer(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: delete webfinger failed for ' + handle)
@ -76,7 +76,7 @@ def sendDeleteViaServer(base_dir: str, session,
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey,
fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
displayName, _) = getPersonBox(signing_priv_key_pem, originDomain,
base_dir, session, wfRequest, person_cache,
project_version, http_prefix, fromNickname,
fromDomain, postToBox, 53036)

File diff suppressed because it is too large Load Diff

View File

@ -725,11 +725,11 @@ if args.posts:
proxy_type = 'gnunet'
if not args.language:
args.language = 'en'
signingPrivateKeyPem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
getPublicPostsOfPerson(base_dir, nickname, domain, False, True,
proxy_type, args.port, http_prefix, debug,
__version__, args.language,
signingPrivateKeyPem, originDomain)
signing_priv_key_pem, originDomain)
sys.exit()
if args.postDomains:
@ -761,13 +761,13 @@ if args.postDomains:
domainList = []
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
signing_priv_key_pem = None
if not args.domain:
originDomain = getConfigParam(base_dir, 'domain')
else:
originDomain = args.domain
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
domainList = getPublicPostDomains(None,
base_dir, nickname, domain,
originDomain,
@ -776,7 +776,7 @@ if args.postDomains:
__version__,
wordFrequency, domainList,
args.language,
signingPrivateKeyPem)
signing_priv_key_pem)
for postDomain in domainList:
print(postDomain)
sys.exit()
@ -813,9 +813,9 @@ if args.postDomainsBlocked:
domainList = []
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
domainList = getPublicPostDomainsBlocked(None,
base_dir, nickname, domain,
proxy_type, args.port,
@ -823,7 +823,7 @@ if args.postDomainsBlocked:
__version__,
wordFrequency, domainList,
args.language,
signingPrivateKeyPem)
signing_priv_key_pem)
for postDomain in domainList:
print(postDomain)
sys.exit()
@ -858,16 +858,16 @@ if args.checkDomains:
maxBlockedDomains = 0
if not args.language:
args.language = 'en'
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
checkDomains(None,
base_dir, nickname, domain,
proxy_type, args.port,
http_prefix, debug,
__version__,
maxBlockedDomains, False, args.language,
signingPrivateKeyPem)
signing_priv_key_pem)
sys.exit()
if args.socnet:
@ -886,14 +886,14 @@ if args.socnet:
domain = ''
if args.domain:
domain = args.domain
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
dotGraph = instancesGraph(base_dir, args.socnet,
proxy_type, args.port,
http_prefix, debug,
__version__, args.language,
signingPrivateKeyPem)
signing_priv_key_pem)
try:
with open('socnet.dot', 'w+') as fp:
fp.write(dotGraph)
@ -925,11 +925,11 @@ if args.postsraw:
proxy_type = 'gnunet'
if not args.language:
args.language = 'en'
signingPrivateKeyPem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
getPublicPostsOfPerson(base_dir, nickname, domain, False, False,
proxy_type, args.port, http_prefix, debug,
__version__, args.language,
signingPrivateKeyPem, originDomain)
signing_priv_key_pem, originDomain)
sys.exit()
if args.json:
@ -943,14 +943,14 @@ if args.json:
domain = ''
if args.domain:
domain = args.domain
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signingPrivateKeyPem:
if signing_priv_key_pem:
print('Obtained instance actor signing key')
else:
print('Did not obtain instance actor key for ' + domain)
testJson = getJson(signingPrivateKeyPem, session, args.json, asHeader,
testJson = getJson(signing_priv_key_pem, session, args.json, asHeader,
None, debug, __version__, http_prefix, domain)
if testJson:
pprint(testJson)
@ -967,14 +967,14 @@ if args.htmlpost:
domain = ''
if args.domain:
domain = args.domain
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signingPrivateKeyPem:
if signing_priv_key_pem:
print('Obtained instance actor signing key')
else:
print('Did not obtain instance actor key for ' + domain)
testHtml = downloadHtml(signingPrivateKeyPem, session, args.htmlpost,
testHtml = downloadHtml(signing_priv_key_pem, session, args.htmlpost,
asHeader, None, debug, __version__,
http_prefix, domain)
if testHtml:
@ -1188,9 +1188,9 @@ if args.approve:
person_cache = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
manualApproveFollowRequest(session, base_dir,
http_prefix,
args.nickname, domain, port,
@ -1199,7 +1199,7 @@ if args.approve:
send_threads, postLog,
cached_webfingers, person_cache,
debug, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
sys.exit()
if args.deny:
@ -1216,9 +1216,9 @@ if args.deny:
person_cache = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
manualDenyFollowRequest(session, base_dir,
http_prefix,
args.nickname, domain, port,
@ -1227,7 +1227,7 @@ if args.deny:
send_threads, postLog,
cached_webfingers, person_cache,
debug, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
sys.exit()
if args.followerspending:
@ -1309,12 +1309,12 @@ if args.message:
isArticle = False
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending post to ' + args.sendto)
sendPostViaServer(signingPrivateKeyPem, __version__,
sendPostViaServer(signing_priv_key_pem, __version__,
base_dir, session, args.nickname, args.password,
domain, port,
toNickname, toDomain, toPort, ccUrl,
@ -1347,16 +1347,16 @@ if args.announce:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending announce/repeat of ' + args.announce)
sendAnnounceViaServer(base_dir, session, args.nickname, args.password,
domain, port,
http_prefix, args.announce,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1391,16 +1391,16 @@ if args.box:
proxy_type = 'gnunet'
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
session = createSession(proxy_type)
boxJson = c2sBoxJson(base_dir, session,
args.nickname, args.password,
domain, port, http_prefix,
args.box, args.pageNumber,
args.debug, signingPrivateKeyPem)
args.debug, signing_priv_key_pem)
if boxJson:
pprint(boxJson)
else:
@ -1452,9 +1452,9 @@ if args.itemName:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending shared item: ' + args.itemName)
sendShareViaServer(base_dir, session,
@ -1472,7 +1472,7 @@ if args.itemName:
cached_webfingers, person_cache,
debug, __version__,
args.itemPrice, args.itemCurrency,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1495,9 +1495,9 @@ if args.undoItemName:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo of shared item: ' + args.undoItemName)
sendUndoShareViaServer(base_dir, session,
@ -1506,7 +1506,7 @@ if args.undoItemName:
http_prefix,
args.undoItemName,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1557,9 +1557,9 @@ if args.wantedItemName:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending wanted item: ' + args.wantedItemName)
sendWantedViaServer(base_dir, session,
@ -1577,7 +1577,7 @@ if args.wantedItemName:
cached_webfingers, person_cache,
debug, __version__,
args.itemPrice, args.itemCurrency,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1600,9 +1600,9 @@ if args.undoWantedItemName:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo of wanted item: ' + args.undoWantedItemName)
sendUndoWantedViaServer(base_dir, session,
@ -1611,7 +1611,7 @@ if args.undoWantedItemName:
http_prefix,
args.undoWantedItemName,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1634,9 +1634,9 @@ if args.like:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending like of ' + args.like)
sendLikeViaServer(base_dir, session,
@ -1644,7 +1644,7 @@ if args.like:
domain, port,
http_prefix, args.like,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1673,9 +1673,9 @@ if args.react:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending emoji reaction ' + args.emoji + ' to ' + args.react)
sendReactionViaServer(base_dir, session,
@ -1683,7 +1683,7 @@ if args.react:
domain, port,
http_prefix, args.react, args.emoji,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1706,9 +1706,9 @@ if args.undolike:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo like of ' + args.undolike)
sendUndoLikeViaServer(base_dir, session,
@ -1717,7 +1717,7 @@ if args.undolike:
http_prefix, args.undolike,
cached_webfingers, person_cache,
True, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1746,9 +1746,9 @@ if args.undoreact:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo emoji reaction ' + args.emoji + ' to ' + args.react)
sendUndoReactionViaServer(base_dir, session,
@ -1757,7 +1757,7 @@ if args.undoreact:
http_prefix, args.undoreact, args.emoji,
cached_webfingers, person_cache,
True, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1780,9 +1780,9 @@ if args.bookmark:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending bookmark of ' + args.bookmark)
sendBookmarkViaServer(base_dir, session,
@ -1791,7 +1791,7 @@ if args.bookmark:
http_prefix, args.bookmark,
cached_webfingers, person_cache,
True, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1814,9 +1814,9 @@ if args.unbookmark:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo bookmark of ' + args.unbookmark)
sendUndoBookmarkViaServer(base_dir, session,
@ -1824,7 +1824,7 @@ if args.unbookmark:
domain, port,
http_prefix, args.unbookmark,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1847,9 +1847,9 @@ if args.delete:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending delete request of ' + args.delete)
sendDeleteViaServer(base_dir, session,
@ -1857,7 +1857,7 @@ if args.delete:
domain, port,
http_prefix, args.delete,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -1892,9 +1892,9 @@ if args.follow:
followHttpPrefix = 'https'
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
sendFollowRequestViaServer(base_dir, session,
args.nickname, args.password,
@ -1902,7 +1902,7 @@ if args.follow:
followNickname, followDomain, followPort,
http_prefix,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
for t in range(20):
time.sleep(1)
# TODO some method to know if it worked
@ -1938,9 +1938,9 @@ if args.unfollow:
followHttpPrefix = 'https'
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
sendUnfollowRequestViaServer(base_dir, session,
args.nickname, args.password,
@ -1948,7 +1948,7 @@ if args.unfollow:
followNickname, followDomain, followPort,
http_prefix,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
for t in range(20):
time.sleep(1)
# TODO some method to know if it worked
@ -1973,9 +1973,9 @@ if args.followingList:
followHttpPrefix = http_prefix
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
followingJson = \
getFollowingViaServer(base_dir, session,
@ -1983,7 +1983,7 @@ if args.followingList:
domain, port,
http_prefix, args.pageNumber,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
if followingJson:
pprint(followingJson)
sys.exit()
@ -2006,9 +2006,9 @@ if args.followersList:
followHttpPrefix = http_prefix
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
followersJson = \
getFollowersViaServer(base_dir, session,
@ -2017,7 +2017,7 @@ if args.followersList:
http_prefix, args.pageNumber,
cached_webfingers, person_cache,
debug, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
if followersJson:
pprint(followersJson)
sys.exit()
@ -2040,9 +2040,9 @@ if args.followRequestsList:
followHttpPrefix = http_prefix
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
followRequestsJson = \
getFollowRequestsViaServer(base_dir, session,
@ -2050,7 +2050,7 @@ if args.followRequestsList:
domain, port,
http_prefix, args.pageNumber,
cached_webfingers, person_cache,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
if followRequestsJson:
pprint(followRequestsJson)
sys.exit()
@ -2092,12 +2092,12 @@ if args.migrations:
session = createSession(proxy_type)
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
ctr = migrateAccounts(base_dir, session,
http_prefix, cached_webfingers,
True, signingPrivateKeyPem)
True, signing_priv_key_pem)
if ctr == 0:
print('No followed accounts have moved')
else:
@ -2107,15 +2107,15 @@ if args.migrations:
if args.actor:
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signingPrivateKeyPem:
if signing_priv_key_pem:
print('Obtained instance actor signing key')
else:
print('Did not obtain instance actor key for ' + domain)
getActorJson(domain, args.actor, args.http, args.gnunet,
debug, False, signingPrivateKeyPem, None)
debug, False, signing_priv_key_pem, None)
sys.exit()
if args.followers:
@ -2194,13 +2194,13 @@ if args.followers:
if args.domain:
hostDomain = args.domain
handle = nickname + '@' + domain
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
wfRequest = webfingerHandle(session, handle,
http_prefix, cached_webfingers,
hostDomain, __version__, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
print('Unable to webfinger ' + handle)
sys.exit()
@ -2242,11 +2242,11 @@ if args.followers:
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
followersList = \
downloadFollowCollection(signingPrivateKeyPem,
downloadFollowCollection(signing_priv_key_pem,
'followers', session,
http_prefix, personUrl, 1, 3, args.debug)
if followersList:
@ -2500,9 +2500,9 @@ if args.skill:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending ' + args.skill + ' skill level ' +
str(args.skillLevelPercent) + ' for ' + nickname)
@ -2512,7 +2512,7 @@ if args.skill:
http_prefix,
args.skill, args.skillLevelPercent,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -2535,9 +2535,9 @@ if args.availability:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending availability status of ' + nickname +
' as ' + args.availability)
@ -2546,7 +2546,7 @@ if args.availability:
http_prefix,
args.availability,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -2649,16 +2649,16 @@ if args.block:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending block of ' + args.block)
sendBlockViaServer(base_dir, session, nickname, args.password,
domain, port,
http_prefix, args.block,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -2681,16 +2681,16 @@ if args.mute:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending mute of ' + args.mute)
sendMuteViaServer(base_dir, session, nickname, args.password,
domain, port,
http_prefix, args.mute,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -2713,16 +2713,16 @@ if args.unmute:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo mute of ' + args.unmute)
sendUndoMuteViaServer(base_dir, session, nickname, args.password,
domain, port,
http_prefix, args.unmute,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
@ -2757,16 +2757,16 @@ if args.unblock:
cached_webfingers = {}
if not domain:
domain = getConfigParam(base_dir, 'domain')
signingPrivateKeyPem = None
signing_priv_key_pem = None
if args.secure_mode:
signingPrivateKeyPem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
print('Sending undo block of ' + args.unblock)
sendUndoBlockViaServer(base_dir, session, nickname, args.password,
domain, port,
http_prefix, args.unblock,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)

View File

@ -722,7 +722,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
removeFollowActivity: bool,
signingPrivateKeyPem: str):
signing_priv_key_pem: str):
"""The person receiving a follow request accepts the new follower
and sends back an Accept activity
"""
@ -772,7 +772,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
federationList,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version, None,
groupAccount, signingPrivateKeyPem,
groupAccount, signing_priv_key_pem,
7856837)
@ -784,7 +784,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str):
signing_priv_key_pem: str):
"""The person receiving a follow request rejects the new follower
and sends back a Reject activity
"""
@ -840,7 +840,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
federationList,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version, None,
groupAccount, signingPrivateKeyPem,
groupAccount, signing_priv_key_pem,
6393063)
@ -852,10 +852,10 @@ def sendFollowRequest(session, base_dir: str,
client_to_server: bool, federationList: [],
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool,
project_version: str, signingPrivateKeyPem: str) -> {}:
project_version: str, signing_priv_key_pem: str) -> {}:
"""Gets the json object for sending a follow request
"""
if not signingPrivateKeyPem:
if not signing_priv_key_pem:
print('WARN: follow request without signing key')
if not domainPermitted(followDomain, federationList):
@ -932,7 +932,7 @@ def sendFollowRequest(session, base_dir: str,
federationList,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signingPrivateKeyPem, 8234389)
signing_priv_key_pem, 8234389)
return newFollowJson
@ -945,7 +945,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
http_prefix: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a follow request via c2s
"""
if not session:
@ -975,7 +975,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: follow request webfinger failed for ' + handle)
@ -991,7 +991,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey,
fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
displayName, _) = getPersonBox(signing_priv_key_pem, originDomain,
base_dir, session, wfRequest, person_cache,
project_version, http_prefix, fromNickname,
fromDomain, postToBox, 52025)
@ -1035,7 +1035,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
http_prefix: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a unfollow request via c2s
"""
if not session:
@ -1069,7 +1069,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unfollow webfinger failed for ' + handle)
@ -1084,7 +1084,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session,
wfRequest, person_cache,
@ -1130,7 +1130,7 @@ def getFollowingViaServer(base_dir: str, session,
http_prefix: str, pageNumber: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Gets a page from the following collection as json
"""
if not session:
@ -1152,7 +1152,7 @@ def getFollowingViaServer(base_dir: str, session,
pageNumber = 1
url = followActor + '/following?page=' + str(pageNumber)
followingJson = \
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
getJson(signing_priv_key_pem, session, url, headers, {}, debug,
__version__, http_prefix, domain, 10, True)
if not followingJson:
if debug:
@ -1171,7 +1171,7 @@ def getFollowersViaServer(base_dir: str, session,
http_prefix: str, pageNumber: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Gets a page from the followers collection as json
"""
if not session:
@ -1193,7 +1193,7 @@ def getFollowersViaServer(base_dir: str, session,
pageNumber = 1
url = followActor + '/followers?page=' + str(pageNumber)
followersJson = \
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
getJson(signing_priv_key_pem, session, url, headers, {}, debug,
__version__, http_prefix, domain, 10, True)
if not followersJson:
if debug:
@ -1212,7 +1212,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
http_prefix: str, pageNumber: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Gets a page from the follow requests collection as json
"""
if not session:
@ -1234,7 +1234,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
pageNumber = 1
url = followActor + '/followrequests?page=' + str(pageNumber)
followersJson = \
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
getJson(signing_priv_key_pem, session, url, headers, {}, debug,
__version__, http_prefix, domain, 10, True)
if not followersJson:
if debug:
@ -1253,7 +1253,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
http_prefix: str, approveHandle: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""Approves a follow request
This is not exactly via c2s though. It simulates pressing the Approve
button on the web interface
@ -1275,7 +1275,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
url = actor + '/followapprove=' + approveHandle
approveHtml = \
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
getJson(signing_priv_key_pem, session, url, headers, {}, debug,
__version__, http_prefix, domain, 10, True)
if not approveHtml:
if debug:
@ -1294,7 +1294,7 @@ def denyFollowRequestViaServer(base_dir: str, session,
http_prefix: str, denyHandle: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""Denies a follow request
This is not exactly via c2s though. It simulates pressing the Deny
button on the web interface
@ -1316,7 +1316,7 @@ def denyFollowRequestViaServer(base_dir: str, session,
url = actor + '/followdeny=' + denyHandle
denyHtml = \
getJson(signingPrivateKeyPem, session, url, headers, {}, debug,
getJson(signing_priv_key_pem, session, url, headers, {}, debug,
__version__, http_prefix, domain, 10, True)
if not denyHtml:
if debug:

202
inbox.py
View File

@ -289,9 +289,9 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {},
lists_enabled: str) -> None:
"""Converts the json post into html and stores it in a cache
@ -305,7 +305,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
notDM = not isDM(post_json_object)
yt_replace_domain = getConfigParam(base_dir, 'youtubedomain')
twitter_replacement_domain = getConfigParam(base_dir, 'twitterdomain')
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts,
translate, pageNumber,
base_dir, session, cached_webfingers,
@ -316,7 +316,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain, twitter_replacement_domain,
show_published_date_only,
peertubeInstances, allow_local_network_access,
themeName, systemLanguage, max_like_count,
themeName, system_language, max_like_count,
notDM, True, True, False, True, False,
CWlists, lists_enabled)
@ -456,7 +456,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
messageBytes: str,
httpHeaders: {},
postPath: str, debug: bool,
blockedCache: [], systemLanguage: str) -> str:
blockedCache: [], system_language: str) -> str:
"""Saves the given json to the inbox queue for the person
keyId specifies the actor sending the post
"""
@ -521,7 +521,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
return None
if post_json_object['object'].get('content'):
contentStr = \
getBaseContentFromPost(post_json_object, systemLanguage)
getBaseContentFromPost(post_json_object, system_language)
if contentStr:
if isFiltered(base_dir, nickname, domain, contentStr):
if debug:
@ -998,14 +998,14 @@ def _receiveLike(recentPostsCache: {},
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: str) -> bool:
"""Receives a Like activity within the POST section of HTTPServer
@ -1092,7 +1092,7 @@ def _receiveLike(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1105,7 +1105,7 @@ def _receiveLike(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1120,14 +1120,14 @@ def _receiveUndoLike(recentPostsCache: {},
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: str) -> bool:
"""Receives an undo like activity within the POST section of HTTPServer
@ -1203,7 +1203,7 @@ def _receiveUndoLike(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1216,7 +1216,7 @@ def _receiveUndoLike(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1232,14 +1232,14 @@ def _receiveReaction(recentPostsCache: {},
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: str) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer
@ -1351,7 +1351,7 @@ def _receiveReaction(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1364,7 +1364,7 @@ def _receiveReaction(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1379,14 +1379,14 @@ def _receiveUndoReaction(recentPostsCache: {},
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: str) -> bool:
"""Receives an undo emoji reaction within the POST section of HTTPServer
@ -1478,7 +1478,7 @@ def _receiveUndoReaction(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1491,7 +1491,7 @@ def _receiveUndoReaction(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1505,14 +1505,14 @@ def _receiveBookmark(recentPostsCache: {},
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool, signingPrivateKeyPem: str,
debug: bool, signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: {}) -> bool:
"""Receives a bookmark activity within the POST section of HTTPServer
@ -1588,7 +1588,7 @@ def _receiveBookmark(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1601,7 +1601,7 @@ def _receiveBookmark(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1615,14 +1615,14 @@ def _receiveUndoBookmark(recentPostsCache: {},
http_prefix: str, domain: str, port: int,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, messageJson: {}, federationList: [],
debug: bool, signingPrivateKeyPem: str,
debug: bool, signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int, CWlists: {},
lists_enabled: str) -> bool:
"""Receives an undo bookmark activity within the POST section of HTTPServer
@ -1699,7 +1699,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1712,7 +1712,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1805,8 +1805,8 @@ def _receiveAnnounce(recentPostsCache: {},
yt_replace_domain: str,
twitter_replacement_domain: str,
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
signingPrivateKeyPem: str,
themeName: str, system_language: str,
signing_priv_key_pem: str,
max_recent_posts: int,
allow_deletion: bool,
peertubeInstances: [],
@ -1906,7 +1906,7 @@ def _receiveAnnounce(recentPostsCache: {},
if debug:
print('Generating html for announce ' + messageJson['id'])
announceHtml = \
individualPostAsHtml(signingPrivateKeyPem, True,
individualPostAsHtml(signing_priv_key_pem, True,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -1919,7 +1919,7 @@ def _receiveAnnounce(recentPostsCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -1941,9 +1941,9 @@ def _receiveAnnounce(recentPostsCache: {},
twitter_replacement_domain,
allow_local_network_access,
recentPostsCache, debug,
systemLanguage,
system_language,
domainFull, person_cache,
signingPrivateKeyPem,
signing_priv_key_pem,
blockedCache)
if not post_json_object:
print('WARN: unable to download announce: ' + str(messageJson))
@ -2007,7 +2007,7 @@ def _receiveAnnounce(recentPostsCache: {},
person_cache, debug,
__version__, http_prefix,
domain, onion_domain,
signingPrivateKeyPem)
signing_priv_key_pem)
if pubKey:
if debug:
print('DEBUG: public key obtained for announce: ' +
@ -2189,7 +2189,7 @@ def _estimateNumberOfEmoji(content: str) -> int:
def _validPostContent(base_dir: str, nickname: str, domain: str,
messageJson: {}, max_mentions: int, max_emoji: int,
allow_local_network_access: bool, debug: bool,
systemLanguage: str,
system_language: str,
http_prefix: str, domainFull: str,
person_cache: {}) -> bool:
"""Is the content of a received post valid?
@ -2230,7 +2230,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
messageJson['object']['content']):
return True
contentStr = getBaseContentFromPost(messageJson, systemLanguage)
contentStr = getBaseContentFromPost(messageJson, system_language)
if dangerousMarkup(contentStr, allow_local_network_access):
if messageJson['object'].get('id'):
print('REJECT ARBITRARY HTML: ' + messageJson['object']['id'])
@ -2265,7 +2265,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
return False
# check that the post is in a language suitable for this account
if not understoodPostLanguage(base_dir, nickname, domain,
messageJson, systemLanguage,
messageJson, system_language,
http_prefix, domainFull,
person_cache):
return False
@ -2294,7 +2294,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
domain: str, onion_domain: str, person_cache: {},
post_json_object: {}, debug: bool,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""Tries to obtain the actor for the person being replied to
so that their avatar can later be shown
"""
@ -2325,7 +2325,7 @@ def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
getPersonPubKey(base_dir, session, lookupActor,
person_cache, debug,
__version__, http_prefix,
domain, onion_domain, signingPrivateKeyPem)
domain, onion_domain, signing_priv_key_pem)
if pubKey:
if debug:
print('DEBUG: public key obtained for reply: ' + lookupActor)
@ -2612,9 +2612,9 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
http_prefix: str, federationList: [],
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool,
systemLanguage: str,
system_language: str,
onion_domain: str, i2p_domain: str,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""When a post arrives for a group send it out to the group members
"""
if debug:
@ -2665,7 +2665,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
http_prefix, postId, False, False,
send_threads, postLog,
person_cache, cached_webfingers,
debug, __version__, signingPrivateKeyPem)
debug, __version__, signing_priv_key_pem)
sendToFollowersThread(session, base_dir, nickname, domain,
onion_domain, i2p_domain, port,
@ -2675,7 +2675,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
announceJson, debug, __version__,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem)
signing_priv_key_pem)
def _inboxUpdateCalendar(base_dir: str, handle: str,
@ -2795,8 +2795,8 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
translate: {}, debug: bool,
lastBounceMessage: [], systemLanguage: str,
signingPrivateKeyPem: str,
lastBounceMessage: [], system_language: str,
signing_priv_key_pem: str,
content_license_url: str) -> bool:
"""Sends a bounce message back to the sending handle
if a DM has been rejected
@ -2856,7 +2856,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
inReplyTo, inReplyToAtomUri,
subject, debug, schedulePost,
eventDate, eventTime, location,
systemLanguage, conversationId, low_bandwidth,
system_language, conversationId, low_bandwidth,
content_license_url)
if not post_json_object:
print('WARN: unable to create bounce message to ' + sendingHandle)
@ -2869,7 +2869,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
http_prefix, False, False, federationList,
send_threads, postLog, cached_webfingers,
person_cache, debug, __version__, None, groupAccount,
signingPrivateKeyPem, 7238634)
signing_priv_key_pem, 7238634)
return True
@ -2882,8 +2882,8 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
person_cache: {},
translate: {}, debug: bool,
lastBounceMessage: [],
handle: str, systemLanguage: str,
signingPrivateKeyPem: str,
handle: str, system_language: str,
signing_priv_key_pem: str,
content_license_url: str) -> bool:
"""Is the given message a valid DM?
"""
@ -2961,8 +2961,8 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
person_cache,
translate, debug,
lastBounceMessage,
systemLanguage,
signingPrivateKeyPem,
system_language,
signing_priv_key_pem,
content_license_url)
return False
@ -2980,14 +2980,14 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
i2p_domain: str, port: int,
federationList: [], send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
max_recent_posts: int, translate: {},
allow_deletion: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
CWlists: {}, lists_enabled: bool) -> None:
"""Updates the votes on a Question/poll
@ -3019,7 +3019,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(questionJson)
individualPostAsHtml(signingPrivateKeyPem, False,
individualPostAsHtml(signing_priv_key_pem, False,
recentPostsCache, max_recent_posts,
translate, pageNumber, base_dir,
session, cached_webfingers, person_cache,
@ -3032,7 +3032,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, notDM,
showIndividualPostIcons,
manuallyApproveFollowers,
@ -3060,7 +3060,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
post_json_object, debug, __version__,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem)
signing_priv_key_pem)
def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
@ -3196,9 +3196,9 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
allow_local_network_access: bool,
peertubeInstances: [],
lastBounceMessage: [],
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
default_reply_interval_hrs: int,
CWlists: {}, lists_enabled: str,
content_license_url: str) -> bool:
@ -3223,14 +3223,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Like accepted from ' + actor)
@ -3245,14 +3245,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Undo like accepted from ' + actor)
@ -3268,14 +3268,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Reaction accepted from ' + actor)
@ -3290,14 +3290,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Undo reaction accepted from ' + actor)
@ -3312,14 +3312,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Bookmark accepted from ' + actor)
@ -3334,14 +3334,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
messageJson,
federationList,
debug, signingPrivateKeyPem,
debug, signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count, CWlists, lists_enabled):
if debug:
print('DEBUG: Undo bookmark accepted from ' + actor)
@ -3363,8 +3363,8 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
themeName, systemLanguage,
signingPrivateKeyPem,
themeName, system_language,
signing_priv_key_pem,
max_recent_posts,
allow_deletion,
peertubeInstances,
@ -3419,12 +3419,12 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
if _validPostContent(base_dir, nickname, domain,
post_json_object, max_mentions, max_emoji,
allow_local_network_access, debug,
systemLanguage, http_prefix,
system_language, http_prefix,
domainFull, person_cache):
# is the sending actor valid?
if not validSendingActor(session, base_dir, nickname, domain,
person_cache, post_json_object,
signingPrivateKeyPem, debug, unit_test):
signing_priv_key_pem, debug, unit_test):
return False
if post_json_object.get('object'):
@ -3439,11 +3439,11 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
return False
# replace YouTube links, so they get less tracking data
replaceYouTube(post_json_object, yt_replace_domain, systemLanguage)
replaceYouTube(post_json_object, yt_replace_domain, system_language)
# replace twitter link domains, so that you can view twitter posts
# without having an account
replaceTwitter(post_json_object, twitter_replacement_domain,
systemLanguage)
system_language)
# list of indexes to be updated
updateIndexList = ['inbox']
@ -3456,14 +3456,14 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
session, onion_domain, i2p_domain, port,
federationList, send_threads, postLog,
cached_webfingers, person_cache,
signingPrivateKeyPem,
signing_priv_key_pem,
max_recent_posts, translate,
allow_deletion,
yt_replace_domain,
twitter_replacement_domain,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
CWlists, lists_enabled)
@ -3482,8 +3482,8 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
person_cache,
translate, debug,
lastBounceMessage,
handle, systemLanguage,
signingPrivateKeyPem,
handle, system_language,
signing_priv_key_pem,
content_license_url):
return False
@ -3504,8 +3504,8 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
recentPostsCache, debug, systemLanguage,
domainFull, person_cache, signingPrivateKeyPem):
recentPostsCache, debug, system_language,
domainFull, person_cache, signing_priv_key_pem):
# media index will be updated
updateIndexList.append('tlmedia')
if isBlogPost(post_json_object):
@ -3516,7 +3516,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
_obtainAvatarForReplyPost(session, base_dir,
http_prefix, domain, onion_domain,
person_cache, post_json_object, debug,
signingPrivateKeyPem)
signing_priv_key_pem)
# save the post to file
if saveJson(post_json_object, destinationFilename):
@ -3568,9 +3568,9 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled)
if debug:
timeDiff = \
@ -3612,9 +3612,9 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
post_json_object,
http_prefix, federationList, send_threads,
postLog, cached_webfingers, person_cache,
debug, systemLanguage,
debug, system_language,
onion_domain, i2p_domain,
signingPrivateKeyPem)
signing_priv_key_pem)
# if the post wasn't saved
if not os.path.isfile(destinationFilename):
@ -3852,7 +3852,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
messageJson: {}, federationList: [],
debug: bool, project_version: str,
max_followers: int, onion_domain: str,
signingPrivateKeyPem: str, unit_test: bool) -> bool:
signing_priv_key_pem: str, unit_test: bool) -> bool:
"""Receives a follow request within the POST section of HTTPServer
"""
if not messageJson['type'].startswith('Follow'):
@ -3935,7 +3935,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
if not validSendingActor(session, base_dir,
nicknameToFollow, domainToFollow,
person_cache, messageJson,
signingPrivateKeyPem, debug, unit_test):
signing_priv_key_pem, debug, unit_test):
print('REJECT spam follow request ' + approveHandle)
return False
@ -3972,7 +3972,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
if not getPersonPubKey(base_dir, session, messageJson['actor'],
person_cache, debug, project_version,
http_prefix, domainToFollow, onion_domain,
signingPrivateKeyPem):
signing_priv_key_pem):
if debug:
print('Unable to obtain following actor: ' +
messageJson['actor'])
@ -4009,7 +4009,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
if not getPersonPubKey(base_dir, session, messageJson['actor'],
person_cache, debug, project_version,
http_prefix, domainToFollow, onion_domain,
signingPrivateKeyPem):
signing_priv_key_pem):
if debug:
print('Unable to obtain following actor: ' +
messageJson['actor'])
@ -4058,7 +4058,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
messageJson, send_threads, postLog,
cached_webfingers, person_cache,
debug, project_version, True,
signingPrivateKeyPem)
signing_priv_key_pem)
def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
@ -4081,8 +4081,8 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
allow_local_network_access: bool,
peertubeInstances: [],
verify_all_signatures: bool,
themeName: str, systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str,
themeName: str, system_language: str,
max_like_count: int, signing_priv_key_pem: str,
default_reply_interval_hrs: int,
CWlists: {}) -> None:
"""Processes received items and moves them to the appropriate
@ -4236,7 +4236,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
getPersonPubKey(base_dir, session, keyId,
person_cache, debug,
project_version, http_prefix,
domain, onion_domain, signingPrivateKeyPem)
domain, onion_domain, signing_priv_key_pem)
if pubKey:
if debug:
print('DEBUG: public key: ' + str(pubKey))
@ -4375,7 +4375,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
federationList,
debug, project_version,
max_followers, onion_domain,
signingPrivateKeyPem, unit_test):
signing_priv_key_pem, unit_test):
if os.path.isfile(queueFilename):
try:
os.remove(queueFilename)
@ -4511,9 +4511,9 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
allow_local_network_access,
peertubeInstances,
lastBounceMessage,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
signingPrivateKeyPem,
signing_priv_key_pem,
default_reply_interval_hrs,
CWlists, lists_enabled,
content_license_url)

View File

@ -90,7 +90,7 @@ def setActorLanguages(base_dir: str, actorJson: {}, languagesStr: str) -> None:
def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
messageJson: {}, systemLanguage: str,
messageJson: {}, system_language: str,
http_prefix: str, domainFull: str,
person_cache: {}) -> bool:
"""Returns true if the post is written in a language
@ -103,7 +103,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
return True
if not isinstance(msgObject['contentMap'], dict):
return True
if msgObject['contentMap'].get(systemLanguage):
if msgObject['contentMap'].get(system_language):
return True
personUrl = localActorUrl(http_prefix, nickname, domainFull)
actorJson = getPersonFromCache(base_dir, personUrl, person_cache, False)
@ -274,7 +274,7 @@ def libretranslate(url: str, text: str,
def autoTranslatePost(base_dir: str, post_json_object: {},
systemLanguage: str, translate: {}) -> str:
system_language: str, translate: {}) -> str:
"""Tries to automatically translate the given post
"""
if not hasObjectDict(post_json_object):
@ -297,7 +297,7 @@ def autoTranslatePost(base_dir: str, post_json_object: {},
content = msgObject['contentMap'][lang]
translatedText = \
libretranslate(libretranslateUrl, content,
lang, systemLanguage,
lang, system_language,
libretranslateApiKey)
if translatedText:
if removeHtml(translatedText) == removeHtml(content):

20
like.py
View File

@ -77,7 +77,7 @@ def _like(recentPostsCache: {},
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a like
actor is the person doing the liking
'to' might be a specific person (actor) whose post was liked
@ -138,7 +138,7 @@ def _like(recentPostsCache: {},
http_prefix, True, client_to_server, federationList,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signingPrivateKeyPem, 7367374)
signing_priv_key_pem, 7367374)
return newLikeJson
@ -152,7 +152,7 @@ def likePost(recentPostsCache: {},
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Likes a given status post. This is only used by unit tests
"""
likeDomain = getFullDomain(likeDomain, likePort)
@ -164,7 +164,7 @@ def likePost(recentPostsCache: {},
session, base_dir, federationList, nickname, domain, port,
ccList, http_prefix, objectUrl, actorLiked, client_to_server,
send_threads, postLog, person_cache, cached_webfingers,
debug, project_version, signingPrivateKeyPem)
debug, project_version, signing_priv_key_pem)
def sendLikeViaServer(base_dir: str, session,
@ -173,7 +173,7 @@ def sendLikeViaServer(base_dir: str, session,
http_prefix: str, likeUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a like via c2s
"""
if not session:
@ -197,7 +197,7 @@ def sendLikeViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: like webfinger failed for ' + handle)
@ -212,7 +212,7 @@ def sendLikeViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -256,7 +256,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
http_prefix: str, likeUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undo a like via c2s
"""
if not session:
@ -284,7 +284,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unlike webfinger failed for ' + handle)
@ -300,7 +300,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,

View File

@ -28,7 +28,7 @@ def manualDenyFollowRequest(session, base_dir: str,
cached_webfingers: {}, person_cache: {},
debug: bool,
project_version: str,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""Manually deny a follow request
"""
accountsDir = acctDir(base_dir, nickname, domain)
@ -66,7 +66,7 @@ def manualDenyFollowRequest(session, base_dir: str,
send_threads, postLog,
cached_webfingers, person_cache,
debug, project_version,
signingPrivateKeyPem)
signing_priv_key_pem)
print('Follow request from ' + denyHandle + ' was denied.')
@ -80,7 +80,7 @@ def manualDenyFollowRequestThread(session, base_dir: str,
cached_webfingers: {}, person_cache: {},
debug: bool,
project_version: str,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""Manually deny a follow request, within a thread so that the
user interface doesn't lag
"""
@ -95,7 +95,7 @@ def manualDenyFollowRequestThread(session, base_dir: str,
cached_webfingers, person_cache,
debug,
project_version,
signingPrivateKeyPem), daemon=True)
signing_priv_key_pem), daemon=True)
thr.start()
send_threads.append(thr)
@ -129,7 +129,7 @@ def manualApproveFollowRequest(session, base_dir: str,
cached_webfingers: {}, person_cache: {},
debug: bool,
project_version: str,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""Manually approve a follow request
"""
handle = nickname + '@' + domain
@ -219,7 +219,7 @@ def manualApproveFollowRequest(session, base_dir: str,
person_cache,
debug,
project_version, False,
signingPrivateKeyPem)
signing_priv_key_pem)
updateApprovedFollowers = True
else:
# this isn't the approved follow so it will remain
@ -286,7 +286,7 @@ def manualApproveFollowRequestThread(session, base_dir: str,
cached_webfingers: {}, person_cache: {},
debug: bool,
project_version: str,
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""Manually approve a follow request, in a thread so as not to cause
the UI to lag
"""
@ -301,6 +301,6 @@ def manualApproveFollowRequestThread(session, base_dir: str,
cached_webfingers, person_cache,
debug,
project_version,
signingPrivateKeyPem), daemon=True)
signing_priv_key_pem), daemon=True)
thr.start()
send_threads.append(thr)

View File

@ -90,7 +90,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
onion_domain: str, i2p_domain: str,
translate: {},
registration: bool,
systemLanguage: str,
system_language: str,
project_version: str,
customEmoji: [],
show_node_info_accounts: bool,
@ -229,7 +229,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
domain,
domainFull,
registration,
systemLanguage,
system_language,
project_version)
sendJsonStr = 'masto API instance metadata sent ' + uaStr
elif path.startswith('/api/v1/instance/peers'):

View File

@ -54,7 +54,7 @@ def _getBlurHash() -> str:
def _replaceSiloDomain(post_json_object: {},
siloDomain: str, replacementDomain: str,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Replace a silo domain with a replacement domain
"""
if not replacementDomain:
@ -63,31 +63,31 @@ def _replaceSiloDomain(post_json_object: {},
return
if not post_json_object['object'].get('content'):
return
contentStr = getBaseContentFromPost(post_json_object, systemLanguage)
contentStr = getBaseContentFromPost(post_json_object, system_language)
if siloDomain not in contentStr:
return
contentStr = contentStr.replace(siloDomain, replacementDomain)
post_json_object['object']['content'] = contentStr
if post_json_object['object'].get('contentMap'):
post_json_object['object']['contentMap'][systemLanguage] = contentStr
post_json_object['object']['contentMap'][system_language] = contentStr
def replaceYouTube(post_json_object: {}, replacementDomain: str,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Replace YouTube with a replacement domain
This denies Google some, but not all, tracking data
"""
_replaceSiloDomain(post_json_object, 'www.youtube.com',
replacementDomain, systemLanguage)
replacementDomain, system_language)
def replaceTwitter(post_json_object: {}, replacementDomain: str,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Replace Twitter with a replacement domain
This allows you to view twitter posts without having a twitter account
"""
_replaceSiloDomain(post_json_object, 'twitter.com',
replacementDomain, systemLanguage)
replacementDomain, system_language)
def _removeMetaData(imageFilename: str, outputFilename: str) -> None:

View File

@ -87,7 +87,7 @@ def metaDataInstance(showAccounts: bool,
instanceDescription: str,
http_prefix: str, base_dir: str,
adminNickname: str, domain: str, domainFull: str,
registration: bool, systemLanguage: str,
registration: bool, system_language: str,
version: str) -> {}:
""" /api/v1/instance endpoint
"""
@ -163,7 +163,7 @@ def metaDataInstance(showAccounts: bool,
'username': adminActor['preferredUsername']
},
'description': instanceDescription,
'languages': [systemLanguage],
'languages': [system_language],
'short_description': instanceDescriptionShort,
'stats': {
'domain_count': 2,

View File

@ -24,7 +24,7 @@ def _moveFollowingHandlesForAccount(base_dir: str, nickname: str, domain: str,
session,
http_prefix: str, cached_webfingers: {},
debug: bool,
signingPrivateKeyPem: str) -> int:
signing_priv_key_pem: str) -> int:
"""Goes through all follows for an account and updates any that have moved
"""
ctr = 0
@ -39,14 +39,14 @@ def _moveFollowingHandlesForAccount(base_dir: str, nickname: str, domain: str,
_updateMovedHandle(base_dir, nickname, domain,
followHandle, session,
http_prefix, cached_webfingers,
debug, signingPrivateKeyPem)
debug, signing_priv_key_pem)
return ctr
def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
handle: str, session,
http_prefix: str, cached_webfingers: {},
debug: bool, signingPrivateKeyPem: str) -> int:
debug: bool, signing_priv_key_pem: str) -> int:
"""Check if an account has moved, and if so then alter following.txt
for each account.
Returns 1 if moved, 0 otherwise
@ -61,7 +61,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
wfRequest = webfingerHandle(session, handle,
http_prefix, cached_webfingers,
domain, __version__, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
print('updateMovedHandle unable to webfinger ' + handle)
return ctr
@ -86,7 +86,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
gnunet = True
personJson = \
getActorJson(domain, personUrl, http_prefix, gnunet, debug, False,
signingPrivateKeyPem, None)
signing_priv_key_pem, None)
if not personJson:
return ctr
if not personJson.get('movedTo'):
@ -175,7 +175,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
def migrateAccounts(base_dir: str, session,
http_prefix: str, cached_webfingers: {},
debug: bool, signingPrivateKeyPem: str) -> int:
debug: bool, signing_priv_key_pem: str) -> int:
"""If followed accounts change then this modifies the
following lists for each account accordingly.
Returns the number of accounts migrated
@ -192,6 +192,6 @@ def migrateAccounts(base_dir: str, session,
_moveFollowingHandlesForAccount(base_dir, nickname, domain,
session, http_prefix,
cached_webfingers, debug,
signingPrivateKeyPem)
signing_priv_key_pem)
break
return ctr

View File

@ -287,7 +287,7 @@ def hashtagRuleTree(operators: [],
def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
post_json_object: {},
actionStr: str, hashtags: [], systemLanguage: str,
actionStr: str, hashtags: [], system_language: str,
translate: {}) -> None:
"""Adds a hashtag via a hashtag rule
"""
@ -322,7 +322,7 @@ def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
hashtagHtml = \
" <a href=\"" + hashtagUrl + "\" class=\"addedHashtag\" " + \
"rel=\"tag\">#<span>" + htId + "</span></a>"
content = getBaseContentFromPost(post_json_object, systemLanguage)
content = getBaseContentFromPost(post_json_object, system_language)
if hashtagHtml in content:
return
@ -342,7 +342,7 @@ def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
def _hashtagRemove(http_prefix: str, domainFull: str, post_json_object: {},
actionStr: str, hashtags: [], systemLanguage: str) -> None:
actionStr: str, hashtags: [], system_language: str) -> None:
"""Removes a hashtag via a hashtag rule
"""
rmHashtag = actionStr.split('remove ', 1)[1].strip()
@ -357,11 +357,11 @@ def _hashtagRemove(http_prefix: str, domainFull: str, post_json_object: {},
hashtagHtml = \
"<a href=\"" + hashtagUrl + "\" class=\"addedHashtag\" " + \
"rel=\"tag\">#<span>" + htId + "</span></a>"
content = getBaseContentFromPost(post_json_object, systemLanguage)
content = getBaseContentFromPost(post_json_object, system_language)
if hashtagHtml in content:
content = content.replace(hashtagHtml, '').replace(' ', ' ')
post_json_object['object']['content'] = content
post_json_object['object']['contentMap'][systemLanguage] = content
post_json_object['object']['contentMap'][system_language] = content
rmTagObject = None
for t in post_json_object['object']['tag']:
if t.get('type') and t.get('name'):
@ -381,7 +381,7 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
federationList: [],
send_threads: [], postLog: [],
moderated: bool, url: str,
systemLanguage: str,
system_language: str,
translate: {}) -> bool:
"""Applies hashtag rules to a news post.
Returns true if the post should be saved to the news timeline
@ -399,7 +399,7 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
# get the full text content of the post
content = ''
if post_json_object['object'].get('content'):
content += getBaseContentFromPost(post_json_object, systemLanguage)
content += getBaseContentFromPost(post_json_object, system_language)
if post_json_object['object'].get('summary'):
content += ' ' + post_json_object['object']['summary']
content = content.lower()
@ -426,12 +426,12 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
if actionStr.startswith('add '):
# add a hashtag
_hashtagAdd(base_dir, http_prefix, domainFull,
post_json_object, actionStr, hashtags, systemLanguage,
post_json_object, actionStr, hashtags, system_language,
translate)
elif actionStr.startswith('remove '):
# remove a hashtag
_hashtagRemove(http_prefix, domainFull, post_json_object,
actionStr, hashtags, systemLanguage)
actionStr, hashtags, system_language)
elif actionStr.startswith('block') or actionStr.startswith('drop'):
# Block this item
return False
@ -544,7 +544,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
send_threads: [], postLog: [],
max_mirrored_articles: int,
allow_local_network_access: bool,
systemLanguage: str,
system_language: str,
low_bandwidth: bool,
content_license_url: str) -> None:
"""Converts rss items in a newswire into posts
@ -637,7 +637,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
followersOnly, saveToFile,
attachImageFilename, mediaType,
imageDescription, city,
rssTitle, systemLanguage,
rssTitle, system_language,
conversationId, low_bandwidth,
content_license_url)
if not blog:
@ -669,7 +669,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
blog['object']['published'] = dateStr
blog['object']['content'] = rssDescription
blog['object']['contentMap'][systemLanguage] = rssDescription
blog['object']['contentMap'][system_language] = rssDescription
domainFull = getFullDomain(domain, port)
@ -685,7 +685,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
person_cache, cached_webfingers,
federationList,
send_threads, postLog,
moderated, url, systemLanguage,
moderated, url, system_language,
translate)
# save the post and update the index
@ -708,7 +708,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
"\" class=\"addedHashtag\" " + \
"rel=\"tag\">#<span>" + \
htId + "</span></a>"
content = getBaseContentFromPost(blog, systemLanguage)
content = getBaseContentFromPost(blog, system_language)
if hashtagHtml not in content:
if content.endswith('</p>'):
content = \
@ -717,7 +717,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
else:
content += hashtagHtml
blog['object']['content'] = content
blog['object']['contentMap'][systemLanguage] = content
blog['object']['contentMap'][system_language] = content
# update the newswire tags if new ones have been found by
# _newswireHashtagProcessing
@ -802,7 +802,7 @@ def runNewswireDaemon(base_dir: str, httpd,
httpd.max_feed_item_size_kb,
httpd.max_newswire_posts,
httpd.maxCategoriesFeedItemSizeKb,
httpd.systemLanguage,
httpd.system_language,
httpd.debug)
if not httpd.newswire:
@ -835,7 +835,7 @@ def runNewswireDaemon(base_dir: str, httpd,
httpd.postLog,
httpd.max_mirrored_articles,
httpd.allow_local_network_access,
httpd.systemLanguage,
httpd.system_language,
httpd.low_bandwidth,
httpd.content_license_url)
print('Newswire feed converted to ActivityPub')

View File

@ -1008,7 +1008,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
newswire: {},
maxBlogsPerAccount: int,
indexFilename: str,
maxTags: int, systemLanguage: str,
maxTags: int, system_language: str,
session, debug: bool) -> None:
"""Adds blogs for the given account to the newswire
"""
@ -1063,7 +1063,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
votes = loadJson(fullPostFilename + '.votes')
content = \
getBaseContentFromPost(post_json_object,
systemLanguage)
system_language)
description = firstParagraphFromString(content)
description = removeHtml(description)
tagsFromPost = _getHashtagsFromPost(post_json_object)
@ -1084,7 +1084,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
def _addBlogsToNewswire(base_dir: str, domain: str, newswire: {},
maxBlogsPerAccount: int,
maxTags: int, systemLanguage: str,
maxTags: int, system_language: str,
session, debug: bool) -> None:
"""Adds blogs from each user account into the newswire
"""
@ -1114,7 +1114,7 @@ def _addBlogsToNewswire(base_dir: str, domain: str, newswire: {},
_addAccountBlogsToNewswire(base_dir, nickname, domain,
newswire, maxBlogsPerAccount,
blogsIndex, maxTags,
systemLanguage, session,
system_language, session,
debug)
break
@ -1140,7 +1140,7 @@ def getDictFromNewswire(session, base_dir: str, domain: str,
maxTags: int, max_feed_item_size_kb: int,
max_newswire_posts: int,
maxCategoriesFeedItemSizeKb: int,
systemLanguage: str, debug: bool) -> {}:
system_language: str, debug: bool) -> {}:
"""Gets rss feeds as a dictionary from newswire file
"""
subscriptionsFilename = base_dir + '/accounts/newswire.txt'
@ -1188,7 +1188,7 @@ def getDictFromNewswire(session, base_dir: str, domain: str,
# add blogs from each user account
_addBlogsToNewswire(base_dir, domain, result,
maxPostsPerSource, maxTags, systemLanguage,
maxPostsPerSource, maxTags, system_language,
session, debug)
# sort into chronological order, latest first

View File

@ -191,11 +191,11 @@ def postMessageToOutbox(session, translate: {},
twitter_replacement_domain: str,
show_published_date_only: bool,
allow_local_network_access: bool,
city: str, systemLanguage: str,
city: str, system_language: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
low_bandwidth: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
peertubeInstances: str, theme: str,
max_like_count: int,
max_recent_posts: int, CWlists: {},
@ -223,7 +223,7 @@ def postMessageToOutbox(session, translate: {},
# check that the outgoing post doesn't contain any markup
# which can be used to implement exploits
if hasObjectDict(messageJson):
contentStr = getBaseContentFromPost(messageJson, systemLanguage)
contentStr = getBaseContentFromPost(messageJson, system_language)
if contentStr:
if dangerousMarkup(contentStr, allow_local_network_access):
print('POST to outbox contains dangerous markup: ' +
@ -286,10 +286,11 @@ def postMessageToOutbox(session, translate: {},
print('DEBUG: domain is blocked: ' + messageJson['actor'])
return False
# replace youtube, so that google gets less tracking data
replaceYouTube(messageJson, yt_replace_domain, systemLanguage)
replaceYouTube(messageJson, yt_replace_domain, system_language)
# replace twitter, so that twitter posts can be shown without
# having a twitter account
replaceTwitter(messageJson, twitter_replacement_domain, systemLanguage)
replaceTwitter(messageJson, twitter_replacement_domain,
system_language)
# https://www.w3.org/TR/activitypub/#create-activity-outbox
messageJson['object']['attributedTo'] = messageJson['actor']
if messageJson['object'].get('attachment'):
@ -426,9 +427,9 @@ def postMessageToOutbox(session, translate: {},
yt_replace_domain,
twitter_replacement_domain,
allow_local_network_access,
recentPostsCache, debug, systemLanguage,
recentPostsCache, debug, system_language,
domainFull, person_cache,
signingPrivateKeyPem):
signing_priv_key_pem):
inboxUpdateIndex('tlmedia', base_dir,
postToNickname + '@' + domain,
savedFilename, debug)
@ -452,7 +453,7 @@ def postMessageToOutbox(session, translate: {},
manuallyApproveFollowers = \
followerApprovalActive(base_dir,
postToNickname, domain)
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
False, recentPostsCache,
max_recent_posts,
translate, pageNumber,
@ -469,7 +470,7 @@ def postMessageToOutbox(session, translate: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
theme, systemLanguage,
theme, system_language,
max_like_count,
boxNameIndex != 'dm',
showIndividualPostIcons,
@ -523,7 +524,7 @@ def postMessageToOutbox(session, translate: {},
version,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem)
signing_priv_key_pem)
followers_threads.append(followersThread)
if debug:
@ -625,7 +626,7 @@ def postMessageToOutbox(session, translate: {},
print('DEBUG: handle share uploads')
outboxShareUpload(base_dir, http_prefix, postToNickname, domain,
port, messageJson, debug, city,
systemLanguage, translate, low_bandwidth,
system_language, translate, low_bandwidth,
content_license_url)
if debug:
@ -664,6 +665,6 @@ def postMessageToOutbox(session, translate: {},
version,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem)
signing_priv_key_pem)
followers_threads.append(namedAddressesThread)
return True

View File

@ -1429,7 +1429,7 @@ def _detectUsersPath(url: str) -> str:
def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
debug: bool, quiet: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
existingSession) -> ({}, {}):
"""Returns the actor json
"""
@ -1537,7 +1537,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
wfRequest = webfingerHandle(session, handle,
http_prefix, cached_webfingers,
hostDomain, __version__, debug,
groupAccount, signingPrivateKeyPem)
groupAccount, signing_priv_key_pem)
if not wfRequest:
if not quiet:
print('getActorJson Unable to webfinger ' + handle)
@ -1594,7 +1594,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
'Accept': headerMimeType + '; profile="' + profileStr + '"'
}
personJson = \
getJson(signingPrivateKeyPem, session, personUrl, asHeader, None,
getJson(signing_priv_key_pem, session, personUrl, asHeader, None,
debug, __version__, http_prefix, hostDomain, 20, quiet)
if personJson:
if not quiet:
@ -1658,7 +1658,7 @@ def validSendingActor(session, base_dir: str,
nickname: str, domain: str,
person_cache: {},
post_json_object: {},
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
debug: bool, unit_test: bool) -> bool:
"""When a post arrives in the inbox this is used to check that
the sending actor is valid
@ -1681,7 +1681,7 @@ def validSendingActor(session, base_dir: str,
# download the actor
actorJson, _ = getActorJson(domain, sendingActor,
True, False, debug, True,
signingPrivateKeyPem, session)
signing_priv_key_pem, session)
if actorJson:
downloadedActor = True
if not actorJson:

20
pgp.py
View File

@ -334,7 +334,7 @@ def _pgpEncrypt(content: str, recipientPubKey: str) -> str:
return encryptResult
def _getPGPPublicKeyFromActor(signingPrivateKeyPem: str,
def _getPGPPublicKeyFromActor(signing_priv_key_pem: str,
domain: str, handle: str,
actorJson: {} = None) -> str:
"""Searches tags on the actor to see if there is any PGP
@ -343,7 +343,7 @@ def _getPGPPublicKeyFromActor(signingPrivateKeyPem: str,
if not actorJson:
actorJson, asHeader = \
getActorJson(domain, handle, False, False, False, True,
signingPrivateKeyPem, None)
signing_priv_key_pem, None)
if not actorJson:
return None
if not actorJson.get('attachment'):
@ -376,12 +376,12 @@ def hasLocalPGPkey() -> bool:
def pgpEncryptToActor(domain: str, content: str, toHandle: str,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""PGP encrypt a message to the given actor or handle
"""
# get the actor and extract the pgp public key from it
recipientPubKey = \
_getPGPPublicKeyFromActor(signingPrivateKeyPem, domain, toHandle)
_getPGPPublicKeyFromActor(signing_priv_key_pem, domain, toHandle)
if not recipientPubKey:
return None
# encrypt using the recipient public key
@ -389,7 +389,7 @@ def pgpEncryptToActor(domain: str, content: str, toHandle: str,
def pgpDecrypt(domain: str, content: str, fromHandle: str,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
""" Encrypt using your default pgp key to the given recipient
fromHandle can be a handle or actor url
"""
@ -401,7 +401,7 @@ def pgpDecrypt(domain: str, content: str, fromHandle: str,
pubKey = extractPGPPublicKey(content)
else:
pubKey = \
_getPGPPublicKeyFromActor(signingPrivateKeyPem,
_getPGPPublicKeyFromActor(signing_priv_key_pem,
domain, content, fromHandle)
if pubKey:
_pgpImportPubKey(pubKey)
@ -458,7 +458,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
http_prefix: str,
cached_webfingers: {}, person_cache: {},
debug: bool, test: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
if debug:
print('pgpPublicKeyUpload')
@ -491,7 +491,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
actorJson, asHeader = \
getActorJson(domainFull, handle, False, False, debug, True,
signingPrivateKeyPem, session)
signing_priv_key_pem, session)
if not actorJson:
if debug:
print('No actor returned for ' + handle)
@ -559,7 +559,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
domain, __version__, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: pgp actor update webfinger failed for ' +
@ -576,7 +576,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem, originDomain,
displayName, _) = getPersonBox(signing_priv_key_pem, originDomain,
base_dir, session, wfRequest, person_cache,
__version__, http_prefix, nickname,
domain, postToBox, 35725)

262
posts.py
View File

@ -226,7 +226,7 @@ def getUserUrl(wfRequest: {}, sourceId: int, debug: bool) -> str:
return None
def parseUserFeed(signingPrivateKeyPem: str,
def parseUserFeed(signing_priv_key_pem: str,
session, feedUrl: str, asHeader: {},
project_version: str, http_prefix: str,
originDomain: str, debug: bool, depth: int = 0) -> []:
@ -241,7 +241,7 @@ def parseUserFeed(signingPrivateKeyPem: str,
print('http_prefix ' + str(http_prefix))
print('originDomain ' + str(originDomain))
feedJson = getJson(signingPrivateKeyPem, session, feedUrl, asHeader, None,
feedJson = getJson(signing_priv_key_pem, session, feedUrl, asHeader, None,
debug, project_version, http_prefix, originDomain)
if not feedJson:
profileStr = 'https://www.w3.org/ns/activitystreams'
@ -250,7 +250,7 @@ def parseUserFeed(signingPrivateKeyPem: str,
asHeader = {
'Accept': acceptStr
}
feedJson = getJson(signingPrivateKeyPem, session, feedUrl,
feedJson = getJson(signing_priv_key_pem, session, feedUrl,
asHeader, None, debug, project_version,
http_prefix, originDomain)
if not feedJson:
@ -280,7 +280,7 @@ def parseUserFeed(signingPrivateKeyPem: str,
if isinstance(nextUrl, str):
if '?max_id=0' not in nextUrl:
userFeed = \
parseUserFeed(signingPrivateKeyPem,
parseUserFeed(signing_priv_key_pem,
session, nextUrl, asHeader,
project_version, http_prefix,
originDomain, debug, depth + 1)
@ -300,7 +300,7 @@ def _getPersonBoxActor(session, base_dir: str, actor: str,
debug: bool, project_version: str,
http_prefix: str, originDomain: str,
person_cache: {},
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
sourceId: int) -> {}:
"""Returns the actor json for the given actor url
"""
@ -313,24 +313,24 @@ def _getPersonBoxActor(session, base_dir: str, actor: str,
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
personJson = getJson(signingPrivateKeyPem, session, actor, asHeader, None,
personJson = getJson(signing_priv_key_pem, session, actor, asHeader, None,
debug, project_version, http_prefix, originDomain)
if personJson:
return personJson
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
personJson = getJson(signingPrivateKeyPem, session, actor, asHeader, None,
personJson = getJson(signing_priv_key_pem, session, actor, asHeader, None,
debug, project_version, http_prefix, originDomain)
if personJson:
return personJson
print('Unable to get actor for ' + actor + ' ' + str(sourceId))
if not signingPrivateKeyPem:
if not signing_priv_key_pem:
print('No signing key provided when getting actor')
return None
def getPersonBox(signingPrivateKeyPem: str, originDomain: str,
def getPersonBox(signing_priv_key_pem: str, originDomain: str,
base_dir: str, session, wfRequest: {}, person_cache: {},
project_version: str, http_prefix: str,
nickname: str, domain: str,
@ -369,7 +369,7 @@ def getPersonBox(signingPrivateKeyPem: str, originDomain: str,
profileStr, asHeader,
debug, project_version,
http_prefix, originDomain,
person_cache, signingPrivateKeyPem,
person_cache, signing_priv_key_pem,
sourceId)
if not personJson:
return None, None, None, None, None, None, None, None
@ -530,8 +530,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
person_cache: {}, raw: bool,
simple: bool, debug: bool,
project_version: str, http_prefix: str,
originDomain: str, systemLanguage: str,
signingPrivateKeyPem: str) -> {}:
originDomain: str, system_language: str,
signing_priv_key_pem: str) -> {}:
"""Gets public posts from an outbox
"""
if debug:
@ -558,7 +558,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
print('Returning the raw feed')
result = []
i = 0
userFeed = parseUserFeed(signingPrivateKeyPem,
userFeed = parseUserFeed(signing_priv_key_pem,
session, outboxUrl, asHeader,
project_version, http_prefix,
originDomain, debug)
@ -572,7 +572,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
if debug:
print('Returning a human readable version of the feed')
userFeed = parseUserFeed(signingPrivateKeyPem,
userFeed = parseUserFeed(signing_priv_key_pem,
session, outboxUrl, asHeader,
project_version, http_prefix,
originDomain, debug)
@ -591,7 +591,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
if item['type'] != 'Note' and item['type'] != 'Page':
thisItem = item['object']
content = getBaseContentFromPost(item, systemLanguage)
content = getBaseContentFromPost(item, system_language)
content = content.replace('&apos;', "'")
mentions = []
@ -751,8 +751,8 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
project_version: str, http_prefix: str,
domain: str,
wordFrequency: {},
domainList: [], systemLanguage: str,
signingPrivateKeyPem: str) -> []:
domainList: [], system_language: str,
signing_priv_key_pem: str) -> []:
"""Returns a list of domains referenced within public posts
"""
if not outboxUrl:
@ -775,7 +775,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
postDomains = domainList
i = 0
userFeed = parseUserFeed(signingPrivateKeyPem,
userFeed = parseUserFeed(signing_priv_key_pem,
session, outboxUrl, asHeader,
project_version, http_prefix, domain, debug)
for item in userFeed:
@ -784,7 +784,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
break
if not hasObjectDict(item):
continue
contentStr = getBaseContentFromPost(item, systemLanguage)
contentStr = getBaseContentFromPost(item, system_language)
if contentStr:
_updateWordFrequency(contentStr, wordFrequency)
if item['object'].get('inReplyTo'):
@ -817,7 +817,7 @@ def _getPostsForBlockedDomains(base_dir: str,
debug: bool,
project_version: str, http_prefix: str,
domain: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Returns a dictionary of posts for blocked domains
"""
if not outboxUrl:
@ -840,7 +840,7 @@ def _getPostsForBlockedDomains(base_dir: str,
blockedPosts = {}
i = 0
userFeed = parseUserFeed(signingPrivateKeyPem,
userFeed = parseUserFeed(signing_priv_key_pem,
session, outboxUrl, asHeader,
project_version, http_prefix, domain, debug)
for item in userFeed:
@ -1071,7 +1071,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
tags: [], attachImageFilename: str,
mediaType: str, imageDescription: str, city: str,
postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str,
inReplyToAtomUri: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Creates a new server-to-server post
@ -1113,7 +1113,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
'mediaType': 'text/html',
'content': content,
'contentMap': {
systemLanguage: content
system_language: content
},
'attachment': [],
'tag': tags,
@ -1146,7 +1146,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
tags: [], attachImageFilename: str,
mediaType: str, imageDescription: str, city: str,
postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str,
inReplyToAtomUri: str, system_language: str,
conversationId: str, low_bandwidth: str,
content_license_url: str) -> {}:
"""Creates a new client-to-server post
@ -1179,7 +1179,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
'mediaType': 'text/html',
'content': content,
'contentMap': {
systemLanguage: content
system_language: content
},
'attachment': [],
'tag': tags,
@ -1380,7 +1380,7 @@ def _createPostBase(base_dir: str,
repliesModerationOption: str,
anonymousParticipationEnabled: bool,
eventStatus: str, ticketUrl: str,
systemLanguage: str,
system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Creates a message
@ -1516,7 +1516,7 @@ def _createPostBase(base_dir: str,
tags, attachImageFilename,
mediaType, imageDescription, city,
postObjectType, summary,
inReplyToAtomUri, systemLanguage,
inReplyToAtomUri, system_language,
conversationId, low_bandwidth,
content_license_url)
else:
@ -1529,7 +1529,7 @@ def _createPostBase(base_dir: str,
tags, attachImageFilename,
mediaType, imageDescription, city,
postObjectType, summary,
inReplyToAtomUri, systemLanguage,
inReplyToAtomUri, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -1661,7 +1661,7 @@ def undoPinnedPost(base_dir: str, nickname: str, domain: str) -> None:
def getPinnedPostAsJson(base_dir: str, http_prefix: str,
nickname: str, domain: str,
domainFull: str, systemLanguage: str) -> {}:
domainFull: str, system_language: str) -> {}:
"""Returns the pinned profile post as json
"""
accountDir = acctDir(base_dir, nickname, domain)
@ -1682,7 +1682,7 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
],
'content': pinnedContent,
'contentMap': {
systemLanguage: pinnedContent
system_language: pinnedContent
},
'id': actor + '/pinned',
'inReplyTo': None,
@ -1701,13 +1701,13 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
def jsonPinPost(base_dir: str, http_prefix: str,
nickname: str, domain: str,
domainFull: str, systemLanguage: str) -> {}:
domainFull: str, system_language: str) -> {}:
"""Returns a pinned post as json
"""
pinnedPostJson = \
getPinnedPostAsJson(base_dir, http_prefix,
nickname, domain,
domainFull, systemLanguage)
domainFull, system_language)
itemsList = []
if pinnedPostJson:
itemsList = [pinnedPostJson]
@ -1766,7 +1766,7 @@ def createPublicPost(base_dir: str,
eventDate: str, eventTime: str,
location: str,
isArticle: bool,
systemLanguage: str,
system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Public post
@ -1798,7 +1798,7 @@ def createPublicPost(base_dir: str,
maximumAttendeeCapacity,
repliesModerationOption,
anonymousParticipationEnabled,
eventStatus, ticketUrl, systemLanguage,
eventStatus, ticketUrl, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -1842,7 +1842,7 @@ def createBlogPost(base_dir: str,
inReplyTo: str, inReplyToAtomUri: str,
subject: str, schedulePost: bool,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
location: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
blogJson = \
@ -1855,7 +1855,7 @@ def createBlogPost(base_dir: str,
inReplyTo, inReplyToAtomUri, subject,
schedulePost,
eventDate, eventTime, location,
True, systemLanguage, conversationId,
True, system_language, conversationId,
low_bandwidth, content_license_url)
blogJson['object']['url'] = \
blogJson['object']['url'].replace('/@', '/users/')
@ -1869,7 +1869,7 @@ def createNewsPost(base_dir: str,
content: str, followersOnly: bool, saveToFile: bool,
attachImageFilename: str, mediaType: str,
imageDescription: str, city: str,
subject: str, systemLanguage: str,
subject: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
client_to_server = False
@ -1889,7 +1889,7 @@ def createNewsPost(base_dir: str,
inReplyTo, inReplyToAtomUri, subject,
schedulePost,
eventDate, eventTime, location,
True, systemLanguage, conversationId,
True, system_language, conversationId,
low_bandwidth, content_license_url)
blog['object']['type'] = 'Article'
return blog
@ -1903,7 +1903,7 @@ def createQuestionPost(base_dir: str,
attachImageFilename: str, mediaType: str,
imageDescription: str, city: str,
subject: str, durationDays: int,
systemLanguage: str, low_bandwidth: bool,
system_language: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Question post with multiple choice options
"""
@ -1920,7 +1920,7 @@ def createQuestionPost(base_dir: str,
False, False, None, None, subject,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
None, low_bandwidth, content_license_url)
messageJson['object']['type'] = 'Question'
messageJson['object']['oneOf'] = []
@ -1952,7 +1952,7 @@ def createUnlistedPost(base_dir: str,
inReplyTo: str, inReplyToAtomUri: str,
subject: str, schedulePost: bool,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
location: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Unlisted post. This has the #Public and followers links inverted.
@ -1970,7 +1970,7 @@ def createUnlistedPost(base_dir: str,
inReplyTo, inReplyToAtomUri, subject,
schedulePost, eventDate, eventTime, location,
None, None, None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -1987,7 +1987,7 @@ def createFollowersOnlyPost(base_dir: str,
inReplyToAtomUri: str,
subject: str, schedulePost: bool,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
location: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Followers only post
@ -2005,7 +2005,7 @@ def createFollowersOnlyPost(base_dir: str,
inReplyTo, inReplyToAtomUri, subject,
schedulePost, eventDate, eventTime, location,
None, None, None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -2058,7 +2058,7 @@ def createDirectMessagePost(base_dir: str,
subject: str, debug: bool,
schedulePost: bool,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
location: str, system_language: str,
conversationId: str, low_bandwidth: bool,
content_license_url: str) -> {}:
"""Direct Message post
@ -2083,7 +2083,7 @@ def createDirectMessagePost(base_dir: str,
inReplyTo, inReplyToAtomUri, subject,
schedulePost, eventDate, eventTime, location,
None, None, None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
conversationId, low_bandwidth,
content_license_url)
# mentioned recipients go into To rather than Cc
@ -2104,7 +2104,7 @@ def createReportPost(base_dir: str,
client_to_server: bool, commentsEnabled: bool,
attachImageFilename: str, mediaType: str,
imageDescription: str, city: str,
debug: bool, subject: str, systemLanguage: str,
debug: bool, subject: str, system_language: str,
low_bandwidth: bool,
content_license_url: str) -> {}:
"""Send a report to moderators
@ -2179,7 +2179,7 @@ def createReportPost(base_dir: str,
True, False, None, None, subject,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
None, low_bandwidth, content_license_url)
if not post_json_object:
continue
@ -2263,7 +2263,7 @@ def threadSendPost(session, postJsonStr: str, federationList: [],
tries += 1
def sendPost(signingPrivateKeyPem: str, project_version: str,
def sendPost(signing_priv_key_pem: str, project_version: str,
session, base_dir: str, nickname: str, domain: str, port: int,
toNickname: str, toDomain: str, toPort: int, cc: str,
http_prefix: str, content: str, followersOnly: bool,
@ -2273,7 +2273,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str,
imageDescription: str, city: str,
federationList: [], send_threads: [], postLog: [],
cached_webfingers: {}, person_cache: {},
isArticle: bool, systemLanguage: str,
isArticle: bool, system_language: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
low_bandwidth: bool, content_license_url: str,
@ -2296,7 +2296,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
return 1
if not isinstance(wfRequest, dict):
@ -2314,7 +2314,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, toPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -2341,7 +2341,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str,
inReplyToAtomUri, subject,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -2414,7 +2414,7 @@ def sendPost(signingPrivateKeyPem: str, project_version: str,
return 0
def sendPostViaServer(signingPrivateKeyPem: str, project_version: str,
def sendPostViaServer(signing_priv_key_pem: str, project_version: str,
base_dir: str, session, fromNickname: str, password: str,
fromDomain: str, fromPort: int,
toNickname: str, toDomain: str, toPort: int, cc: str,
@ -2423,7 +2423,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str,
attachImageFilename: str, mediaType: str,
imageDescription: str, city: str,
cached_webfingers: {}, person_cache: {},
isArticle: bool, systemLanguage: str,
isArticle: bool, system_language: str,
low_bandwidth: bool,
content_license_url: str,
debug: bool = False,
@ -2445,7 +2445,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomainFull, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: post webfinger failed for ' + handle)
@ -2462,7 +2462,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -2510,7 +2510,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, project_version: str,
inReplyToAtomUri, subject,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, None, None, None, None, system_language,
conversationId, low_bandwidth,
content_license_url)
@ -2616,7 +2616,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str,
send_threads: [], postLog: [], cached_webfingers: {},
person_cache: {}, debug: bool, project_version: str,
sharedItemsToken: str, groupAccount: bool,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
sourceId: int) -> int:
"""Sends a signed json object to an inbox/outbox
"""
@ -2655,7 +2655,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, groupAccount,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: webfinger for ' + handle + ' failed')
@ -2678,7 +2678,7 @@ def sendSignedJson(post_json_object: {}, session, base_dir: str,
# get the actor inbox/outbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, toPersonId, sharedInboxUrl, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -2868,7 +2868,7 @@ def _sendToNamedAddresses(session, base_dir: str,
project_version: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""sends a post to the specific named addresses in to/cc
"""
if not session:
@ -3008,7 +3008,7 @@ def _sendToNamedAddresses(session, base_dir: str,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
signingPrivateKeyPem, 34436782)
signing_priv_key_pem, 34436782)
def sendToNamedAddressesThread(session, base_dir: str,
@ -3021,7 +3021,7 @@ def sendToNamedAddressesThread(session, base_dir: str,
project_version: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
signingPrivateKeyPem: str):
signing_priv_key_pem: str):
"""Returns a thread used to send a post to named addresses
"""
sendThread = \
@ -3036,7 +3036,7 @@ def sendToNamedAddressesThread(session, base_dir: str,
project_version,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem), daemon=True)
signing_priv_key_pem), daemon=True)
try:
sendThread.start()
except SocketError as ex:
@ -3051,7 +3051,7 @@ def sendToNamedAddressesThread(session, base_dir: str,
def _hasSharedInbox(session, http_prefix: str, domain: str,
debug: bool, signingPrivateKeyPem: str) -> bool:
debug: bool, signing_priv_key_pem: str) -> bool:
"""Returns true if the given domain has a shared inbox
This tries the new and the old way of webfingering the shared inbox
"""
@ -3062,7 +3062,7 @@ def _hasSharedInbox(session, http_prefix: str, domain: str,
for handle in tryHandles:
wfRequest = webfingerHandle(session, handle, http_prefix, {},
domain, __version__, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if wfRequest:
if isinstance(wfRequest, dict):
if not wfRequest.get('errors'):
@ -3097,7 +3097,7 @@ def sendToFollowers(session, base_dir: str,
project_version: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
signingPrivateKeyPem: str) -> None:
signing_priv_key_pem: str) -> None:
"""sends a post to the followers of the given nickname
"""
print('sendToFollowers')
@ -3157,7 +3157,7 @@ def sendToFollowers(session, base_dir: str,
withSharedInbox = \
_hasSharedInbox(session, http_prefix, followerDomain, debug,
signingPrivateKeyPem)
signing_priv_key_pem)
if debug:
if withSharedInbox:
print(followerDomain + ' has shared inbox')
@ -3218,7 +3218,7 @@ def sendToFollowers(session, base_dir: str,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
signingPrivateKeyPem, 639342)
signing_priv_key_pem, 639342)
else:
# send to individual followers without using a shared inbox
for handle in followerHandles:
@ -3247,7 +3247,7 @@ def sendToFollowers(session, base_dir: str,
send_threads, postLog, cached_webfingers,
person_cache, debug, project_version,
sharedItemsToken, groupAccount,
signingPrivateKeyPem, 634219)
signing_priv_key_pem, 634219)
time.sleep(4)
@ -3270,7 +3270,7 @@ def sendToFollowersThread(session, base_dir: str,
project_version: str,
shared_items_federated_domains: [],
sharedItemFederationTokens: {},
signingPrivateKeyPem: str):
signing_priv_key_pem: str):
"""Returns a thread used to send a post to followers
"""
sendThread = \
@ -3285,7 +3285,7 @@ def sendToFollowersThread(session, base_dir: str,
project_version,
shared_items_federated_domains,
sharedItemFederationTokens,
signingPrivateKeyPem), daemon=True)
signing_priv_key_pem), daemon=True)
try:
sendThread.start()
except SocketError as ex:
@ -3461,9 +3461,9 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
twitter_replacement_domain: str,
allow_local_network_access: bool,
recentPostsCache: {}, debug: bool,
systemLanguage: str,
system_language: str,
domainFull: str, person_cache: {},
signingPrivateKeyPem: str) -> bool:
signing_priv_key_pem: str) -> bool:
"""Returns true if the given post has attached image media
"""
if post_json_object['type'] == 'Announce':
@ -3476,9 +3476,9 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
twitter_replacement_domain,
allow_local_network_access,
recentPostsCache, debug,
systemLanguage,
system_language,
domainFull, person_cache,
signingPrivateKeyPem,
signing_priv_key_pem,
blockedCache)
if postJsonAnnounce:
post_json_object = postJsonAnnounce
@ -4062,13 +4062,13 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
raw: bool, simple: bool, proxy_type: str,
port: int, http_prefix: str,
debug: bool, project_version: str,
systemLanguage: str,
signingPrivateKeyPem: str,
system_language: str,
signing_priv_key_pem: str,
originDomain: str) -> None:
""" This is really just for test purposes
"""
if debug:
if signingPrivateKeyPem:
if signing_priv_key_pem:
print('Signing key available')
else:
print('Signing key missing')
@ -4092,7 +4092,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
originDomain, project_version, debug, groupAccount,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('No webfinger result was returned for ' + handle)
@ -4105,7 +4105,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
if debug:
print('Getting the outbox for ' + handle)
(personUrl, pubKeyId, pubKey, personId, shaedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -4123,8 +4123,8 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
_getPosts(session, personUrl, 30, max_mentions, max_emoji,
maxAttachments, federationList,
person_cache, raw, simple, debug,
project_version, http_prefix, originDomain, systemLanguage,
signingPrivateKeyPem)
project_version, http_prefix, originDomain, system_language,
signing_priv_key_pem)
def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
@ -4132,8 +4132,8 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
proxy_type: str, port: int, http_prefix: str,
debug: bool, project_version: str,
wordFrequency: {}, domainList: [],
systemLanguage: str,
signingPrivateKeyPem: str) -> []:
system_language: str,
signing_priv_key_pem: str) -> []:
""" Returns a list of domains referenced within public posts
"""
if not session:
@ -4149,7 +4149,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
return domainList
if not isinstance(wfRequest, dict):
@ -4158,7 +4158,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
return domainList
(personUrl, pubKeyId, pubKey, personId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -4173,13 +4173,13 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
maxAttachments, federationList,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, domainList, systemLanguage,
signingPrivateKeyPem)
wordFrequency, domainList, system_language,
signing_priv_key_pem)
postDomains.sort()
return postDomains
def downloadFollowCollection(signingPrivateKeyPem: str,
def downloadFollowCollection(signing_priv_key_pem: str,
followType: str,
session, http_prefix: str,
actor: str, pageNumber: int,
@ -4206,7 +4206,7 @@ def downloadFollowCollection(signingPrivateKeyPem: str,
for pageCtr in range(noOfPages):
url = actor + '/' + followType + '?page=' + str(pageNumber + pageCtr)
followersJson = \
getJson(signingPrivateKeyPem, session, url, sessionHeaders, None,
getJson(signing_priv_key_pem, session, url, sessionHeaders, None,
debug, __version__, http_prefix, None)
if followersJson:
if followersJson.get('orderedItems'):
@ -4228,8 +4228,8 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
originDomain: str,
proxy_type: str, port: int, http_prefix: str,
debug: bool, project_version: str,
wordFrequency: {}, systemLanguage: str,
signingPrivateKeyPem: str) -> []:
wordFrequency: {}, system_language: str,
signing_priv_key_pem: str) -> []:
""" Returns a dict of domains referenced within public posts
"""
if not session:
@ -4245,7 +4245,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
return {}
if not isinstance(wfRequest, dict):
@ -4254,7 +4254,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
return {}
(personUrl, pubKeyId, pubKey, personId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -4266,11 +4266,13 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
maxAttachments = 5
maxPosts = 64
postDomains = \
getPostDomains(session, personUrl, maxPosts, max_mentions, max_emoji,
getPostDomains(session, personUrl, maxPosts,
max_mentions, max_emoji,
maxAttachments, federationList,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, [], systemLanguage, signingPrivateKeyPem)
wordFrequency, [], system_language,
signing_priv_key_pem)
postDomains.sort()
domainsInfo = {}
for d in postDomains:
@ -4285,7 +4287,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
person_cache,
debug,
project_version, http_prefix,
domain, signingPrivateKeyPem)
domain, signing_priv_key_pem)
for blockedDomain, postUrlList in blockedPosts.items():
domainsInfo[blockedDomain] += postUrlList
@ -4297,8 +4299,8 @@ def getPublicPostDomainsBlocked(session, base_dir: str,
proxy_type: str, port: int, http_prefix: str,
debug: bool, project_version: str,
wordFrequency: {}, domainList: [],
systemLanguage: str,
signingPrivateKeyPem: str) -> []:
system_language: str,
signing_priv_key_pem: str) -> []:
""" Returns a list of domains referenced within public posts which
are globally blocked on this instance
"""
@ -4308,8 +4310,8 @@ def getPublicPostDomainsBlocked(session, base_dir: str,
originDomain,
proxy_type, port, http_prefix,
debug, project_version,
wordFrequency, domainList, systemLanguage,
signingPrivateKeyPem)
wordFrequency, domainList, system_language,
signing_priv_key_pem)
if not postDomains:
return []
@ -4358,8 +4360,8 @@ def checkDomains(session, base_dir: str,
proxy_type: str, port: int, http_prefix: str,
debug: bool, project_version: str,
maxBlockedDomains: int, singleCheck: bool,
systemLanguage: str,
signingPrivateKeyPem: str) -> None:
system_language: str,
signing_priv_key_pem: str) -> None:
"""Checks follower accounts for references to globally blocked domains
"""
wordFrequency = {}
@ -4388,8 +4390,8 @@ def checkDomains(session, base_dir: str,
proxy_type, port, http_prefix,
debug, project_version,
wordFrequency, [],
systemLanguage,
signingPrivateKeyPem)
system_language,
signing_priv_key_pem)
if blockedDomains:
if len(blockedDomains) > maxBlockedDomains:
followerWarningStr += handle + '\n'
@ -4410,8 +4412,8 @@ def checkDomains(session, base_dir: str,
proxy_type, port, http_prefix,
debug, project_version,
wordFrequency, [],
systemLanguage,
signingPrivateKeyPem)
system_language,
signing_priv_key_pem)
if blockedDomains:
print(handle)
for d in blockedDomains:
@ -4512,9 +4514,9 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
twitter_replacement_domain: str,
allow_local_network_access: bool,
recentPostsCache: {}, debug: bool,
systemLanguage: str,
system_language: str,
domainFull: str, person_cache: {},
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
blockedCache: {}) -> {}:
"""Download the post referenced by an announce
"""
@ -4595,7 +4597,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
print('Downloading Announce content for ' +
post_json_object['object'])
announcedJson = \
getJson(signingPrivateKeyPem, session,
getJson(signing_priv_key_pem, session,
post_json_object['object'],
asHeader, None, debug, project_version,
http_prefix, domain)
@ -4623,7 +4625,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
if announcedJson['type'] == 'Video':
convertedJson = \
convertVideoToNote(base_dir, nickname, domain,
systemLanguage,
system_language,
announcedJson, blockedCache)
if convertedJson:
announcedJson = convertedJson
@ -4661,7 +4663,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
recentPostsCache)
return None
if not understoodPostLanguage(base_dir, nickname, domain,
announcedJson, systemLanguage,
announcedJson, system_language,
http_prefix, domainFull,
person_cache):
return None
@ -4729,9 +4731,9 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
recentPostsCache)
return None
post_json_object = announcedJson
replaceYouTube(post_json_object, yt_replace_domain, systemLanguage)
replaceYouTube(post_json_object, yt_replace_domain, system_language)
replaceTwitter(post_json_object, twitter_replacement_domain,
systemLanguage)
system_language)
if saveJson(post_json_object, announceFilename):
return post_json_object
return None
@ -4761,7 +4763,7 @@ def sendBlockViaServer(base_dir: str, session,
http_prefix: str, blockedUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a block via c2s
"""
if not session:
@ -4789,7 +4791,7 @@ def sendBlockViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: block webfinger failed for ' + handle)
@ -4804,7 +4806,7 @@ def sendBlockViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -4845,7 +4847,7 @@ def sendMuteViaServer(base_dir: str, session,
http_prefix: str, mutedUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a mute via c2s
"""
if not session:
@ -4869,7 +4871,7 @@ def sendMuteViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: mute webfinger failed for ' + handle)
@ -4884,7 +4886,7 @@ def sendMuteViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -4925,7 +4927,7 @@ def sendUndoMuteViaServer(base_dir: str, session,
http_prefix: str, mutedUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undoes a mute via c2s
"""
if not session:
@ -4954,7 +4956,7 @@ def sendUndoMuteViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: undo mute webfinger failed for ' + handle)
@ -4969,7 +4971,7 @@ def sendUndoMuteViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -5011,7 +5013,7 @@ def sendUndoBlockViaServer(base_dir: str, session,
http_prefix: str, blockedUrl: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a block via c2s
"""
if not session:
@ -5043,7 +5045,7 @@ def sendUndoBlockViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unblock webfinger failed for ' + handle)
@ -5058,7 +5060,7 @@ def sendUndoBlockViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest, person_cache,
project_version, http_prefix, fromNickname,
@ -5128,7 +5130,7 @@ def c2sBoxJson(base_dir: str, session,
domain: str, port: int,
http_prefix: str,
boxName: str, pageNumber: int,
debug: bool, signingPrivateKeyPem: str) -> {}:
debug: bool, signing_priv_key_pem: str) -> {}:
"""C2S Authenticated GET of posts for a timeline
"""
if not session:
@ -5150,7 +5152,7 @@ def c2sBoxJson(base_dir: str, session,
# GET json
url = actor + '/' + boxName + '?page=' + str(pageNumber)
boxJson = getJson(signingPrivateKeyPem, session, url, headers, None,
boxJson = getJson(signing_priv_key_pem, session, url, headers, None,
debug, __version__, http_prefix, None)
if boxJson is not None and debug:

View File

@ -70,7 +70,7 @@ def _reaction(recentPostsCache: {},
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates an emoji reaction
actor is the person doing the reacting
'to' might be a specific person (actor) whose post was reaction
@ -140,7 +140,7 @@ def _reaction(recentPostsCache: {},
http_prefix, True, client_to_server, federationList,
send_threads, postLog, cached_webfingers, person_cache,
debug, project_version, None, groupAccount,
signingPrivateKeyPem, 7165392)
signing_priv_key_pem, 7165392)
return newReactionJson
@ -155,7 +155,7 @@ def reactionPost(recentPostsCache: {},
send_threads: [], postLog: [],
person_cache: {}, cached_webfingers: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Adds a reaction to a given status post. This is only used by unit tests
"""
reactionDomain = getFullDomain(reactionDomain, reactionPort)
@ -170,7 +170,7 @@ def reactionPost(recentPostsCache: {},
ccList, http_prefix, objectUrl, emojiContent,
actorReaction, client_to_server,
send_threads, postLog, person_cache, cached_webfingers,
debug, project_version, signingPrivateKeyPem)
debug, project_version, signing_priv_key_pem)
def sendReactionViaServer(base_dir: str, session,
@ -180,7 +180,7 @@ def sendReactionViaServer(base_dir: str, session,
emojiContent: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a reaction via c2s
"""
if not session:
@ -209,7 +209,7 @@ def sendReactionViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: reaction webfinger failed for ' + handle)
@ -224,7 +224,7 @@ def sendReactionViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -270,7 +270,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
emojiContent: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undo a reaction via c2s
"""
if not session:
@ -299,7 +299,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
wfRequest = webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unreaction webfinger failed for ' + handle)
@ -315,7 +315,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,

View File

@ -118,11 +118,11 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.twitter_replacement_domain,
httpd.show_published_date_only,
httpd.allow_local_network_access,
httpd.city, httpd.systemLanguage,
httpd.city, httpd.system_language,
httpd.shared_items_federated_domains,
httpd.sharedItemFederationTokens,
httpd.low_bandwidth,
httpd.signingPrivateKeyPem,
httpd.signing_priv_key_pem,
httpd.peertubeInstances,
httpd.themeName,
httpd.max_like_count,

View File

@ -88,7 +88,7 @@ def urlExists(session, url: str, timeoutSec: int = 3,
def _getJsonRequest(session, url: str, domainFull: str, sessionHeaders: {},
sessionParams: {}, timeoutSec: int,
signingPrivateKeyPem: str, quiet: bool, debug: bool,
signing_priv_key_pem: str, quiet: bool, debug: bool,
returnJson: bool) -> {}:
"""http GET for json
"""
@ -138,7 +138,7 @@ def _getJsonRequest(session, url: str, domainFull: str, sessionHeaders: {},
def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
sessionParams: {}, timeoutSec: int,
signingPrivateKeyPem: str, quiet: bool, debug: bool) -> {}:
signing_priv_key_pem: str, quiet: bool, debug: bool) -> {}:
"""Authorized fetch - a signed version of GET
"""
if not domainFull:
@ -188,7 +188,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
if sessionHeaders.get('Accept'):
contentType = sessionHeaders['Accept']
signatureHeaderJson = \
createSignedHeader(None, signingPrivateKeyPem, 'actor', domain, port,
createSignedHeader(None, signing_priv_key_pem, 'actor', domain, port,
toDomain, toPort, path, http_prefix, withDigest,
messageStr, contentType)
if debug:
@ -210,7 +210,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
debug, returnJson)
def getJson(signingPrivateKeyPem: str,
def getJson(signing_priv_key_pem: str,
session, url: str, headers: {}, params: {}, debug: bool,
version: str = '1.2.0', http_prefix: str = 'https',
domain: str = 'testdomain',
@ -238,10 +238,10 @@ def getJson(signingPrivateKeyPem: str,
if debug:
HTTPConnection.debuglevel = 1
if signingPrivateKeyPem:
if signing_priv_key_pem:
return _getJsonSigned(session, url, domain,
sessionHeaders, sessionParams,
timeoutSec, signingPrivateKeyPem,
timeoutSec, signing_priv_key_pem,
quiet, debug)
else:
return _getJsonRequest(session, url, domain, sessionHeaders,
@ -249,7 +249,7 @@ def getJson(signingPrivateKeyPem: str,
None, quiet, debug, True)
def downloadHtml(signingPrivateKeyPem: str,
def downloadHtml(signing_priv_key_pem: str,
session, url: str, headers: {}, params: {}, debug: bool,
version: str = '1.2.0', http_prefix: str = 'https',
domain: str = 'testdomain',
@ -279,10 +279,10 @@ def downloadHtml(signingPrivateKeyPem: str,
if debug:
HTTPConnection.debuglevel = 1
if signingPrivateKeyPem:
if signing_priv_key_pem:
return _getJsonSigned(session, url, domain,
sessionHeaders, sessionParams,
timeoutSec, signingPrivateKeyPem,
timeoutSec, signing_priv_key_pem,
quiet, debug)
else:
return _getJsonRequest(session, url, domain, sessionHeaders,

View File

@ -46,7 +46,7 @@ from content import getPriceFromString
from blocking import isBlocked
def _loadDfcIds(base_dir: str, systemLanguage: str,
def _loadDfcIds(base_dir: str, system_language: str,
productType: str,
http_prefix: str, domainFull: str) -> {}:
"""Loads the product types ontology
@ -74,12 +74,12 @@ def _loadDfcIds(base_dir: str, systemLanguage: str,
for label in productTypes['@graph'][0]['rdfs:label']:
if not label.get('@language'):
continue
if label['@language'] == systemLanguage:
if label['@language'] == system_language:
languageExists = True
break
if not languageExists:
print('productTypes ontology does not contain the language ' +
systemLanguage)
system_language)
return None
dfcIds = {}
for item in productTypes['@graph']:
@ -92,7 +92,7 @@ def _loadDfcIds(base_dir: str, systemLanguage: str,
continue
if not label.get('@value'):
continue
if label['@language'] == systemLanguage:
if label['@language'] == system_language:
itemId = \
item['@id'].replace('http://static.datafoodconsortium.org',
http_prefix + '://' + domainFull)
@ -199,7 +199,7 @@ def _dfcProductTypeFromCategory(base_dir: str,
return None
def _getshareDfcId(base_dir: str, systemLanguage: str,
def _getshareDfcId(base_dir: str, system_language: str,
itemType: str, itemCategory: str,
translate: {},
http_prefix: str, domainFull: str,
@ -217,7 +217,7 @@ def _getshareDfcId(base_dir: str, systemLanguage: str,
itemType = itemType.replace('.', '')
return 'epicyon#' + itemType
if not dfcIds:
dfcIds = _loadDfcIds(base_dir, systemLanguage, matchedProductType,
dfcIds = _loadDfcIds(base_dir, system_language, matchedProductType,
http_prefix, domainFull)
if not dfcIds:
return ''
@ -306,7 +306,7 @@ def addShare(base_dir: str,
itemQty: float, itemType: str, itemCategory: str, location: str,
duration: str, debug: bool, city: str,
price: str, currency: str,
systemLanguage: str, translate: {},
system_language: str, translate: {},
sharesFileType: str, low_bandwidth: bool,
content_license_url: str) -> None:
"""Adds a new share
@ -329,7 +329,7 @@ def addShare(base_dir: str,
domainFull = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domainFull)
itemID = _getValidSharedItemID(actor, displayName)
dfcId = _getshareDfcId(base_dir, systemLanguage,
dfcId = _getshareDfcId(base_dir, system_language,
itemType, itemCategory, translate,
http_prefix, domainFull)
@ -561,7 +561,7 @@ def sendShareViaServer(base_dir, session,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
itemPrice: str, itemCurrency: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates an item share via c2s
"""
if not session:
@ -612,7 +612,7 @@ def sendShareViaServer(base_dir, session,
webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: share webfinger failed for ' + handle)
@ -627,7 +627,7 @@ def sendShareViaServer(base_dir, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,
@ -682,7 +682,7 @@ def sendUndoShareViaServer(base_dir: str, session,
http_prefix: str, displayName: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undoes a share via c2s
"""
if not session:
@ -716,7 +716,7 @@ def sendUndoShareViaServer(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unshare webfinger failed for ' + handle)
@ -731,7 +731,7 @@ def sendUndoShareViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,
@ -781,7 +781,7 @@ def sendWantedViaServer(base_dir, session,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
itemMaxPrice: str, itemCurrency: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Creates a wanted item via c2s
"""
if not session:
@ -832,7 +832,7 @@ def sendWantedViaServer(base_dir, session,
webfingerHandle(session, handle, http_prefix,
cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: share webfinger failed for ' + handle)
@ -847,7 +847,7 @@ def sendWantedViaServer(base_dir, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,
@ -902,7 +902,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
http_prefix: str, displayName: str,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Undoes a wanted item via c2s
"""
if not session:
@ -936,7 +936,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
wfRequest = \
webfingerHandle(session, handle, http_prefix, cached_webfingers,
fromDomain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: unwant webfinger failed for ' + handle)
@ -951,7 +951,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
# get the actor inbox for the To handle
originDomain = fromDomain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,
@ -995,7 +995,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
nickname: str, password: str,
domain: str, port: int,
http_prefix: str, debug: bool,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Returns the shared items catalog via c2s
"""
if not session:
@ -1014,7 +1014,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
url = localActorUrl(http_prefix, nickname, domainFull) + '/catalog'
if debug:
print('Shared items catalog request to: ' + url)
catalogJson = getJson(signingPrivateKeyPem, session, url, headers, None,
catalogJson = getJson(signing_priv_key_pem, session, url, headers, None,
debug, __version__, http_prefix, None)
if not catalogJson:
if debug:
@ -1030,7 +1030,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
def outboxShareUpload(base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
messageJson: {}, debug: bool, city: str,
systemLanguage: str, translate: {},
system_language: str, translate: {},
low_bandwidth: bool,
content_license_url: str) -> None:
""" When a shared item is received by the outbox from c2s
@ -1093,7 +1093,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
debug, city,
messageJson['object']['itemPrice'],
messageJson['object']['itemCurrency'],
systemLanguage, translate, 'shares',
system_language, translate, 'shares',
low_bandwidth, content_license_url)
if debug:
print('DEBUG: shared item received via c2s')
@ -1543,7 +1543,7 @@ def _updateFederatedSharesCache(session, shared_items_federated_domains: [],
base_dir: str, domainFull: str,
http_prefix: str,
tokensJson: {}, debug: bool,
systemLanguage: str,
system_language: str,
sharesFileType: str) -> None:
"""Updates the cache of federated shares for the instance.
This enables shared items to be available even when other instances
@ -1590,7 +1590,7 @@ def _updateFederatedSharesCache(session, shared_items_federated_domains: [],
if saveJson(catalogJson, catalogFilename):
print('Downloaded shared items catalog for ' + federatedDomainFull)
sharesJson = _dfcToSharesFormat(catalogJson,
base_dir, systemLanguage,
base_dir, system_language,
http_prefix, domainFull)
if sharesJson:
sharesFilename = \
@ -1699,7 +1699,7 @@ def _regenerateSharesToken(base_dir: str, domainFull: str,
def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
domainFull: str, proxy_type: str, debug: bool,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Runs the daemon used to update federated shared items
"""
secondsPerHour = 60 * 60
@ -1746,13 +1746,13 @@ def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
_updateFederatedSharesCache(session,
shared_items_federated_domains,
base_dir, domainFull, http_prefix,
tokensJson, debug, systemLanguage,
tokensJson, debug, system_language,
sharesFileType)
time.sleep(secondsPerHour * 6)
def _dfcToSharesFormat(catalogJson: {},
base_dir: str, systemLanguage: str,
base_dir: str, system_language: str,
http_prefix: str, domainFull: str) -> {}:
"""Converts DFC format into the internal formal used to store shared items.
This simplifies subsequent search and display
@ -1765,7 +1765,7 @@ def _dfcToSharesFormat(catalogJson: {},
productTypesList = getCategoryTypes(base_dir)
for productType in productTypesList:
dfcIds[productType] = \
_loadDfcIds(base_dir, systemLanguage, productType,
_loadDfcIds(base_dir, system_language, productType,
http_prefix, domainFull)
currTime = int(time.time())

View File

@ -178,7 +178,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
skill: str, skillLevelPercent: int,
cached_webfingers: {}, person_cache: {},
debug: bool, project_version: str,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Sets a skill for a person via c2s
"""
if not session:
@ -211,7 +211,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
if debug:
print('DEBUG: skill webfinger failed for ' + handle)
@ -226,7 +226,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
# get the actor inbox for the To handle
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache, project_version,

View File

@ -18,7 +18,7 @@ def instancesGraph(base_dir: str, handles: str,
proxy_type: str,
port: int, http_prefix: str,
debug: bool, project_version: str,
systemLanguage: str, signingPrivateKeyPem: str) -> str:
system_language: str, signing_priv_key_pem: str) -> str:
""" Returns a dot graph of federating instances
based upon a few sample handles.
The handles argument should contain a comma separated list
@ -55,7 +55,7 @@ def instancesGraph(base_dir: str, handles: str,
webfingerHandle(session, handle, http_prefix,
cached_webfingers,
domain, project_version, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
if not wfRequest:
return dotGraphStr + '}\n'
if not isinstance(wfRequest, dict):
@ -65,7 +65,7 @@ def instancesGraph(base_dir: str, handles: str,
originDomain = None
(personUrl, pubKeyId, pubKey, personId, shaedInbox, avatarUrl,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session, wfRequest,
person_cache,
@ -78,8 +78,8 @@ def instancesGraph(base_dir: str, handles: str,
maxAttachments, federationList,
person_cache, debug,
project_version, http_prefix, domain,
wordFrequency, [], systemLanguage,
signingPrivateKeyPem)
wordFrequency, [], system_language,
signing_priv_key_pem)
postDomains.sort()
for fedDomain in postDomains:
dotLineStr = ' "' + domain + '" -> "' + fedDomain + '";\n'

View File

@ -296,7 +296,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
return speakerJson
def _SSMLheader(systemLanguage: str, instanceTitle: str) -> str:
def _SSMLheader(system_language: str, instanceTitle: str) -> str:
"""Returns a header for an SSML document
"""
return '<?xml version="1.0"?>\n' + \
@ -306,7 +306,7 @@ def _SSMLheader(systemLanguage: str, instanceTitle: str) -> str:
' http://www.w3.org/TR/speech-synthesis11/synthesis.xsd"\n' + \
' version="1.1">\n' + \
' <metadata>\n' + \
' <dc:title xml:lang="' + systemLanguage + '">' + \
' <dc:title xml:lang="' + system_language + '">' + \
instanceTitle + ' inbox</dc:title>\n' + \
' </metadata>\n'
@ -350,7 +350,7 @@ def _speakerEndpointSSML(displayName: str, summary: str,
def getSSMLbox(base_dir: str, path: str,
domain: str,
systemLanguage: str,
system_language: str,
instanceTitle: str,
boxName: str) -> str:
"""Returns SSML for the given timeline
@ -373,7 +373,7 @@ def getSSMLbox(base_dir: str, path: str,
speakerJson['say'],
speakerJson['imageDescription'],
speakerJson['detectedLinks'],
systemLanguage,
system_language,
instanceTitle, gender)

154
tests.py
View File

@ -688,7 +688,7 @@ def createServerAlice(path: str, domain: str, port: int,
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
systemLanguage = 'en'
system_language = 'en'
nickname = 'alice'
http_prefix = 'http'
proxy_type = None
@ -741,7 +741,7 @@ def createServerAlice(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!",
@ -755,7 +755,7 @@ def createServerAlice(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"In the gardens of memory, in the palace " +
@ -770,7 +770,7 @@ def createServerAlice(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerAliceRunning
@ -832,7 +832,7 @@ def createServerBob(path: str, domain: str, port: int,
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
systemLanguage = 'en'
system_language = 'en'
nickname = 'bob'
http_prefix = 'http'
proxy_type = None
@ -883,7 +883,7 @@ def createServerBob(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"One of the things I've realised is that " +
@ -898,7 +898,7 @@ def createServerBob(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"Quantum physics is a bit of a passion of mine",
@ -912,7 +912,7 @@ def createServerBob(path: str, domain: str, port: int,
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerBobRunning
@ -1042,7 +1042,7 @@ def createServerGroup(path: str, domain: str, port: int,
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
# systemLanguage = 'en'
# system_language = 'en'
nickname = 'testgroup'
http_prefix = 'http'
proxy_type = None
@ -1114,7 +1114,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
testServerAliceRunning = False
testServerBobRunning = False
systemLanguage = 'en'
system_language = 'en'
http_prefix = 'http'
proxy_type = None
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
@ -1206,9 +1206,9 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
assert len([name for name in os.listdir(outboxPath)
if os.path.isfile(os.path.join(outboxPath, name))]) == 0
low_bandwidth = False
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendPost(signingPrivateKeyPem, __version__,
sendPost(signing_priv_key_pem, __version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
'bob', bobDomain, bobPort, ccUrl, http_prefix,
'Why is a mouse when it spins? ' +
@ -1218,7 +1218,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
attachedImageFilename, mediaType,
attachedImageDescription, city, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, systemLanguage,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, low_bandwidth,
content_license_url,
@ -1284,7 +1284,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
assert 'Why is a mouse when it spins?' in \
receivedJson['object']['content']
assert 'Why is a mouse when it spins?' in \
receivedJson['object']['contentMap'][systemLanguage]
receivedJson['object']['contentMap'][system_language]
assert 'यह एक परीक्षण है' in receivedJson['object']['content']
print('Check that message received from Alice contains an attachment')
assert receivedJson['object']['attachment']
@ -1332,7 +1332,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
'alice', aliceDomain, alicePort, [],
statusNumber, False, bobSendThreads, bobPostLog,
bobPersonCache, bobCachedWebfingers,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(20):
if 'likes' in open(outboxPostFilename).read():
@ -1354,7 +1354,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
statusNumber, '😀',
False, bobSendThreads, bobPostLog,
bobPersonCache, bobCachedWebfingers,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(20):
if 'reactions' in open(outboxPostFilename).read():
@ -1389,7 +1389,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
objectUrl,
False, bobSendThreads, bobPostLog,
bobPersonCache, bobCachedWebfingers,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
announceMessageArrived = False
outboxMessageArrived = False
for i in range(10):
@ -1438,7 +1438,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
testServerAliceRunning = False
testServerBobRunning = False
systemLanguage = 'en'
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
@ -1524,7 +1524,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
aliceCachedWebfingers = {}
alicePostLog = []
bobActor = http_prefix + '://' + bobAddress + '/users/bob'
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendFollowRequest(sessionAlice, aliceDir,
'alice', aliceDomain, alicePort, http_prefix,
@ -1533,7 +1533,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
client_to_server, federationList,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
print('sendResult: ' + str(sendResult))
for t in range(16):
@ -1570,16 +1570,16 @@ def testFollowBetweenServers(base_dir: str) -> None:
isArticle = False
city = 'London, England'
low_bandwidth = False
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendPost(signingPrivateKeyPem, __version__,
sendPost(signing_priv_key_pem, __version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
'bob', bobDomain, bobPort, ccUrl,
http_prefix, 'Alice message', followersOnly, saveToFile,
client_to_server, True,
None, None, None, city, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, systemLanguage,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, low_bandwidth,
content_license_url,
@ -1627,7 +1627,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
testServerAliceRunning = False
testServerBobRunning = False
systemLanguage = 'en'
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
@ -1698,7 +1698,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
assert ctr <= 60
time.sleep(1)
signingPrivateKeyPem = None
signing_priv_key_pem = None
sessionClient = createSession(proxy_type)
# Get Bob's instance actor
@ -1710,7 +1710,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
bobInstanceActorJson = \
getJson(signingPrivateKeyPem, sessionClient,
getJson(signing_priv_key_pem, sessionClient,
'http://' + bobAddress + '/@actor', testHeaders, {}, True,
__version__, 'http', 'somedomain.or.other', 10, True)
assert bobInstanceActorJson
@ -1750,7 +1750,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
client_to_server, federationList,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
print('sendResult: ' + str(sendResult))
for t in range(16):
@ -1808,7 +1808,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
sharedItemDuration = "10 days"
sharedItemPrice = "1.30"
sharedItemCurrency = "EUR"
signingPrivateKeyPem = None
signing_priv_key_pem = None
sessionBob = createSession(proxy_type)
shareJson = \
sendShareViaServer(bobDir, sessionBob,
@ -1821,7 +1821,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
bobCachedWebfingers, bobPersonCache,
True, __version__,
sharedItemPrice, sharedItemCurrency,
signingPrivateKeyPem)
signing_priv_key_pem)
assert shareJson
assert isinstance(shareJson, dict)
sharedItemName = 'Epicyon T-shirt'
@ -1845,7 +1845,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
bobCachedWebfingers, bobPersonCache,
True, __version__,
sharedItemPrice, sharedItemCurrency,
signingPrivateKeyPem)
signing_priv_key_pem)
assert shareJson
assert isinstance(shareJson, dict)
sharedItemName = 'Soldering iron'
@ -1869,7 +1869,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
bobCachedWebfingers, bobPersonCache,
True, __version__,
sharedItemPrice, sharedItemCurrency,
signingPrivateKeyPem)
signing_priv_key_pem)
assert shareJson
assert isinstance(shareJson, dict)
@ -1891,11 +1891,11 @@ def testSharedItemsFederation(base_dir: str) -> None:
print('\n\n*********************************************************')
print('Bob can read the shared items catalog on his own instance')
signingPrivateKeyPem = None
signing_priv_key_pem = None
catalogJson = \
getSharedItemsCatalogViaServer(bobDir, sessionBob, 'bob', bobPassword,
bobDomain, bobPort, http_prefix, True,
signingPrivateKeyPem)
signing_priv_key_pem)
assert catalogJson
pprint(catalogJson)
assert 'DFC:supplies' in catalogJson
@ -1921,16 +1921,16 @@ def testSharedItemsFederation(base_dir: str) -> None:
isArticle = False
city = 'London, England'
low_bandwidth = False
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendPost(signingPrivateKeyPem, __version__,
sendPost(signing_priv_key_pem, __version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
'bob', bobDomain, bobPort, ccUrl,
http_prefix, 'Alice message', followersOnly, saveToFile,
client_to_server, True,
None, None, None, city, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, systemLanguage,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, low_bandwidth,
content_license_url, True,
@ -1987,8 +1987,8 @@ def testSharedItemsFederation(base_dir: str) -> None:
'Accept': 'application/json'
}
url = http_prefix + '://' + bobAddress + '/catalog'
signingPrivateKeyPem = None
catalogJson = getJson(signingPrivateKeyPem, sessionAlice, url, headers,
signing_priv_key_pem = None
catalogJson = getJson(signing_priv_key_pem, sessionAlice, url, headers,
None, True)
assert catalogJson
pprint(catalogJson)
@ -2028,12 +2028,12 @@ def testGroupFollow(base_dir: str) -> None:
global testServerAliceRunning
global testServerBobRunning
global testServerGroupRunning
systemLanguage = 'en'
system_language = 'en'
testServerAliceRunning = False
testServerBobRunning = False
testServerGroupRunning = False
# systemLanguage = 'en'
# system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
@ -2135,8 +2135,8 @@ def testGroupFollow(base_dir: str) -> None:
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
signingPrivateKeyPem = None
outboxJson = getJson(signingPrivateKeyPem, session, aliceOutbox, asHeader,
signing_priv_key_pem = None
outboxJson = getJson(signing_priv_key_pem, session, aliceOutbox, asHeader,
None, True, __version__, 'http', None)
assert outboxJson
pprint(outboxJson)
@ -2147,7 +2147,7 @@ def testGroupFollow(base_dir: str) -> None:
print('Alice outbox totalItems: ' + str(outboxJson['totalItems']))
assert outboxJson['totalItems'] == 3
outboxJson = getJson(signingPrivateKeyPem, session, firstPage, asHeader,
outboxJson = getJson(signing_priv_key_pem, session, firstPage, asHeader,
None, True, __version__, 'http', None)
assert outboxJson
pprint(outboxJson)
@ -2180,7 +2180,7 @@ def testGroupFollow(base_dir: str) -> None:
# aliceActor = http_prefix + '://' + aliceAddress + '/users/alice'
testgroupActor = \
http_prefix + '://' + testgroupAddress + '/users/testgroup'
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendFollowRequest(sessionAlice, aliceDir,
'alice', aliceDomain, alicePort, http_prefix,
@ -2189,7 +2189,7 @@ def testGroupFollow(base_dir: str) -> None:
client_to_server, federationList,
aliceSendThreads, alicePostLog,
aliceCachedWebfingers, alicePersonCache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
print('sendResult: ' + str(sendResult))
aliceFollowingFilename = \
@ -2257,7 +2257,7 @@ def testGroupFollow(base_dir: str) -> None:
# bobActor = http_prefix + '://' + bobAddress + '/users/bob'
testgroupActor = \
http_prefix + '://' + testgroupAddress + '/users/testgroup'
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendFollowRequest(sessionBob, bobDir,
'bob', bobDomain, bobPort, http_prefix,
@ -2266,7 +2266,7 @@ def testGroupFollow(base_dir: str) -> None:
client_to_server, federationList,
bobSendThreads, bobPostLog,
bobCachedWebfingers, bobPersonCache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
print('sendResult: ' + str(sendResult))
bobFollowingFilename = \
@ -2329,7 +2329,7 @@ def testGroupFollow(base_dir: str) -> None:
isArticle = False
city = 'London, England'
low_bandwidth = False
signingPrivateKeyPem = None
signing_priv_key_pem = None
queuePath = \
testgroupDir + '/accounts/testgroup@' + testgroupDomain + '/queue'
@ -2346,14 +2346,14 @@ def testGroupFollow(base_dir: str) -> None:
if os.path.isfile(os.path.join(outboxPath, name))])
sendResult = \
sendPost(signingPrivateKeyPem, __version__,
sendPost(signing_priv_key_pem, __version__,
sessionAlice, aliceDir, 'alice', aliceDomain, alicePort,
'testgroup', testgroupDomain, testgroupPort, ccUrl,
http_prefix, "Alice group message", followersOnly,
saveToFile, client_to_server, True,
None, None, None, city, federationList,
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
alicePersonCache, isArticle, systemLanguage,
alicePersonCache, isArticle, system_language,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, low_bandwidth,
content_license_url,
@ -2669,7 +2669,7 @@ def _testFollows(base_dir: str) -> None:
def _testCreatePerson(base_dir: str):
print('testCreatePerson')
systemLanguage = 'en'
system_language = 'en'
currDir = base_dir
nickname = 'test382'
domain = 'badgerdomain.com'
@ -2717,7 +2717,7 @@ def _testCreatePerson(base_dir: str):
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
os.chdir(currDir)
@ -2785,7 +2785,7 @@ def testClientToServer(base_dir: str):
testServerAliceRunning = False
testServerBobRunning = False
systemLanguage = 'en'
system_language = 'en'
http_prefix = 'http'
proxy_type = None
federationList = []
@ -2886,9 +2886,9 @@ def testClientToServer(base_dir: str):
assert len([name for name in os.listdir(bobOutboxPath)
if os.path.isfile(os.path.join(bobOutboxPath, name))]) == 0
print('EVENT: all inboxes and outboxes are empty')
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendResult = \
sendPostViaServer(signingPrivateKeyPem, __version__,
sendPostViaServer(signing_priv_key_pem, __version__,
aliceDir, sessionAlice, 'alice', password,
aliceDomain, alicePort,
'bob', bobDomain, bobPort, None,
@ -2897,7 +2897,7 @@ def testClientToServer(base_dir: str):
attachedImageFilename, mediaType,
attachedImageDescription, city,
cached_webfingers, person_cache, isArticle,
systemLanguage, low_bandwidth,
system_language, low_bandwidth,
content_license_url,
True, None, None,
conversationId, None)
@ -2954,14 +2954,14 @@ def testClientToServer(base_dir: str):
aliceDomain, alicePort)
print('\n\nAlice follows Bob')
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendFollowRequestViaServer(aliceDir, sessionAlice,
'alice', password,
aliceDomain, alicePort,
'bob', bobDomain, bobPort,
http_prefix,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
alicePetnamesFilename = aliceDir + '/accounts/' + \
'alice@' + aliceDomain + '/petnames.txt'
aliceFollowingFilename = \
@ -3003,7 +3003,7 @@ def testClientToServer(base_dir: str):
'alice', aliceDomain, alicePort,
http_prefix,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for t in range(10):
if os.path.isfile(aliceDir + '/accounts/alice@' + aliceDomain +
'/followers.txt'):
@ -3058,7 +3058,7 @@ def testClientToServer(base_dir: str):
bobDomain, bobPort,
http_prefix, outboxPostId,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(20):
if os.path.isdir(outboxPath) and os.path.isdir(inboxPath):
if len([name for name in os.listdir(outboxPath)
@ -3088,7 +3088,7 @@ def testClientToServer(base_dir: str):
bobDomain, bobPort,
http_prefix, outboxPostId, '😃',
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(20):
if os.path.isdir(outboxPath) and os.path.isdir(inboxPath):
if len([name for name in os.listdir(outboxPath)
@ -3129,13 +3129,13 @@ def testClientToServer(base_dir: str):
showTestBoxes('alice', aliceInboxPath, aliceOutboxPath)
showTestBoxes('bob', bobInboxPath, bobOutboxPath)
print('\n\nEVENT: Bob repeats the post')
signingPrivateKeyPem = None
signing_priv_key_pem = None
sendAnnounceViaServer(bobDir, sessionBob, 'bob', password,
bobDomain, bobPort,
http_prefix, outboxPostId,
cached_webfingers,
person_cache, True, __version__,
signingPrivateKeyPem)
signing_priv_key_pem)
for i in range(20):
if os.path.isdir(outboxPath) and os.path.isdir(inboxPath):
if len([name for name in os.listdir(outboxPath)
@ -3172,7 +3172,7 @@ def testClientToServer(base_dir: str):
aliceDomain, alicePort,
http_prefix, outboxPostId,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for i in range(30):
if os.path.isdir(inboxPath):
test = len([name for name in os.listdir(inboxPath)
@ -3197,7 +3197,7 @@ def testClientToServer(base_dir: str):
'bob', bobDomain, bobPort,
http_prefix,
cached_webfingers, person_cache,
True, __version__, signingPrivateKeyPem)
True, __version__, signing_priv_key_pem)
for t in range(10):
if 'alice@' + aliceDomain + ':' + str(alicePort) not in \
open(bobFollowersFilename).read():
@ -4227,7 +4227,7 @@ def _testGetMentionedPeople(base_dir: str) -> None:
def _testReplyToPublicPost(base_dir: str) -> None:
systemLanguage = 'en'
system_language = 'en'
nickname = 'test7492362'
domain = 'other.site'
port = 443
@ -4262,7 +4262,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
# print(str(reply))
assert reply['object']['content'] == \
@ -4270,7 +4270,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
'<a href=\"https://rat.site/@ninjarodent\" ' + \
'class=\"u-url mention\">@<span>ninjarodent</span>' + \
'</a></span> This is a test.</p>'
reply['object']['contentMap'][systemLanguage] = reply['object']['content']
reply['object']['contentMap'][system_language] = reply['object']['content']
assert reply['object']['tag'][0]['type'] == 'Mention'
assert reply['object']['tag'][0]['name'] == '@ninjarodent@rat.site'
assert reply['object']['tag'][0]['href'] == 'https://rat.site/@ninjarodent'
@ -4772,7 +4772,7 @@ def _testFunctions():
def _testLinksWithinPost(base_dir: str) -> None:
systemLanguage = 'en'
system_language = 'en'
nickname = 'test27636'
domain = 'rando.site'
port = 443
@ -4808,7 +4808,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
assert post_json_object['object']['content'] == \
@ -4823,7 +4823,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
'<span class="invisible">https://</span>' + \
'<span class="ellipsis">libreserver.org</span></a></p>'
assert post_json_object['object']['content'] == \
post_json_object['object']['contentMap'][systemLanguage]
post_json_object['object']['contentMap'][system_language]
content = "<p>Some text</p><p>Other text</p><p>More text</p>" + \
"<pre><code>Errno::EOHNOES (No such file or rodent @ " + \
@ -4845,10 +4845,10 @@ def _testLinksWithinPost(base_dir: str) -> None:
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
assert post_json_object['object']['content'] == content
assert post_json_object['object']['contentMap'][systemLanguage] == content
assert post_json_object['object']['contentMap'][system_language] == content
def _testMastoApi():
@ -5141,14 +5141,14 @@ def testUpdateActor(base_dir: str):
'fnaZ2Wi050483Sj2RmQRpb99Dod7rVZTDtCqXk0J\n' + \
'=gv5G\n' + \
'-----END PGP PUBLIC KEY BLOCK-----'
signingPrivateKeyPem = None
signing_priv_key_pem = None
actorUpdate = \
pgpPublicKeyUpload(aliceDir, sessionAlice,
'alice', password,
aliceDomain, alicePort,
http_prefix,
cached_webfingers, person_cache,
True, pubKey, signingPrivateKeyPem)
True, pubKey, signing_priv_key_pem)
print('actor update result: ' + str(actorUpdate))
assert actorUpdate
@ -5759,7 +5759,7 @@ def _translateOntology(base_dir: str) -> None:
def _testCanReplyTo(base_dir: str) -> None:
print('testCanReplyTo')
systemLanguage = 'en'
system_language = 'en'
nickname = 'test27637'
domain = 'rando.site'
port = 443
@ -5795,7 +5795,7 @@ def _testCanReplyTo(base_dir: str) -> None:
testInReplyTo, testInReplyToAtomUri,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
testIsArticle, system_language, conversationId,
low_bandwidth, content_license_url)
# set the date on the post
currDateStr = "2021-09-08T20:45:00Z"

View File

@ -138,20 +138,20 @@ def getThemesList(base_dir: str) -> []:
def _copyThemeHelpFiles(base_dir: str, themeName: str,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Copies any theme specific help files from the welcome subdirectory
"""
if not systemLanguage:
systemLanguage = 'en'
if not system_language:
system_language = 'en'
themeDir = base_dir + '/theme/' + themeName + '/welcome'
if not os.path.isdir(themeDir):
themeDir = base_dir + '/defaultwelcome'
for subdir, dirs, files in os.walk(themeDir):
for helpMarkdownFile in files:
if not helpMarkdownFile.endswith('_' + systemLanguage + '.md'):
if not helpMarkdownFile.endswith('_' + system_language + '.md'):
continue
destHelpMarkdownFile = \
helpMarkdownFile.replace('_' + systemLanguage + '.md', '.md')
helpMarkdownFile.replace('_' + system_language + '.md', '.md')
if destHelpMarkdownFile == 'profile.md' or \
destHelpMarkdownFile == 'final.md':
destHelpMarkdownFile = 'welcome_' + destHelpMarkdownFile
@ -495,16 +495,16 @@ def _setCustomFont(base_dir: str):
def setThemeFromDesigner(base_dir: str, themeName: str, domain: str,
themeParams: {},
allow_local_network_access: bool,
systemLanguage: str):
system_language: str):
customThemeFilename = base_dir + '/accounts/theme.json'
saveJson(themeParams, customThemeFilename)
setTheme(base_dir, themeName, domain,
allow_local_network_access, systemLanguage)
allow_local_network_access, system_language)
def resetThemeDesignerSettings(base_dir: str, themeName: str, domain: str,
allow_local_network_access: bool,
systemLanguage: str) -> None:
system_language: str) -> None:
"""Resets the theme designer settings
"""
customVariablesFile = base_dir + '/accounts/theme.json'
@ -815,7 +815,7 @@ def _setClearCacheFlag(base_dir: str) -> None:
def setTheme(base_dir: str, name: str, domain: str,
allow_local_network_access: bool, systemLanguage: str) -> bool:
allow_local_network_access: bool, system_language: str) -> bool:
"""Sets the theme with the given name as the current theme
"""
result = False
@ -826,7 +826,7 @@ def setTheme(base_dir: str, name: str, domain: str,
if prevThemeName != name:
resetThemeDesignerSettings(base_dir, name, domain,
allow_local_network_access,
systemLanguage)
system_language)
_removeTheme(base_dir)
@ -876,7 +876,7 @@ def setTheme(base_dir: str, name: str, domain: str,
else:
disableGrayscale(base_dir)
_copyThemeHelpFiles(base_dir, name, systemLanguage)
_copyThemeHelpFiles(base_dir, name, system_language)
_setThemeInConfig(base_dir, name)
_setClearCacheFlag(base_dir)
return result

View File

@ -77,7 +77,7 @@ def getActorLanguagesList(actorJson: {}) -> []:
return []
def getContentFromPost(post_json_object: {}, systemLanguage: str,
def getContentFromPost(post_json_object: {}, system_language: str,
languagesUnderstood: []) -> str:
"""Returns the content from the post in the given language
including searching for a matching entry within contentMap
@ -90,9 +90,10 @@ def getContentFromPost(post_json_object: {}, systemLanguage: str,
content = ''
if thisPostJson.get('contentMap'):
if isinstance(thisPostJson['contentMap'], dict):
if thisPostJson['contentMap'].get(systemLanguage):
if isinstance(thisPostJson['contentMap'][systemLanguage], str):
return thisPostJson['contentMap'][systemLanguage]
if thisPostJson['contentMap'].get(system_language):
sys_lang = thisPostJson['contentMap'][system_language]
if isinstance(sys_lang, str):
return thisPostJson['contentMap'][system_language]
else:
# is there a contentMap entry for one of
# the understood languages?
@ -105,7 +106,7 @@ def getContentFromPost(post_json_object: {}, systemLanguage: str,
return content
def getBaseContentFromPost(post_json_object: {}, systemLanguage: str) -> str:
def getBaseContentFromPost(post_json_object: {}, system_language: str) -> str:
"""Returns the content from the post in the given language
"""
thisPostJson = post_json_object
@ -2675,24 +2676,24 @@ def loadTranslationsFromFile(base_dir: str, language: str) -> ({}, str):
print('ERROR: translations directory not found')
return None, None
if not language:
systemLanguage = locale.getdefaultlocale()[0]
system_language = locale.getdefaultlocale()[0]
else:
systemLanguage = language
if not systemLanguage:
systemLanguage = 'en'
if '_' in systemLanguage:
systemLanguage = systemLanguage.split('_')[0]
while '/' in systemLanguage:
systemLanguage = systemLanguage.split('/')[1]
if '.' in systemLanguage:
systemLanguage = systemLanguage.split('.')[0]
system_language = language
if not system_language:
system_language = 'en'
if '_' in system_language:
system_language = system_language.split('_')[0]
while '/' in system_language:
system_language = system_language.split('/')[1]
if '.' in system_language:
system_language = system_language.split('.')[0]
translationsFile = base_dir + '/translations/' + \
systemLanguage + '.json'
system_language + '.json'
if not os.path.isfile(translationsFile):
systemLanguage = 'en'
system_language = 'en'
translationsFile = base_dir + '/translations/' + \
systemLanguage + '.json'
return loadJson(translationsFile), systemLanguage
system_language + '.json'
return loadJson(translationsFile), system_language
def dmAllowedFromDomain(base_dir: str,

View File

@ -16,7 +16,7 @@ from filters import isFiltered
def convertVideoToNote(base_dir: str, nickname: str, domain: str,
systemLanguage: str,
system_language: str,
post_json_object: {}, blockedCache: {}) -> {}:
"""Converts a PeerTube Video ActivityPub(ish) object into
a Note, so that it can then be displayed in a timeline
@ -54,7 +54,7 @@ def convertVideoToNote(base_dir: str, nickname: str, domain: str,
return None
# get the language of the video
postLanguage = systemLanguage
postLanguage = system_language
if post_json_object.get('language'):
if isinstance(post_json_object['language'], dict):
if post_json_object['language'].get('identifier'):

View File

@ -17,7 +17,7 @@ from markdown import markdownToHtml
def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
domainFull: str, onion_domain: str, translate: {},
systemLanguage: str) -> str:
system_language: str) -> str:
"""Show the about screen
"""
adminNickname = getConfigParam(base_dir, 'admin')
@ -45,7 +45,7 @@ def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
aboutForm = \
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
http_prefix, domainFull,
systemLanguage)
system_language)
aboutForm += '<div class="container">' + aboutText + '</div>'
if onion_domain:
aboutForm += \

View File

@ -643,7 +643,7 @@ def htmlEditNewswire(cssCache: {}, translate: {}, base_dir: str, path: str,
def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
domain: str, port: int,
http_prefix: str, postUrl: str,
systemLanguage: str) -> str:
system_language: str) -> str:
"""Edits a news post on the news/features timeline
"""
if '/users/' not in path:
@ -704,7 +704,7 @@ def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
' <input type="text" name="newsPostTitle" value="' + \
newsPostTitle + '"><br>\n'
newsPostContent = getBaseContentFromPost(post_json_object, systemLanguage)
newsPostContent = getBaseContentFromPost(post_json_object, system_language)
editNewsPostForm += \
' <textarea id="message" name="editedNewsPost" ' + \
'style="height:600px" spellcheck="true">' + \

View File

@ -35,8 +35,8 @@ def htmlConfirmDelete(cssCache: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str,
themeName: str, system_language: str,
max_like_count: int, signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Shows a screen asking to confirm the deletion of a post
"""
@ -65,7 +65,7 @@ def htmlConfirmDelete(cssCache: {},
deletePostStr = \
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
deletePostStr += \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts,
translate, pageNumber,
base_dir, session,
@ -77,7 +77,7 @@ def htmlConfirmDelete(cssCache: {},
twitter_replacement_domain,
show_published_date_only,
peertubeInstances, allow_local_network_access,
themeName, systemLanguage, max_like_count,
themeName, system_language, max_like_count,
False, False, False, False, False, False,
CWlists, lists_enabled)
deletePostStr += '<center>'

View File

@ -207,8 +207,8 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str,
system_language: str,
max_like_count: int, signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str,
boxName: str) -> str:
"""New post screen
@ -259,7 +259,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
translate['this post'] + '</a></p>\n'
if post_json_object:
newPostText += \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -276,7 +276,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
theme, systemLanguage,
theme, system_language,
max_like_count,
False, False, False,
False, False, False,

View File

@ -33,9 +33,9 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str, CWlists: {},
signing_priv_key_pem: str, CWlists: {},
lists_enabled: str) -> str:
"""Shows posts on the front screen of a news instance
These should only be public blog posts from the features timeline
@ -64,7 +64,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
for item in outboxFeed['orderedItems']:
if item['type'] == 'Create':
postStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -79,7 +79,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, False, False,
True, False, False,
@ -93,7 +93,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, max_recent_posts: int,
return profileStr
def htmlFrontScreen(signingPrivateKeyPem: str,
def htmlFrontScreen(signing_priv_key_pem: str,
rss_icon_at_top: bool,
cssCache: {}, icons_as_buttons: bool,
defaultTimeline: str,
@ -109,7 +109,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
peertubeInstances: [],
allow_local_network_access: bool,
accessKeys: {},
systemLanguage: str, max_like_count: int,
system_language: str, max_like_count: int,
shared_items_federated_domains: [],
extraJson: {},
pageNumber: int,
@ -184,9 +184,9 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
theme, systemLanguage,
theme, system_language,
max_like_count,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled) + licenseStr
# Footer which is only used for system accounts

View File

@ -57,7 +57,7 @@ def htmlGetLoginCredentials(loginParams: str,
def htmlLogin(cssCache: {}, translate: {},
base_dir: str,
http_prefix: str, domain: str,
systemLanguage: str,
system_language: str,
autocomplete: bool) -> str:
"""Shows the login screen
"""
@ -153,7 +153,7 @@ def htmlLogin(cssCache: {}, translate: {},
loginForm = \
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
http_prefix, domain,
systemLanguage)
system_language)
nicknamePattern = getNicknameValidationPattern()
instanceTitle = getConfigParam(base_dir, 'instanceTitle')

View File

@ -50,10 +50,10 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
theme: str, peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the moderation feed as html
This is what you see when selecting the "mod" timeline
@ -77,21 +77,21 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, moderationActionStr, theme,
peertubeInstances, allow_local_network_access,
textModeBanner, accessKeys, systemLanguage,
textModeBanner, accessKeys, system_language,
max_like_count, shared_items_federated_domains,
signingPrivateKeyPem, CWlists, lists_enabled)
signing_priv_key_pem, CWlists, lists_enabled)
def htmlAccountInfo(cssCache: {}, translate: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
searchHandle: str, debug: bool,
systemLanguage: str, signingPrivateKeyPem: str) -> str:
system_language: str, signing_priv_key_pem: str) -> str:
"""Shows which domains a search handle interacts with.
This screen is shown if a moderator enters a handle and selects info
on the moderation screen
"""
signingPrivateKeyPem = None
signing_priv_key_pem = None
msgStr1 = 'This account interacts with the following instances'
infoForm = ''
@ -131,12 +131,12 @@ def htmlAccountInfo(cssCache: {}, translate: {},
originDomain,
proxy_type, searchPort,
http_prefix, debug,
__version__, wordFrequency, systemLanguage,
signingPrivateKeyPem)
__version__, wordFrequency, system_language,
signing_priv_key_pem)
# get a list of any blocked followers
followersList = \
downloadFollowCollection(signingPrivateKeyPem,
downloadFollowCollection(signing_priv_key_pem,
'followers', session,
http_prefix, searchActor, 1, 5, debug)
blockedFollowers = []
@ -150,7 +150,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
# get a list of any blocked following
followingList = \
downloadFollowCollection(signingPrivateKeyPem,
downloadFollowCollection(signing_priv_key_pem,
'following', session,
http_prefix, searchActor, 1, 5, debug)
blockedFollowing = []

View File

@ -284,7 +284,7 @@ def _getPostFromRecentCache(session,
pageNumber: int,
recentPostsCache: {},
max_recent_posts: int,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""Attempts to get the html post from the recent posts cache in memory
"""
if boxName == 'tlmedia':
@ -309,7 +309,7 @@ def _getPostFromRecentCache(session,
_logPostTiming(enableTimingLog, postStartTime, '2.1')
updateAvatarImageCache(signingPrivateKeyPem,
updateAvatarImageCache(signing_priv_key_pem,
session, base_dir, http_prefix,
postActor, avatarUrl, person_cache,
allowDownloads)
@ -382,7 +382,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
isPublicRepeat: bool,
showIcons: bool, commentsEnabled: bool,
post_json_object: {}, pageNumberParam: str,
translate: {}, systemLanguage: str,
translate: {}, system_language: str,
conversationId: str) -> str:
"""Returns html for the reply icon/button
"""
@ -409,7 +409,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
if isinstance(post_json_object['object']['attributedTo'], str):
replyToLink += \
'?mention=' + post_json_object['object']['attributedTo']
content = getBaseContentFromPost(post_json_object, systemLanguage)
content = getBaseContentFromPost(post_json_object, system_language)
if content:
mentionedActors = getMentionsFromHtml(content)
if mentionedActors:
@ -1319,7 +1319,7 @@ def _getFooterWithIcons(showIcons: bool,
return footerStr
def individualPostAsHtml(signingPrivateKeyPem: str,
def individualPostAsHtml(signing_priv_key_pem: str,
allowDownloads: bool,
recentPostsCache: {}, max_recent_posts: int,
translate: {},
@ -1336,7 +1336,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
showRepeats: bool,
showIcons: bool,
@ -1404,7 +1404,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
pageNumber,
recentPostsCache,
max_recent_posts,
signingPrivateKeyPem)
signing_priv_key_pem)
if postHtml:
return postHtml
if useCacheOnly and post_json_object['type'] != 'Announce':
@ -1417,7 +1417,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
base_dir, http_prefix,
postActor, person_cache,
avatarUrl, allowDownloads,
signingPrivateKeyPem)
signing_priv_key_pem)
_logPostTiming(enableTimingLog, postStartTime, '5')
@ -1432,14 +1432,14 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
webfingerHandle(session, postActorHandle, http_prefix,
cached_webfingers,
domain, __version__, False, False,
signingPrivateKeyPem)
signing_priv_key_pem)
avatarUrl2 = None
displayName = None
if postActorWf:
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl2,
displayName, _) = getPersonBox(signingPrivateKeyPem,
displayName, _) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session,
postActorWf,
@ -1503,9 +1503,9 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
twitter_replacement_domain,
allow_local_network_access,
recentPostsCache, False,
systemLanguage,
system_language,
domainFull, person_cache,
signingPrivateKeyPem,
signing_priv_key_pem,
blockedCache)
if not postJsonAnnounce:
# if the announce could not be downloaded then mark it as rejected
@ -1532,7 +1532,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
pageNumber,
recentPostsCache,
max_recent_posts,
signingPrivateKeyPem)
signing_priv_key_pem)
if postHtml:
return postHtml
@ -1639,7 +1639,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
publicReply,
showIcons, commentsEnabled,
post_json_object, pageNumberParam,
translate, systemLanguage,
translate, system_language,
conversationId)
_logPostTiming(enableTimingLog, postStartTime, '10')
@ -1845,7 +1845,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
if post_json_object['object'].get('cipherText'):
post_json_object['object']['content'] = \
E2EEdecryptMessageFromDevice(post_json_object['object'])
post_json_object['object']['contentMap'][systemLanguage] = \
post_json_object['object']['contentMap'][system_language] = \
post_json_object['object']['content']
domainFull = getFullDomain(domain, port)
@ -1855,12 +1855,12 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
languagesUnderstood = []
if actorJson:
languagesUnderstood = getActorLanguagesList(actorJson)
contentStr = getContentFromPost(post_json_object, systemLanguage,
contentStr = getContentFromPost(post_json_object, system_language,
languagesUnderstood)
if not contentStr:
contentStr = \
autoTranslatePost(base_dir, post_json_object,
systemLanguage, translate)
system_language, translate)
if not contentStr:
return ''
@ -2004,8 +2004,8 @@ def htmlIndividualPost(cssCache: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str,
themeName: str, system_language: str,
max_like_count: int, signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show an individual post as html
"""
@ -2057,7 +2057,7 @@ def htmlIndividualPost(cssCache: {},
postStr += followStr + '</p>\n'
postStr += \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache, max_recent_posts,
translate, None,
base_dir, session,
@ -2070,7 +2070,7 @@ def htmlIndividualPost(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access, themeName,
systemLanguage, max_like_count,
system_language, max_like_count,
False, authorized, False, False, False, False,
CWlists, lists_enabled)
messageId = removeIdEnding(post_json_object['id'])
@ -2086,7 +2086,7 @@ def htmlIndividualPost(cssCache: {},
post_json_object = loadJson(postFilename)
if post_json_object:
postStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -2101,7 +2101,7 @@ def htmlIndividualPost(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, authorized,
False, False, False, False,
@ -2122,7 +2122,7 @@ def htmlIndividualPost(cssCache: {},
# add items to the html output
for item in repliesJson['orderedItems']:
postStr += \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -2136,7 +2136,7 @@ def htmlIndividualPost(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, authorized,
False, False, False, False,
@ -2164,9 +2164,9 @@ def htmlPostReplies(cssCache: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str, CWlists: {},
signing_priv_key_pem: str, CWlists: {},
lists_enabled: str) -> str:
"""Show the replies to an individual post as html
"""
@ -2174,7 +2174,7 @@ def htmlPostReplies(cssCache: {},
if repliesJson.get('orderedItems'):
for item in repliesJson['orderedItems']:
repliesStr += \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -2188,7 +2188,7 @@ def htmlPostReplies(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, False, False, False, False, False,
CWlists, lists_enabled)
@ -2217,8 +2217,8 @@ def htmlEmojiReactionPicker(cssCache: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str,
themeName: str, system_language: str,
max_like_count: int, signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str,
boxName: str, pageNumber: int) -> str:
"""Returns the emoji picker screen
@ -2226,7 +2226,7 @@ def htmlEmojiReactionPicker(cssCache: {},
reactedToPostStr = \
'<br><center><label class="followText">' + \
translate['Select reaction'].title() + '</label></center>\n' + \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -2240,7 +2240,7 @@ def htmlEmojiReactionPicker(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, False, False, False, False, False,
CWlists, lists_enabled)

View File

@ -137,9 +137,9 @@ def htmlProfileAfterSearch(cssCache: {},
allow_local_network_access: bool,
themeName: str,
accessKeys: {},
systemLanguage: str,
system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show a profile page after a search for a fediverse address
"""
@ -151,7 +151,7 @@ def htmlProfileAfterSearch(cssCache: {},
gnunet = True
profileJson, asHeader = \
getActorJson(domain, profileHandle, http, gnunet, debug, False,
signingPrivateKeyPem, session)
signing_priv_key_pem, session)
if not profileJson:
return None
@ -321,7 +321,7 @@ def htmlProfileAfterSearch(cssCache: {},
'</div>\n'
userFeed = \
parseUserFeed(signingPrivateKeyPem,
parseUserFeed(signing_priv_key_pem,
session, outboxUrl, asHeader, project_version,
http_prefix, domain, debug)
if userFeed:
@ -333,19 +333,22 @@ def htmlProfileAfterSearch(cssCache: {},
continue
profileStr += \
individualPostAsHtml(signingPrivateKeyPem,
True, recentPostsCache, max_recent_posts,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None, base_dir,
session, cached_webfingers, person_cache,
nickname, domain, port,
post_json_object, avatarUrl, False, False,
post_json_object, avatarUrl,
False, False,
http_prefix, project_version, 'inbox',
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage, max_like_count,
themeName, system_language,
max_like_count,
False, False, False, False, False, False,
CWlists, lists_enabled)
i += 1
@ -538,7 +541,7 @@ def _getProfileHeaderAfterSearch(base_dir: str,
return htmlStr
def htmlProfile(signingPrivateKeyPem: str,
def htmlProfile(signing_priv_key_pem: str,
rss_icon_at_top: bool,
cssCache: {}, icons_as_buttons: bool,
defaultTimeline: str,
@ -555,7 +558,7 @@ def htmlProfile(signingPrivateKeyPem: str,
allow_local_network_access: bool,
textModeBanner: str,
debug: bool, accessKeys: {}, city: str,
systemLanguage: str, max_like_count: int,
system_language: str, max_like_count: int,
shared_items_federated_domains: [],
extraJson: {}, pageNumber: int,
maxItemsPerPage: int,
@ -567,7 +570,7 @@ def htmlProfile(signingPrivateKeyPem: str,
if not nickname:
return ""
if isSystemAccount(nickname):
return htmlFrontScreen(signingPrivateKeyPem,
return htmlFrontScreen(signing_priv_key_pem,
rss_icon_at_top,
cssCache, icons_as_buttons,
defaultTimeline,
@ -581,7 +584,7 @@ def htmlProfile(signingPrivateKeyPem: str,
show_published_date_only,
newswire, theme, extraJson,
allow_local_network_access, accessKeys,
systemLanguage, max_like_count,
system_language, max_like_count,
shared_items_federated_domains, None,
pageNumber, maxItemsPerPage, CWlists,
lists_enabled)
@ -963,9 +966,9 @@ def htmlProfile(signingPrivateKeyPem: str,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
theme, systemLanguage,
theme, system_language,
max_like_count,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled) + licenseStr
if not isGroup:
if selected == 'following':
@ -978,7 +981,7 @@ def htmlProfile(signingPrivateKeyPem: str,
project_version, ["unfollow"], selected,
usersPath, pageNumber, maxItemsPerPage,
dormant_months, debug,
signingPrivateKeyPem)
signing_priv_key_pem)
if selected == 'followers':
profileStr += \
_htmlProfileFollowing(translate, base_dir, http_prefix,
@ -989,7 +992,7 @@ def htmlProfile(signingPrivateKeyPem: str,
project_version, ["block"],
selected, usersPath, pageNumber,
maxItemsPerPage, dormant_months, debug,
signingPrivateKeyPem)
signing_priv_key_pem)
if not isGroup:
if selected == 'roles':
profileStr += \
@ -1033,9 +1036,9 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Shows posts on the profile screen
These should only be public posts
@ -1064,7 +1067,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int,
for item in outboxFeed['orderedItems']:
if item['type'] == 'Create':
postStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -1078,7 +1081,7 @@ def _htmlProfilePosts(recentPostsCache: {}, max_recent_posts: int,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage,
themeName, system_language,
max_like_count,
False, False, False,
True, False, False,
@ -1102,7 +1105,7 @@ def _htmlProfileFollowing(translate: {}, base_dir: str, http_prefix: str,
pageNumber: int,
maxItemsPerPage: int,
dormant_months: int, debug: bool,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""Shows following on the profile screen
"""
profileStr = ''
@ -1129,7 +1132,7 @@ def _htmlProfileFollowing(translate: {}, base_dir: str, http_prefix: str,
dormant_months)
profileStr += \
_individualFollowAsHtml(signingPrivateKeyPem,
_individualFollowAsHtml(signing_priv_key_pem,
translate, base_dir, session,
cached_webfingers, person_cache,
domain, followingActor,
@ -2334,7 +2337,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
return editProfileForm
def _individualFollowAsHtml(signingPrivateKeyPem: str,
def _individualFollowAsHtml(signing_priv_key_pem: str,
translate: {},
base_dir: str, session,
cached_webfingers: {},
@ -2366,11 +2369,11 @@ def _individualFollowAsHtml(signingPrivateKeyPem: str,
webfingerHandle(session, followUrlHandle, http_prefix,
cached_webfingers,
domain, __version__, debug, False,
signingPrivateKeyPem)
signing_priv_key_pem)
originDomain = domain
(inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl2,
displayName, isGroup) = getPersonBox(signingPrivateKeyPem,
displayName, isGroup) = getPersonBox(signing_priv_key_pem,
originDomain,
base_dir, session,
followUrlWf,

View File

@ -603,9 +603,9 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, boxName: str,
systemLanguage: str,
system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {},
lists_enabled: str) -> str:
"""Show a page containing search results for your post history
@ -673,7 +673,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
showIndividualPostIcons = True
allow_deletion = False
postStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
True, recentPostsCache,
max_recent_posts,
translate, None,
@ -689,7 +689,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage, max_like_count,
themeName, system_language, max_like_count,
showIndividualPostIcons,
showIndividualPostIcons,
False, False, False, False,
@ -715,9 +715,9 @@ def htmlHashtagSearch(cssCache: {},
show_published_date_only: bool,
peertubeInstances: [],
allow_local_network_access: bool,
themeName: str, systemLanguage: str,
themeName: str, system_language: str,
max_like_count: int,
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show a page containing search results for a hashtag
or after selecting a hashtag from the swarm
@ -855,7 +855,7 @@ def htmlHashtagSearch(cssCache: {},
avatarUrl = None
showAvatarOptions = True
postStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
allowDownloads, recentPostsCache,
max_recent_posts,
translate, None,
@ -872,7 +872,7 @@ def htmlHashtagSearch(cssCache: {},
show_published_date_only,
peertubeInstances,
allow_local_network_access,
themeName, systemLanguage, max_like_count,
themeName, system_language, max_like_count,
showRepeats, showIcons,
manuallyApprovesFollowers,
showPublicOnly,
@ -905,7 +905,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
http_prefix: str, project_version: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
systemLanguage: str) -> str:
system_language: str) -> str:
"""Show an rss feed for a hashtag
"""
if hashtag.startswith('#'):
@ -987,7 +987,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
post_json_object['object']['summary'] + \
'</title>'
description = \
getBaseContentFromPost(post_json_object, systemLanguage)
getBaseContentFromPost(post_json_object, system_language)
description = firstParagraphFromString(description)
hashtagFeed += \
' <description>' + description + '</description>'

View File

@ -445,10 +445,10 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the timeline as html
"""
@ -894,7 +894,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# read the post from disk
currTlStr = \
individualPostAsHtml(signingPrivateKeyPem,
individualPostAsHtml(signing_priv_key_pem,
False, recentPostsCache,
max_recent_posts,
translate, pageNumber,
@ -911,7 +911,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
show_published_date_only,
peertubeInstances,
allow_local_network_access,
theme, systemLanguage,
theme, system_language,
max_like_count,
boxName != 'dm',
showIndividualPostIcons,
@ -1139,10 +1139,10 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the shares timeline as html
"""
@ -1170,9 +1170,9 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
accessKeys, system_language, max_like_count,
shared_items_federated_domains,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled)
@ -1197,10 +1197,10 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the wanted timeline as html
"""
@ -1228,9 +1228,9 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
accessKeys, system_language, max_like_count,
shared_items_federated_domains,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled)
@ -1256,10 +1256,10 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the inbox as html
"""
@ -1287,9 +1287,9 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
accessKeys, system_language, max_like_count,
shared_items_federated_domains,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled)
@ -1315,10 +1315,10 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the bookmarks as html
"""
@ -1346,8 +1346,8 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1373,10 +1373,10 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the DM timeline as html
"""
@ -1399,9 +1399,9 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
accessKeys, system_language, max_like_count,
shared_items_federated_domains,
signingPrivateKeyPem,
signing_priv_key_pem,
CWlists, lists_enabled)
@ -1427,10 +1427,10 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the replies timeline as html
"""
@ -1453,8 +1453,8 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1480,10 +1480,10 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the media timeline as html
"""
@ -1506,8 +1506,8 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1533,10 +1533,10 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the blogs timeline as html
"""
@ -1559,8 +1559,8 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1587,10 +1587,10 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the features timeline as html
"""
@ -1612,8 +1612,8 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1639,10 +1639,10 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the news timeline as html
"""
@ -1664,8 +1664,8 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)
@ -1691,10 +1691,10 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
peertubeInstances: [],
allow_local_network_access: bool,
textModeBanner: str,
accessKeys: {}, systemLanguage: str,
accessKeys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signingPrivateKeyPem: str,
signing_priv_key_pem: str,
CWlists: {}, lists_enabled: str) -> str:
"""Show the Outbox as html
"""
@ -1719,6 +1719,6 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
publish_button_at_top,
authorized, None, theme, peertubeInstances,
allow_local_network_access, textModeBanner,
accessKeys, systemLanguage, max_like_count,
shared_items_federated_domains, signingPrivateKeyPem,
accessKeys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem,
CWlists, lists_enabled)

View File

@ -233,7 +233,7 @@ def setBlogAddress(actorJson: {}, blogAddress: str) -> None:
_setActorPropertyUrl(actorJson, 'Blog', removeHtml(blogAddress))
def updateAvatarImageCache(signingPrivateKeyPem: str,
def updateAvatarImageCache(signing_priv_key_pem: str,
session, base_dir: str, http_prefix: str,
actor: str, avatarUrl: str,
person_cache: {}, allowDownloads: bool,
@ -305,7 +305,7 @@ def updateAvatarImageCache(signingPrivateKeyPem: str,
'Accept': 'application/ld+json; profile="' + prof + '"'
}
personJson = \
getJson(signingPrivateKeyPem, session, actor, sessionHeaders, None,
getJson(signing_priv_key_pem, session, actor, sessionHeaders, None,
debug, __version__, http_prefix, None)
if personJson:
if not personJson.get('id'):
@ -736,7 +736,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
http_prefix: str, domain: str,
systemLanguage: str) -> str:
system_language: str) -> str:
"""html header which includes website markup
https://schema.org/WebSite
"""
@ -753,7 +753,7 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
' "name": "' + instanceTitle + '",\n' + \
' "url": "' + http_prefix + '://' + domain + '",\n' + \
' "license": "' + licenseUrl + '",\n' + \
' "inLanguage": "' + systemLanguage + '",\n' + \
' "inLanguage": "' + system_language + '",\n' + \
' "isAccessibleForFree": true,\n' + \
' "genre": "' + genreUrl + '",\n' + \
' "accessMode": ["textual", "visual"],\n' + \
@ -781,20 +781,20 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
'" property="og:title" />\n' + \
' <meta content="' + http_prefix + '://' + domain + \
'/logo.png" property="og:image" />\n' + \
' <meta content="' + systemLanguage + \
' <meta content="' + system_language + \
'" property="og:locale" />\n' + \
' <meta content="summary_large_image" property="twitter:card" />\n'
htmlStr = \
htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
ogMetadata + websiteMarkup,
systemLanguage)
system_language)
return htmlStr
def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
http_prefix: str, domain: str, nickname: str,
systemLanguage: str,
system_language: str,
published: str, modified: str,
title: str, snippet: str,
translate: {}, url: str,
@ -833,7 +833,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
ogMetadata = \
' <meta property="og:locale" content="' + \
systemLanguage + '" />\n' + \
system_language + '" />\n' + \
' <meta property="og:type" content="article" />\n' + \
' <meta property="og:title" content="' + title + '" />\n' + \
' <meta property="og:url" content="' + url + '" />\n' + \
@ -846,7 +846,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
htmlStr = \
htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
ogMetadata + blogMarkup, systemLanguage)
ogMetadata + blogMarkup, system_language)
return htmlStr
@ -1234,7 +1234,7 @@ def getAvatarImageUrl(session,
base_dir: str, http_prefix: str,
postActor: str, person_cache: {},
avatarUrl: str, allowDownloads: bool,
signingPrivateKeyPem: str) -> str:
signing_priv_key_pem: str) -> str:
"""Returns the avatar image url
"""
# get the avatar image url for the post actor
@ -1243,12 +1243,12 @@ def getAvatarImageUrl(session,
getPersonAvatarUrl(base_dir, postActor, person_cache,
allowDownloads)
avatarUrl = \
updateAvatarImageCache(signingPrivateKeyPem,
updateAvatarImageCache(signing_priv_key_pem,
session, base_dir, http_prefix,
postActor, avatarUrl, person_cache,
allowDownloads)
else:
updateAvatarImageCache(signingPrivateKeyPem,
updateAvatarImageCache(signing_priv_key_pem,
session, base_dir, http_prefix,
postActor, avatarUrl, person_cache,
allowDownloads)

View File

@ -64,7 +64,7 @@ def webfingerHandle(session, handle: str, http_prefix: str,
cached_webfingers: {},
fromDomain: str, project_version: str,
debug: bool, groupAccount: bool,
signingPrivateKeyPem: str) -> {}:
signing_priv_key_pem: str) -> {}:
"""Gets webfinger result for the given ActivityPub handle
"""
if not session:
@ -92,7 +92,7 @@ def webfingerHandle(session, handle: str, http_prefix: str,
}
try:
result = \
getJson(signingPrivateKeyPem, session, url, hdr, par,
getJson(signing_priv_key_pem, session, url, hdr, par,
debug, project_version, http_prefix, fromDomain)
except Exception as ex:
print('ERROR: webfingerHandle ' + str(ex))