Snake case

main
Bob Mottram 2021-12-28 18:13:52 +00:00
parent f75a321f9e
commit f6e842d6b8
9 changed files with 237 additions and 237 deletions

210
daemon.py
View File

@ -49,35 +49,35 @@ from jami import get_jami_address
from jami import set_jami_address
from cwtch import get_cwtch_address
from cwtch import set_cwtch_address
from matrix import getMatrixAddress
from matrix import setMatrixAddress
from donate import getDonationUrl
from donate import setDonationUrl
from donate import getWebsite
from donate import setWebsite
from person import addActorUpdateTimestamp
from person import setPersonNotes
from person import getDefaultPersonContext
from person import getActorUpdateJson
from person import savePersonQrcode
from person import randomizeActorImages
from person import personUpgradeActor
from person import activateAccount
from person import deactivateAccount
from person import registerAccount
from person import personLookup
from matrix import get_matrix_address
from matrix import set_matrix_address
from donate import get_donation_url
from donate import set_donation_url
from donate import get_website
from donate import set_website
from person import add_actor_update_timestamp
from person import set_person_notes
from person import get_default_person_context
from person import get_actor_update_json
from person import save_person_qrcode
from person import randomize_actor_images
from person import person_upgrade_actor
from person import activate_account
from person import deactivate_account
from person import register_account
from person import person_lookup
from person import person_box_json
from person import createSharedInbox
from person import createNewsInbox
from person import suspendAccount
from person import reenableAccount
from person import removeAccount
from person import canRemovePost
from person import personSnooze
from person import personUnsnooze
from posts import getOriginalPostFromAnnounceUrl
from posts import savePostToBox
from posts import getInstanceActorKey
from person import create_shared_inbox
from person import create_news_inbox
from person import suspend_account
from person import reenable_account
from person import remove_account
from person import can_remove_post
from person import person_snooze
from person import person_unsnooze
from posts import get_original_post_from_announce_url
from posts import save_post_to_box
from posts import get_instance_actor_key
from posts import removePostInteractions
from posts import outboxMessageCreateWrap
from posts import getPinnedPostAsJson
@ -1704,9 +1704,9 @@ class PubServer(BaseHTTPRequestHandler):
cookie, calling_domain)
return
if not registerAccount(base_dir, http_prefix, domain, port,
loginNickname, loginPassword,
self.server.manual_follower_approval):
if not register_account(base_dir, http_prefix, domain, port,
loginNickname, loginPassword,
self.server.manual_follower_approval):
self.server.POSTbusy = False
if calling_domain.endswith('.onion') and onion_domain:
self._redirect_headers('http://' + onion_domain +
@ -1763,7 +1763,7 @@ class PubServer(BaseHTTPRequestHandler):
# login success - redirect with authorization
print('Login success: ' + loginNickname)
# re-activate account if needed
activateAccount(base_dir, loginNickname, domain)
activate_account(base_dir, loginNickname, domain)
# This produces a deterministic token based
# on nick+password+salt
saltFilename = \
@ -1798,9 +1798,9 @@ class PubServer(BaseHTTPRequestHandler):
print('EX: Unable to save token for ' +
loginNickname + ' ' + str(ex))
personUpgradeActor(base_dir, None, loginHandle,
base_dir + '/accounts/' +
loginHandle + '.json')
person_upgrade_actor(base_dir, None, loginHandle,
base_dir + '/accounts/' +
loginHandle + '.json')
index = self.server.tokens[loginNickname]
self.server.tokens_lookup[index] = loginNickname
@ -1956,9 +1956,9 @@ class PubServer(BaseHTTPRequestHandler):
if '@' in nickname:
nickname = nickname.split('@')[0]
if moderationButton == 'suspend':
suspendAccount(base_dir, nickname, domain)
suspend_account(base_dir, nickname, domain)
if moderationButton == 'unsuspend':
reenableAccount(base_dir, nickname)
reenable_account(base_dir, nickname)
if moderationButton == 'filter':
addGlobalFilter(base_dir, moderationText)
if moderationButton == 'unfilter':
@ -2003,16 +2003,16 @@ class PubServer(BaseHTTPRequestHandler):
removeGlobalBlock(base_dir, nickname, fullBlockDomain)
if moderationButton == 'remove':
if '/statuses/' not in moderationText:
removeAccount(base_dir, nickname, domain, port)
remove_account(base_dir, nickname, domain, port)
else:
# remove a post or thread
post_filename = \
locate_post(base_dir, nickname, domain,
moderationText)
if post_filename:
if canRemovePost(base_dir,
nickname, domain, port,
moderationText):
if can_remove_post(base_dir,
nickname, domain, port,
moderationText):
delete_post(base_dir,
http_prefix,
nickname, domain,
@ -2026,9 +2026,9 @@ class PubServer(BaseHTTPRequestHandler):
locate_post(base_dir, 'news', domain,
moderationText)
if post_filename:
if canRemovePost(base_dir,
'news', domain, port,
moderationText):
if can_remove_post(base_dir,
'news', domain, port,
moderationText):
delete_post(base_dir,
http_prefix,
'news', domain,
@ -2414,10 +2414,10 @@ class PubServer(BaseHTTPRequestHandler):
handle = optionsNickname + '@' + optionsDomainFull
if not personNotes:
personNotes = ''
setPersonNotes(base_dir,
chooserNickname,
domain,
handle, personNotes)
set_person_notes(base_dir,
chooserNickname,
domain,
handle, personNotes)
usersPathStr = \
usersPath + '/' + self.server.defaultTimeline + \
'?page=' + str(pageNumber)
@ -2781,8 +2781,8 @@ class PubServer(BaseHTTPRequestHandler):
print('Snoozing ' + optionsActor + ' ' + thisActor)
if '/users/' in thisActor:
nickname = thisActor.split('/users/')[1]
personSnooze(base_dir, nickname,
domain, optionsActor)
person_snooze(base_dir, nickname,
domain, optionsActor)
if calling_domain.endswith('.onion') and onion_domain:
thisActor = 'http://' + onion_domain + usersPath
elif (calling_domain.endswith('.i2p') and i2p_domain):
@ -2804,8 +2804,8 @@ class PubServer(BaseHTTPRequestHandler):
print('Unsnoozing ' + optionsActor + ' ' + thisActor)
if '/users/' in thisActor:
nickname = thisActor.split('/users/')[1]
personUnsnooze(base_dir, nickname,
domain, optionsActor)
person_unsnooze(base_dir, nickname,
domain, optionsActor)
if calling_domain.endswith('.onion') and onion_domain:
thisActor = 'http://' + onion_domain + usersPath
elif (calling_domain.endswith('.i2p') and i2p_domain):
@ -5287,15 +5287,15 @@ class PubServer(BaseHTTPRequestHandler):
actorChanged = True
# change matrix address
currentMatrixAddress = getMatrixAddress(actor_json)
currentMatrixAddress = get_matrix_address(actor_json)
if fields.get('matrixAddress'):
if fields['matrixAddress'] != currentMatrixAddress:
setMatrixAddress(actor_json,
fields['matrixAddress'])
set_matrix_address(actor_json,
fields['matrixAddress'])
actorChanged = True
else:
if currentMatrixAddress:
setMatrixAddress(actor_json, '')
set_matrix_address(actor_json, '')
actorChanged = True
# change SSB address
@ -5419,29 +5419,29 @@ class PubServer(BaseHTTPRequestHandler):
actorChanged = True
# change donation link
currentDonateUrl = getDonationUrl(actor_json)
currentDonateUrl = get_donation_url(actor_json)
if fields.get('donateUrl'):
if fields['donateUrl'] != currentDonateUrl:
setDonationUrl(actor_json,
fields['donateUrl'])
set_donation_url(actor_json,
fields['donateUrl'])
actorChanged = True
else:
if currentDonateUrl:
setDonationUrl(actor_json, '')
set_donation_url(actor_json, '')
actorChanged = True
# change website
currentWebsite = \
getWebsite(actor_json, self.server.translate)
get_website(actor_json, self.server.translate)
if fields.get('websiteUrl'):
if fields['websiteUrl'] != currentWebsite:
setWebsite(actor_json,
fields['websiteUrl'],
self.server.translate)
set_website(actor_json,
fields['websiteUrl'],
self.server.translate)
actorChanged = True
else:
if currentWebsite:
setWebsite(actor_json, '', self.server.translate)
set_website(actor_json, '', self.server.translate)
actorChanged = True
# account moved to new address
@ -6475,7 +6475,7 @@ class PubServer(BaseHTTPRequestHandler):
actor_json['@context'] = [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
getDefaultPersonContext()
get_default_person_context()
]
if actor_json.get('nomadicLocations'):
del actor_json['nomadicLocations']
@ -6485,8 +6485,8 @@ class PubServer(BaseHTTPRequestHandler):
if not actor_json.get('featuredTags'):
actor_json['featuredTags'] = \
actor_json['id'] + '/collections/tags'
randomizeActorImages(actor_json)
addActorUpdateTimestamp(actor_json)
randomize_actor_images(actor_json)
add_actor_update_timestamp(actor_json)
# save the actor
save_json(actor_json, actorFilename)
webfinger_update(base_dir,
@ -6509,7 +6509,7 @@ class PubServer(BaseHTTPRequestHandler):
save_json(actor_json, actorCacheFilename)
# send profile update to followers
pubNumber, pubDate = get_status_number()
updateActorJson = getActorUpdateJson(actor_json)
updateActorJson = get_actor_update_json(actor_json)
print('Sending actor update: ' + str(updateActorJson))
self._postToOutbox(updateActorJson,
self.server.project_version,
@ -6518,8 +6518,8 @@ class PubServer(BaseHTTPRequestHandler):
# deactivate the account
if fields.get('deactivateThisAccount'):
if fields['deactivateThisAccount'] == 'on':
deactivateAccount(base_dir,
nickname, domain)
deactivate_account(base_dir,
nickname, domain)
self._clearLoginDetails(nickname,
calling_domain)
self.server.POSTbusy = False
@ -7111,10 +7111,10 @@ class PubServer(BaseHTTPRequestHandler):
if actor_json['type'] == 'Group':
isGroup = True
lockedAccount = get_locked_account(actor_json)
donateUrl = getDonationUrl(actor_json)
websiteUrl = getWebsite(actor_json, self.server.translate)
donateUrl = get_donation_url(actor_json)
websiteUrl = get_website(actor_json, self.server.translate)
xmppAddress = get_xmpp_address(actor_json)
matrixAddress = getMatrixAddress(actor_json)
matrixAddress = get_matrix_address(actor_json)
ssbAddress = get_ssb_address(actor_json)
blogAddress = getBlogAddress(actor_json)
toxAddress = get_tox_address(actor_json)
@ -7707,9 +7707,9 @@ class PubServer(BaseHTTPRequestHandler):
# but the html still needs to be generated before this call ends
announceId = remove_id_ending(announceJson['id'])
announceFilename = \
savePostToBox(base_dir, http_prefix, announceId,
self.postToNickname, domain_full,
announceJson, 'outbox')
save_post_to_box(base_dir, http_prefix, announceId,
self.postToNickname, domain_full,
announceJson, 'outbox')
# clear the icon from the cache so that it gets updated
if self.server.iconsCache.get('repeat.png'):
@ -8140,8 +8140,8 @@ class PubServer(BaseHTTPRequestHandler):
# if this is an announce then send the like to the original post
origActor, origPostUrl, origFilename = \
getOriginalPostFromAnnounceUrl(likeUrl, base_dir,
self.postToNickname, domain)
get_original_post_from_announce_url(likeUrl, base_dir,
self.postToNickname, domain)
likeUrl2 = likeUrl
likedPostFilename = origFilename
if origActor and origPostUrl:
@ -8304,8 +8304,8 @@ class PubServer(BaseHTTPRequestHandler):
# if this is an announce then send the like to the original post
origActor, origPostUrl, origFilename = \
getOriginalPostFromAnnounceUrl(likeUrl, base_dir,
self.postToNickname, domain)
get_original_post_from_announce_url(likeUrl, base_dir,
self.postToNickname, domain)
likeUrl2 = likeUrl
likedPostFilename = origFilename
if origActor and origPostUrl:
@ -8473,8 +8473,8 @@ class PubServer(BaseHTTPRequestHandler):
# if this is an announce then send the emoji reaction
# to the original post
origActor, origPostUrl, origFilename = \
getOriginalPostFromAnnounceUrl(reactionUrl, base_dir,
self.postToNickname, domain)
get_original_post_from_announce_url(reactionUrl, base_dir,
self.postToNickname, domain)
reactionUrl2 = reactionUrl
reactionPostFilename = origFilename
if origActor and origPostUrl:
@ -8657,8 +8657,8 @@ class PubServer(BaseHTTPRequestHandler):
# if this is an announce then send the emoji reaction
# to the original post
origActor, origPostUrl, origFilename = \
getOriginalPostFromAnnounceUrl(reactionUrl, base_dir,
self.postToNickname, domain)
get_original_post_from_announce_url(reactionUrl, base_dir,
self.postToNickname, domain)
reactionUrl2 = reactionUrl
reactionPostFilename = origFilename
if origActor and origPostUrl:
@ -9667,8 +9667,8 @@ class PubServer(BaseHTTPRequestHandler):
if actor_json.get('hasOccupation'):
if self._requestHTTP():
getPerson = \
personLookup(domain, path.replace('/roles', ''),
base_dir)
person_lookup(domain, path.replace('/roles', ''),
base_dir)
if getPerson:
defaultTimeline = \
self.server.defaultTimeline
@ -9771,9 +9771,9 @@ class PubServer(BaseHTTPRequestHandler):
if noOfActorSkills(actor_json) > 0:
if self._requestHTTP():
getPerson = \
personLookup(domain,
path.replace('/skills', ''),
base_dir)
person_lookup(domain,
path.replace('/skills', ''),
base_dir)
if getPerson:
defaultTimeline = \
self.server.defaultTimeline
@ -11820,9 +11820,9 @@ class PubServer(BaseHTTPRequestHandler):
pageNumber = int(pageNumberStr)
searchPath = path.split('?page=')[0]
getPerson = \
personLookup(domain,
searchPath.replace('/' + sharesFileType, ''),
base_dir)
person_lookup(domain,
searchPath.replace('/' + sharesFileType, ''),
base_dir)
if getPerson:
if not self._establishSession("showSharesFeed"):
self._404()
@ -11939,9 +11939,9 @@ class PubServer(BaseHTTPRequestHandler):
pageNumber = int(pageNumberStr)
searchPath = path.split('?page=')[0]
getPerson = \
personLookup(domain,
searchPath.replace('/following', ''),
base_dir)
person_lookup(domain,
searchPath.replace('/following', ''),
base_dir)
if getPerson:
if not self._establishSession("showFollowingFeed"):
self._404()
@ -12058,9 +12058,9 @@ class PubServer(BaseHTTPRequestHandler):
pageNumber = int(pageNumberStr)
searchPath = path.split('?page=')[0]
getPerson = \
personLookup(domain,
searchPath.replace('/followers', ''),
base_dir)
person_lookup(domain,
searchPath.replace('/followers', ''),
base_dir)
if getPerson:
if not self._establishSession("showFollowersFeed"):
self._404()
@ -12196,7 +12196,7 @@ class PubServer(BaseHTTPRequestHandler):
"""Shows the profile for a person
"""
# look up a person
actor_json = personLookup(domain, path, base_dir)
actor_json = person_lookup(domain, path, base_dir)
if not actor_json:
return False
if self._requestHTTP():
@ -12298,7 +12298,7 @@ class PubServer(BaseHTTPRequestHandler):
if self._requestHTTP():
self._404()
return False
actor_json = personLookup(domain, path, base_dir)
actor_json = person_lookup(domain, path, base_dir)
if not actor_json:
print('ERROR: no instance actor found')
self._404()
@ -12521,7 +12521,7 @@ class PubServer(BaseHTTPRequestHandler):
"""Shows a QR code for an account
"""
nickname = get_nickname_from_actor(path)
savePersonQrcode(base_dir, nickname, domain, port)
save_person_qrcode(base_dir, nickname, domain, port)
qrFilename = \
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
if os.path.isfile(qrFilename):
@ -18803,11 +18803,11 @@ def runDaemon(content_license_url: str,
if not os.path.isdir(base_dir + '/accounts/inbox@' + domain):
print('Creating shared inbox: inbox@' + domain)
createSharedInbox(base_dir, 'inbox', domain, port, http_prefix)
create_shared_inbox(base_dir, 'inbox', domain, port, http_prefix)
if not os.path.isdir(base_dir + '/accounts/news@' + domain):
print('Creating news inbox: news@' + domain)
createNewsInbox(base_dir, domain, port, http_prefix)
create_news_inbox(base_dir, domain, port, http_prefix)
set_config_param(base_dir, "lists_enabled", "Murdoch press")
# dict of known web crawlers accessing nodeinfo or the masto API
@ -18994,7 +18994,7 @@ def runDaemon(content_license_url: str,
# signing key used for authorized fetch
# this is the instance actor private key
httpd.signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
httpd.signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
if not unit_test:
print('Creating inbox queue watchdog')

View File

@ -14,11 +14,11 @@ def _getDonationTypes() -> []:
'subscribestar')
def _getWebsiteStrings() -> []:
def _get_websiteStrings() -> []:
return ['www', 'website', 'web', 'homepage']
def getDonationUrl(actor_json: {}) -> str:
def get_donation_url(actor_json: {}) -> str:
"""Returns a link used for donations
"""
if not actor_json.get('attachment'):
@ -43,12 +43,12 @@ def getDonationUrl(actor_json: {}) -> str:
return ''
def getWebsite(actor_json: {}, translate: {}) -> str:
def get_website(actor_json: {}, translate: {}) -> str:
"""Returns a web address link
"""
if not actor_json.get('attachment'):
return ''
matchStrings = _getWebsiteStrings()
matchStrings = _get_websiteStrings()
matchStrings.append(translate['Website'].lower())
for property_value in actor_json['attachment']:
if not property_value.get('name'):
@ -65,7 +65,7 @@ def getWebsite(actor_json: {}, translate: {}) -> str:
return ''
def setDonationUrl(actor_json: {}, donateUrl: str) -> None:
def set_donation_url(actor_json: {}, donateUrl: str) -> None:
"""Sets a link used for donations
"""
notUrl = False
@ -130,7 +130,7 @@ def setDonationUrl(actor_json: {}, donateUrl: str) -> None:
actor_json['attachment'].append(newDonate)
def setWebsite(actor_json: {}, websiteUrl: str, translate: {}) -> None:
def set_website(actor_json: {}, websiteUrl: str, translate: {}) -> None:
"""Sets a web address
"""
websiteUrl = websiteUrl.strip()
@ -147,7 +147,7 @@ def setWebsite(actor_json: {}, websiteUrl: str, translate: {}) -> None:
if not actor_json.get('attachment'):
actor_json['attachment'] = []
matchStrings = _getWebsiteStrings()
matchStrings = _get_websiteStrings()
matchStrings.append(translate['Website'].lower())
# remove any existing value

View File

@ -17,15 +17,15 @@ from person import getActorJson
from person import createPerson
from person import createGroup
from person import setProfileImage
from person import removeAccount
from person import activateAccount
from person import deactivateAccount
from person import remove_account
from person import activate_account
from person import deactivate_account
from skills import setSkillLevel
from roles import setRole
from webfinger import webfingerHandle
from bookmarks import sendBookmarkViaServer
from bookmarks import sendUndoBookmarkViaServer
from posts import getInstanceActorKey
from posts import get_instance_actor_key
from posts import sendMuteViaServer
from posts import sendUndoMuteViaServer
from posts import c2sBoxJson
@ -726,7 +726,7 @@ if args.posts:
proxy_type = 'gnunet'
if not args.language:
args.language = 'en'
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = get_instance_actor_key(base_dir, originDomain)
getPublicPostsOfPerson(base_dir, nickname, domain, False, True,
proxy_type, args.port, http_prefix, debug,
__version__, args.language,
@ -768,7 +768,7 @@ if args.postDomains:
else:
originDomain = args.domain
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = get_instance_actor_key(base_dir, originDomain)
domainList = getPublicPostDomains(None,
base_dir, nickname, domain,
originDomain,
@ -816,7 +816,7 @@ if args.postDomainsBlocked:
args.language = 'en'
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
domainList = getPublicPostDomainsBlocked(None,
base_dir, nickname, domain,
proxy_type, args.port,
@ -861,7 +861,7 @@ if args.checkDomains:
args.language = 'en'
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
checkDomains(None,
base_dir, nickname, domain,
proxy_type, args.port,
@ -889,7 +889,7 @@ if args.socnet:
domain = args.domain
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
dotGraph = instancesGraph(base_dir, args.socnet,
proxy_type, args.port,
http_prefix, debug,
@ -926,7 +926,7 @@ if args.postsraw:
proxy_type = 'gnunet'
if not args.language:
args.language = 'en'
signing_priv_key_pem = getInstanceActorKey(base_dir, originDomain)
signing_priv_key_pem = get_instance_actor_key(base_dir, originDomain)
getPublicPostsOfPerson(base_dir, nickname, domain, False, False,
proxy_type, args.port, http_prefix, debug,
__version__, args.language,
@ -944,7 +944,7 @@ if args.json:
domain = ''
if args.domain:
domain = args.domain
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signing_priv_key_pem:
@ -968,7 +968,7 @@ if args.htmlpost:
domain = ''
if args.domain:
domain = args.domain
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signing_priv_key_pem:
@ -1191,7 +1191,7 @@ if args.approve:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
manualApproveFollowRequest(session, base_dir,
http_prefix,
args.nickname, domain, port,
@ -1219,7 +1219,7 @@ if args.deny:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
manualDenyFollowRequest(session, base_dir,
http_prefix,
args.nickname, domain, port,
@ -1312,7 +1312,7 @@ if args.message:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending post to ' + args.sendto)
sendPostViaServer(signing_priv_key_pem, __version__,
@ -1350,7 +1350,7 @@ if args.announce:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending announce/repeat of ' + args.announce)
sendAnnounceViaServer(base_dir, session, args.nickname, args.password,
@ -1394,7 +1394,7 @@ if args.box:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
session = create_session(proxy_type)
boxJson = c2sBoxJson(base_dir, session,
@ -1455,7 +1455,7 @@ if args.itemName:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending shared item: ' + args.itemName)
sendShareViaServer(base_dir, session,
@ -1498,7 +1498,7 @@ if args.undoItemName:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo of shared item: ' + args.undoItemName)
sendUndoShareViaServer(base_dir, session,
@ -1560,7 +1560,7 @@ if args.wantedItemName:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending wanted item: ' + args.wantedItemName)
sendWantedViaServer(base_dir, session,
@ -1603,7 +1603,7 @@ if args.undoWantedItemName:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo of wanted item: ' + args.undoWantedItemName)
sendUndoWantedViaServer(base_dir, session,
@ -1637,7 +1637,7 @@ if args.like:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending like of ' + args.like)
sendLikeViaServer(base_dir, session,
@ -1676,7 +1676,7 @@ if args.react:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending emoji reaction ' + args.emoji + ' to ' + args.react)
sendReactionViaServer(base_dir, session,
@ -1709,7 +1709,7 @@ if args.undolike:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo like of ' + args.undolike)
sendUndoLikeViaServer(base_dir, session,
@ -1749,7 +1749,7 @@ if args.undoreact:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo emoji reaction ' + args.emoji + ' to ' + args.react)
sendUndoReactionViaServer(base_dir, session,
@ -1783,7 +1783,7 @@ if args.bookmark:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending bookmark of ' + args.bookmark)
sendBookmarkViaServer(base_dir, session,
@ -1817,7 +1817,7 @@ if args.unbookmark:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo bookmark of ' + args.unbookmark)
sendUndoBookmarkViaServer(base_dir, session,
@ -1850,7 +1850,7 @@ if args.delete:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending delete request of ' + args.delete)
sendDeleteViaServer(base_dir, session,
@ -1895,7 +1895,7 @@ if args.follow:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
sendFollowRequestViaServer(base_dir, session,
args.nickname, args.password,
@ -1941,7 +1941,7 @@ if args.unfollow:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
sendUnfollowRequestViaServer(base_dir, session,
args.nickname, args.password,
@ -1976,7 +1976,7 @@ if args.followingList:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
followingJson = \
getFollowingViaServer(base_dir, session,
@ -2009,7 +2009,7 @@ if args.followersList:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
followersJson = \
getFollowersViaServer(base_dir, session,
@ -2043,7 +2043,7 @@ if args.followRequestsList:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
followRequestsJson = \
getFollowRequestsViaServer(base_dir, session,
@ -2095,7 +2095,7 @@ if args.migrations:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
ctr = migrateAccounts(base_dir, session,
http_prefix, cached_webfingers,
True, signing_priv_key_pem)
@ -2108,7 +2108,7 @@ if args.migrations:
if args.actor:
if not domain:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
if debug:
print('base_dir: ' + str(base_dir))
if signing_priv_key_pem:
@ -2197,7 +2197,7 @@ if args.followers:
handle = nickname + '@' + domain
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
wfRequest = webfingerHandle(session, handle,
http_prefix, cached_webfingers,
hostDomain, __version__, debug, False,
@ -2245,7 +2245,7 @@ if args.followers:
}
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
followersList = \
downloadFollowCollection(signing_priv_key_pem,
'followers', session,
@ -2366,13 +2366,13 @@ if args.rmaccount:
sys.exit()
if args.deactivate:
if deactivateAccount(base_dir, nickname, domain):
if deactivate_account(base_dir, nickname, domain):
print('Account for ' + nickname + '@' + domain +
' was deactivated')
else:
print('Account for ' + nickname + '@' + domain + ' was not found')
sys.exit()
if removeAccount(base_dir, nickname, domain, port):
if remove_account(base_dir, nickname, domain, port):
if not args.rmgroup:
print('Account for ' + nickname + '@' + domain + ' was removed')
else:
@ -2388,7 +2388,7 @@ if args.activate:
if not args.domain or not get_config_param(base_dir, 'domain'):
print('Use the --domain option to set the domain name')
sys.exit()
if activateAccount(base_dir, nickname, domain):
if activate_account(base_dir, nickname, domain):
print('Account for ' + nickname + '@' + domain + ' was activated')
else:
print('Deactivated account for ' + nickname + '@' + domain +
@ -2503,7 +2503,7 @@ if args.skill:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending ' + args.skill + ' skill level ' +
str(args.skillLevelPercent) + ' for ' + nickname)
@ -2538,7 +2538,7 @@ if args.availability:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending availability status of ' + nickname +
' as ' + args.availability)
@ -2652,7 +2652,7 @@ if args.block:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending block of ' + args.block)
sendBlockViaServer(base_dir, session, nickname, args.password,
@ -2684,7 +2684,7 @@ if args.mute:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending mute of ' + args.mute)
sendMuteViaServer(base_dir, session, nickname, args.password,
@ -2716,7 +2716,7 @@ if args.unmute:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo mute of ' + args.unmute)
sendUndoMuteViaServer(base_dir, session, nickname, args.password,
@ -2760,7 +2760,7 @@ if args.unblock:
domain = get_config_param(base_dir, 'domain')
signing_priv_key_pem = None
if args.secure_mode:
signing_priv_key_pem = getInstanceActorKey(base_dir, domain)
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
print('Sending undo block of ' + args.unblock)
sendUndoBlockViaServer(base_dir, session, nickname, args.password,

View File

@ -94,7 +94,7 @@ from utils import is_reply
from utils import has_actor
from httpsig import messageContentDigest
from posts import editedPostFilename
from posts import savePostToBox
from posts import save_post_to_box
from posts import isCreateInsideAnnounce
from posts import createDirectMessagePost
from posts import validContentWarning
@ -2665,8 +2665,8 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
# save to the group outbox so that replies will be to the group
# rather than the original sender
savePostToBox(base_dir, http_prefix, None,
nickname, domain, post_json_object, 'outbox')
save_post_to_box(base_dir, http_prefix, None,
nickname, domain, post_json_object, 'outbox')
post_id = remove_id_ending(post_json_object['object']['id'])
if debug:

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Profile Metadata"
def getMatrixAddress(actor_json: {}) -> str:
def get_matrix_address(actor_json: {}) -> str:
"""Returns matrix address for the given actor
"""
if not actor_json.get('attachment'):
@ -36,7 +36,7 @@ def getMatrixAddress(actor_json: {}) -> str:
return ''
def setMatrixAddress(actor_json: {}, matrixAddress: str) -> None:
def set_matrix_address(actor_json: {}, matrixAddress: str) -> None:
"""Sets an matrix address for the given actor
"""
if not actor_json.get('attachment'):

View File

@ -13,7 +13,7 @@ from session import create_session
from auth import createPassword
from posts import isImageMedia
from posts import outboxMessageCreateWrap
from posts import savePostToBox
from posts import save_post_to_box
from posts import sendToFollowersThread
from posts import sendToNamedAddressesThread
from utils import has_object_stringType
@ -359,7 +359,7 @@ def postMessageToOutbox(session, translate: {},
print('DEBUG: No id attribute within POST to outbox')
post_id = None
if debug:
print('DEBUG: savePostToBox')
print('DEBUG: save_post_to_box')
if message_json['type'] != 'Upgrade':
outboxName = 'outbox'
@ -371,11 +371,11 @@ def postMessageToOutbox(session, translate: {},
outboxName = 'tlblogs'
savedFilename = \
savePostToBox(base_dir,
http_prefix,
post_id,
postToNickname, domain_full,
message_json, outboxName)
save_post_to_box(base_dir,
http_prefix,
post_id,
postToNickname, domain_full,
message_json, outboxName)
if not savedFilename:
print('WARN: post not saved to outbox ' + outboxName)
return False

View File

@ -173,7 +173,7 @@ def _accountExists(base_dir: str, nickname: str, domain: str) -> bool:
os.path.isdir(base_dir + '/deactivated/' + nickname + '@' + domain)
def randomizeActorImages(personJson: {}) -> None:
def randomize_actor_images(personJson: {}) -> None:
"""Randomizes the filenames for avatar image and background
This causes other instances to update their cached avatar image
"""
@ -196,7 +196,7 @@ def randomizeActorImages(personJson: {}) -> None:
'/image' + randStr + '.' + existingExtension
def getActorUpdateJson(actor_json: {}) -> {}:
def get_actor_update_json(actor_json: {}) -> {}:
"""Returns the json for an Person Update
"""
pubNumber, _ = get_status_number()
@ -307,7 +307,7 @@ def getActorUpdateJson(actor_json: {}) -> {}:
}
def getDefaultPersonContext() -> str:
def get_default_person_context() -> str:
"""Gets the default actor context
"""
return {
@ -408,7 +408,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
'@context': [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
getDefaultPersonContext()
get_default_person_context()
],
'published': published,
'alsoKnownAs': [],
@ -539,9 +539,9 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
return privateKeyPem, publicKeyPem, newPerson, webfingerEndpoint
def registerAccount(base_dir: str, http_prefix: str, domain: str, port: int,
nickname: str, password: str,
manual_follower_approval: bool) -> bool:
def register_account(base_dir: str, http_prefix: str, domain: str, port: int,
nickname: str, password: str,
manual_follower_approval: bool) -> bool:
"""Registers a new account from the web interface
"""
if _accountExists(base_dir, nickname, domain):
@ -577,9 +577,9 @@ def createGroup(base_dir: str, nickname: str, domain: str, port: int,
return privateKeyPem, publicKeyPem, newPerson, webfingerEndpoint
def savePersonQrcode(base_dir: str,
nickname: str, domain: str, port: int,
scale=6) -> None:
def save_person_qrcode(base_dir: str,
nickname: str, domain: str, port: int,
scale=6) -> None:
"""Saves a qrcode image for the handle of the person
This helps to transfer onion or i2p handles to a mobile device
"""
@ -703,28 +703,28 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
registrationsRemaining -= 1
set_config_param(base_dir, 'registrationsRemaining',
str(registrationsRemaining))
savePersonQrcode(base_dir, nickname, domain, port)
save_person_qrcode(base_dir, nickname, domain, port)
return privateKeyPem, publicKeyPem, newPerson, webfingerEndpoint
def createSharedInbox(base_dir: str, nickname: str, domain: str, port: int,
http_prefix: str) -> (str, str, {}, {}):
def create_shared_inbox(base_dir: str, nickname: str, domain: str, port: int,
http_prefix: str) -> (str, str, {}, {}):
"""Generates the shared inbox
"""
return _createPersonBase(base_dir, nickname, domain, port, http_prefix,
True, True, False, None)
def createNewsInbox(base_dir: str, domain: str, port: int,
http_prefix: str) -> (str, str, {}, {}):
def create_news_inbox(base_dir: str, domain: str, port: int,
http_prefix: str) -> (str, str, {}, {}):
"""Generates the news inbox
"""
return createPerson(base_dir, 'news', domain, port,
http_prefix, True, True, None)
def personUpgradeActor(base_dir: str, personJson: {},
handle: str, filename: str) -> None:
def person_upgrade_actor(base_dir: str, personJson: {},
handle: str, filename: str) -> None:
"""Alter the actor to add any new properties
"""
updateActor = False
@ -837,7 +837,7 @@ def personUpgradeActor(base_dir: str, personJson: {},
personJson['@context'] = [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
getDefaultPersonContext()
get_default_person_context()
],
save_json(personJson, filename)
@ -858,7 +858,7 @@ def personUpgradeActor(base_dir: str, personJson: {},
save_json(personJson, actorCacheFilename)
def personLookup(domain: str, path: str, base_dir: str) -> {}:
def person_lookup(domain: str, path: str, base_dir: str) -> {}:
"""Lookup the person for an given nickname
"""
if path.endswith('#main-key'):
@ -892,7 +892,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
return None
personJson = load_json(filename)
if not isSharedInbox:
personUpgradeActor(base_dir, personJson, handle, filename)
person_upgrade_actor(base_dir, personJson, handle, filename)
# if not personJson:
# personJson={"user": "unknown"}
return personJson
@ -1038,7 +1038,7 @@ def setBio(base_dir: str, nickname: str, domain: str, bio: str) -> bool:
return True
def reenableAccount(base_dir: str, nickname: str) -> None:
def reenable_account(base_dir: str, nickname: str) -> None:
"""Removes an account suspention
"""
suspendedFilename = base_dir + '/accounts/suspended.txt'
@ -1056,7 +1056,7 @@ def reenableAccount(base_dir: str, nickname: str) -> None:
' ' + str(ex))
def suspendAccount(base_dir: str, nickname: str, domain: str) -> None:
def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
"""Suspends the given account
"""
# Don't suspend the admin
@ -1080,13 +1080,13 @@ def suspendAccount(base_dir: str, nickname: str, domain: str) -> None:
try:
os.remove(saltFilename)
except OSError:
print('EX: suspendAccount unable to delete ' + saltFilename)
print('EX: suspend_account unable to delete ' + saltFilename)
tokenFilename = acct_dir(base_dir, nickname, domain) + '/.token'
if os.path.isfile(tokenFilename):
try:
os.remove(tokenFilename)
except OSError:
print('EX: suspendAccount unable to delete ' + tokenFilename)
print('EX: suspend_account unable to delete ' + tokenFilename)
suspendedFilename = base_dir + '/accounts/suspended.txt'
if os.path.isfile(suspendedFilename):
@ -1108,8 +1108,8 @@ def suspendAccount(base_dir: str, nickname: str, domain: str) -> None:
print('EX: unable to write ' + suspendedFilename)
def canRemovePost(base_dir: str, nickname: str,
domain: str, port: int, post_id: str) -> bool:
def can_remove_post(base_dir: str, nickname: str,
domain: str, port: int, post_id: str) -> bool:
"""Returns true if the given post can be removed
"""
if '/statuses/' not in post_id:
@ -1172,8 +1172,8 @@ def _removeTagsForNickname(base_dir: str, nickname: str,
print('EX: unable to write ' + tagFilename)
def removeAccount(base_dir: str, nickname: str,
domain: str, port: int) -> bool:
def remove_account(base_dir: str, nickname: str,
domain: str, port: int) -> bool:
"""Removes an account
"""
# Don't remove the admin
@ -1192,7 +1192,7 @@ def removeAccount(base_dir: str, nickname: str,
if moderator.strip('\n') == nickname:
return False
reenableAccount(base_dir, nickname)
reenable_account(base_dir, nickname)
handle = nickname + '@' + domain
removePassword(base_dir, nickname)
_removeTagsForNickname(base_dir, nickname, domain, port)
@ -1206,25 +1206,25 @@ def removeAccount(base_dir: str, nickname: str,
try:
os.remove(base_dir + '/accounts/' + handle + '.json')
except OSError:
print('EX: removeAccount unable to delete ' +
print('EX: remove_account unable to delete ' +
base_dir + '/accounts/' + handle + '.json')
if os.path.isfile(base_dir + '/wfendpoints/' + handle + '.json'):
try:
os.remove(base_dir + '/wfendpoints/' + handle + '.json')
except OSError:
print('EX: removeAccount unable to delete ' +
print('EX: remove_account unable to delete ' +
base_dir + '/wfendpoints/' + handle + '.json')
if os.path.isfile(base_dir + '/keys/private/' + handle + '.key'):
try:
os.remove(base_dir + '/keys/private/' + handle + '.key')
except OSError:
print('EX: removeAccount unable to delete ' +
print('EX: remove_account unable to delete ' +
base_dir + '/keys/private/' + handle + '.key')
if os.path.isfile(base_dir + '/keys/public/' + handle + '.pem'):
try:
os.remove(base_dir + '/keys/public/' + handle + '.pem')
except OSError:
print('EX: removeAccount unable to delete ' +
print('EX: remove_account unable to delete ' +
base_dir + '/keys/public/' + handle + '.pem')
if os.path.isdir(base_dir + '/sharefiles/' + nickname):
shutil.rmtree(base_dir + '/sharefiles/' + nickname,
@ -1233,7 +1233,7 @@ def removeAccount(base_dir: str, nickname: str,
try:
os.remove(base_dir + '/wfdeactivated/' + handle + '.json')
except OSError:
print('EX: removeAccount unable to delete ' +
print('EX: remove_account unable to delete ' +
base_dir + '/wfdeactivated/' + handle + '.json')
if os.path.isdir(base_dir + '/sharefilesdeactivated/' + nickname):
shutil.rmtree(base_dir + '/sharefilesdeactivated/' + nickname,
@ -1244,7 +1244,7 @@ def removeAccount(base_dir: str, nickname: str,
return True
def deactivateAccount(base_dir: str, nickname: str, domain: str) -> bool:
def deactivate_account(base_dir: str, nickname: str, domain: str) -> bool:
"""Makes an account temporarily unavailable
"""
handle = nickname + '@' + domain
@ -1276,7 +1276,7 @@ def deactivateAccount(base_dir: str, nickname: str, domain: str) -> bool:
return os.path.isdir(deactivatedDir + '/' + nickname + '@' + domain)
def activateAccount(base_dir: str, nickname: str, domain: str) -> None:
def activate_account(base_dir: str, nickname: str, domain: str) -> None:
"""Makes a deactivated account available
"""
handle = nickname + '@' + domain
@ -1345,8 +1345,8 @@ def isPersonSnoozed(base_dir: str, nickname: str, domain: str,
return False
def personSnooze(base_dir: str, nickname: str, domain: str,
snoozeActor: str) -> None:
def person_snooze(base_dir: str, nickname: str, domain: str,
snoozeActor: str) -> None:
"""Temporarily ignores the given actor
"""
accountDir = acct_dir(base_dir, nickname, domain)
@ -1365,8 +1365,8 @@ def personSnooze(base_dir: str, nickname: str, domain: str,
print('EX: unable to append ' + snoozedFilename)
def personUnsnooze(base_dir: str, nickname: str, domain: str,
snoozeActor: str) -> None:
def person_unsnooze(base_dir: str, nickname: str, domain: str,
snoozeActor: str) -> None:
"""Undoes a temporarily ignore of the given actor
"""
accountDir = acct_dir(base_dir, nickname, domain)
@ -1396,8 +1396,8 @@ def personUnsnooze(base_dir: str, nickname: str, domain: str,
print('EX: unable to write ' + snoozedFilename)
def setPersonNotes(base_dir: str, nickname: str, domain: str,
handle: str, notes: str) -> bool:
def set_person_notes(base_dir: str, nickname: str, domain: str,
handle: str, notes: str) -> bool:
"""Adds notes about a person
"""
if '@' not in handle:
@ -1645,7 +1645,7 @@ def getPersonAvatarUrl(base_dir: str, personUrl: str, person_cache: {},
return None
def addActorUpdateTimestamp(actor_json: {}) -> None:
def add_actor_update_timestamp(actor_json: {}) -> None:
"""Adds 'updated' fields with a timestamp
"""
updatedTime = datetime.datetime.utcnow()

View File

@ -152,7 +152,7 @@ def _getLocalPrivateKey(base_dir: str, nickname: str, domain: str) -> str:
return None
def getInstanceActorKey(base_dir: str, domain: str) -> str:
def get_instance_actor_key(base_dir: str, domain: str) -> str:
"""Returns the private key for the instance actor used for
signing GET posts
"""
@ -905,9 +905,9 @@ def deleteAllPosts(base_dir: str,
print('ERROR: deleteAllPosts ' + str(ex))
def savePostToBox(base_dir: str, http_prefix: str, post_id: str,
nickname: str, domain: str, post_json_object: {},
boxname: str) -> str:
def save_post_to_box(base_dir: str, http_prefix: str, post_id: str,
nickname: str, domain: str, post_json_object: {},
boxname: str) -> str:
"""Saves the give json to the give box
Returns the filename
"""
@ -1546,19 +1546,19 @@ def _createPostBase(base_dir: str,
# add an item to the scheduled post index file
_addSchedulePost(base_dir, nickname, domain,
eventDateStr, newPostId)
savePostToBox(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'scheduled')
save_post_to_box(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'scheduled')
else:
print('Unable to create scheduled post without ' +
'date and time values')
return newPost
elif saveToFile:
if isArticle:
savePostToBox(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'tlblogs')
save_post_to_box(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'tlblogs')
else:
savePostToBox(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'outbox')
save_post_to_box(base_dir, http_prefix, newPostId,
nickname, domain, newPost, 'outbox')
return newPost
@ -2094,8 +2094,8 @@ def createDirectMessagePost(base_dir: str,
message_json['object']['cc'] = []
if schedulePost:
post_id = remove_id_ending(message_json['object']['id'])
savePostToBox(base_dir, http_prefix, post_id,
nickname, domain, message_json, 'scheduled')
save_post_to_box(base_dir, http_prefix, post_id,
nickname, domain, message_json, 'scheduled')
return message_json
@ -5265,9 +5265,9 @@ def editedPostFilename(base_dir: str, nickname: str, domain: str,
return lastpost_filename
def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
nickname: str,
domain: str) -> (str, str, str):
def get_original_post_from_announce_url(announceUrl: str, base_dir: str,
nickname: str,
domain: str) -> (str, str, str):
"""From the url of an announce this returns the actor, url and
filename (if available) of the original post being announced
"""

View File

@ -39,10 +39,10 @@ from posts import getPersonBox
from posts import isModerator
from posts import parseUserFeed
from posts import isCreateInsideAnnounce
from donate import getDonationUrl
from donate import getWebsite
from donate import get_donation_url
from donate import get_website
from xmpp import get_xmpp_address
from matrix import getMatrixAddress
from matrix import get_matrix_address
from ssb import get_ssb_address
from pgp import get_email_address
from pgp import get_pgp_fingerprint
@ -632,15 +632,15 @@ def htmlProfile(signing_priv_key_pem: str,
usersPath = '/users/' + actor.split('/users/')[1]
donateSection = ''
donateUrl = getDonationUrl(profile_json)
websiteUrl = getWebsite(profile_json, translate)
donateUrl = get_donation_url(profile_json)
websiteUrl = get_website(profile_json, translate)
blogAddress = getBlogAddress(profile_json)
EnigmaPubKey = get_enigma_pub_key(profile_json)
PGPpubKey = get_pgp_pub_key(profile_json)
PGPfingerprint = get_pgp_fingerprint(profile_json)
emailAddress = get_email_address(profile_json)
xmppAddress = get_xmpp_address(profile_json)
matrixAddress = getMatrixAddress(profile_json)
matrixAddress = get_matrix_address(profile_json)
ssbAddress = get_ssb_address(profile_json)
toxAddress = get_tox_address(profile_json)
briarAddress = get_briar_address(profile_json)
@ -2130,10 +2130,10 @@ def htmlEditProfile(css_cache: {}, translate: {}, base_dir: str, path: str,
if actor_json:
if actor_json.get('movedTo'):
movedTo = actor_json['movedTo']
donateUrl = getDonationUrl(actor_json)
websiteUrl = getWebsite(actor_json, translate)
donateUrl = get_donation_url(actor_json)
websiteUrl = get_website(actor_json, translate)
xmppAddress = get_xmpp_address(actor_json)
matrixAddress = getMatrixAddress(actor_json)
matrixAddress = get_matrix_address(actor_json)
ssbAddress = get_ssb_address(actor_json)
blogAddress = getBlogAddress(actor_json)
toxAddress = get_tox_address(actor_json)