Snake case

main
Bob Mottram 2021-12-27 19:05:25 +00:00
parent 8988485391
commit 7e3e299873
31 changed files with 168 additions and 165 deletions

View File

@ -12,7 +12,7 @@ from utils import has_object_string_object
from utils import has_users_path
from utils import get_full_domain
from utils import urlPermitted
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import domain_permitted
from utils import follow_person
@ -103,7 +103,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
if not nickname:
print('WARN: no nickname found in ' + this_actor)
return
acceptedDomain, acceptedPort = getDomainFromActor(this_actor)
acceptedDomain, acceptedPort = get_domain_from_actor(this_actor)
if not acceptedDomain:
if debug:
print('DEBUG: domain not found in ' + this_actor)
@ -130,7 +130,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
print('DEBUG: unrecognized actor ' + this_actor)
return
followed_actor = message_json['object']['object']
followed_domain, port = getDomainFromActor(followed_actor)
followed_domain, port = get_domain_from_actor(followed_actor)
if not followed_domain:
print('DEBUG: no domain found within Follow activity object ' +
followed_actor)
@ -200,7 +200,7 @@ def receiveAcceptReject(session, base_dir: str,
if debug:
print('DEBUG: "users" or "profile" missing from actor in ' +
message_json['type'] + '. Assuming single user instance.')
domain, _ = getDomainFromActor(message_json['actor'])
domain, _ = get_domain_from_actor(message_json['actor'])
if not domain_permitted(domain, federation_list):
if debug:
print('DEBUG: ' + message_json['type'] +

View File

@ -17,7 +17,7 @@ from utils import get_status_number
from utils import create_outbox_dir
from utils import urlPermitted
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import save_json
from utils import undo_announce_collection_entry
@ -73,7 +73,7 @@ def outboxAnnounce(recent_posts_cache: {},
if not nickname:
print('WARN: no nickname found in ' + message_json['actor'])
return False
domain, _ = getDomainFromActor(message_json['actor'])
domain, _ = get_domain_from_actor(message_json['actor'])
post_filename = locate_post(base_dir, nickname, domain,
message_json['object'])
if post_filename:
@ -92,7 +92,7 @@ def outboxAnnounce(recent_posts_cache: {},
if not nickname:
print('WARN: no nickname found in ' + message_json['actor'])
return False
domain, _ = getDomainFromActor(message_json['actor'])
domain, _ = get_domain_from_actor(message_json['actor'])
post_filename = locate_post(base_dir, nickname, domain,
message_json['object']['object'])
if post_filename:
@ -167,7 +167,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
group_account = False
if has_users_path(objectUrl):
announceNickname = getNicknameFromActor(objectUrl)
announceDomain, announcePort = getDomainFromActor(objectUrl)
announceDomain, announcePort = get_domain_from_actor(objectUrl)
if '/' + str(announceNickname) + '/' in objectUrl:
announceActor = \
objectUrl.split('/' + announceNickname + '/')[0] + \

View File

@ -15,7 +15,7 @@ from session import postJson
from utils import has_object_string
from utils import get_full_domain
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import load_json
from utils import save_json
from utils import acct_dir
@ -70,7 +70,7 @@ def outboxAvailability(base_dir: str, nickname: str, message_json: {},
actorNickname = getNicknameFromActor(message_json['actor'])
if actorNickname != nickname:
return False
domain, port = getDomainFromActor(message_json['actor'])
domain, port = get_domain_from_actor(message_json['actor'])
status = message_json['object'].replace('"', '')
return setAvailability(base_dir, nickname, domain, status)

View File

@ -28,7 +28,7 @@ from utils import remove_id_ending
from utils import is_evil
from utils import locate_post
from utils import evil_incarnate
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import acct_dir
from utils import local_actor_url
@ -452,7 +452,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
if not nicknameBlocked:
print('WARN: unable to find nickname in ' + message_json['object'])
return False
domainBlocked, portBlocked = getDomainFromActor(message_json['object'])
domainBlocked, portBlocked = get_domain_from_actor(message_json['object'])
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
addBlock(base_dir, nickname, domain,
@ -510,7 +510,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
message_json['object']['object'])
return
domainObject = message_json['object']['object']
domainBlocked, portBlocked = getDomainFromActor(domainObject)
domainBlocked, portBlocked = get_domain_from_actor(domainObject)
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
removeBlock(base_dir, nickname, domain,

View File

@ -27,7 +27,7 @@ from utils import get_config_param
from utils import get_full_domain
from utils import get_media_formats
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import load_json
from utils import first_paragraph_from_string
@ -218,7 +218,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
actor = post_json_object['object']['attributedTo']
authorNickname = getNicknameFromActor(actor)
if authorNickname:
authorDomain, authorPort = getDomainFromActor(actor)
authorDomain, authorPort = get_domain_from_actor(actor)
if authorDomain:
# author must be from the given domain
if restrictToDomain and authorDomain != domain:

View File

@ -18,7 +18,7 @@ from utils import remove_id_ending
from utils import remove_post_from_cache
from utils import urlPermitted
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import get_cached_post_filename
from utils import load_json
@ -286,12 +286,13 @@ def bookmark(recent_posts_cache: {},
if actorBookmarked:
acBm = actorBookmarked
bookmarkedPostNickname = getNicknameFromActor(acBm)
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
else:
if has_users_path(objectUrl):
ou = objectUrl
bookmarkedPostNickname = getNicknameFromActor(ou)
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
bookmarkedPostDomain, bookmarkedPostPort = \
get_domain_from_actor(ou)
if bookmarkedPostNickname:
post_filename = locate_post(base_dir, nickname, domain, objectUrl)
@ -350,12 +351,13 @@ def undoBookmark(recent_posts_cache: {},
if actorBookmarked:
acBm = actorBookmarked
bookmarkedPostNickname = getNicknameFromActor(acBm)
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
else:
if has_users_path(objectUrl):
ou = objectUrl
bookmarkedPostNickname = getNicknameFromActor(ou)
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
bookmarkedPostDomain, bookmarkedPostPort = \
get_domain_from_actor(ou)
if bookmarkedPostNickname:
post_filename = locate_post(base_dir, nickname, domain, objectUrl)

View File

@ -294,7 +294,7 @@ from utils import locate_post
from utils import get_cached_post_filename
from utils import remove_post_from_cache
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import get_status_number
from utils import urlPermitted
from utils import load_json
@ -1457,7 +1457,7 @@ class PubServer(BaseHTTPRequestHandler):
return 3
messageDomain, messagePort = \
getDomainFromActor(message_json['actor'])
get_domain_from_actor(message_json['actor'])
self.server.blockedCacheLastUpdated = \
updateBlockedCache(self.server.base_dir,
@ -1885,7 +1885,7 @@ class PubServer(BaseHTTPRequestHandler):
searchNickname = \
getNicknameFromActor(searchHandle)
searchDomain, searchPort = \
getDomainFromActor(searchHandle)
get_domain_from_actor(searchHandle)
searchHandle = \
searchNickname + '@' + searchDomain
if '@' not in searchHandle:
@ -1893,7 +1893,7 @@ class PubServer(BaseHTTPRequestHandler):
searchNickname = \
getNicknameFromActor(searchHandle)
searchDomain, searchPort = \
getDomainFromActor(searchHandle)
get_domain_from_actor(searchHandle)
searchHandle = \
searchNickname + '@' + searchDomain
if '@' not in searchHandle:
@ -1968,7 +1968,7 @@ class PubServer(BaseHTTPRequestHandler):
moderationText.startswith('hyper'):
# https://domain
blockDomain, blockPort = \
getDomainFromActor(moderationText)
get_domain_from_actor(moderationText)
fullBlockDomain = \
get_full_domain(blockDomain, blockPort)
if '@' in moderationText:
@ -1987,7 +1987,7 @@ class PubServer(BaseHTTPRequestHandler):
moderationText.startswith('hyper'):
# https://domain
blockDomain, blockPort = \
getDomainFromActor(moderationText)
get_domain_from_actor(moderationText)
fullBlockDomain = \
get_full_domain(blockDomain, blockPort)
if '@' in moderationText:
@ -2369,7 +2369,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.POSTbusy = False
return
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
optionsDomain, optionsPort = get_domain_from_actor(optionsActor)
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
if chooserNickname == optionsNickname and \
optionsDomain == domain and \
@ -2927,7 +2927,7 @@ class PubServer(BaseHTTPRequestHandler):
followingActor = followingActor.split('&')[0]
followingNickname = getNicknameFromActor(followingActor)
followingDomain, followingPort = \
getDomainFromActor(followingActor)
get_domain_from_actor(followingActor)
followingDomainFull = \
get_full_domain(followingDomain, followingPort)
if followerNickname == followingNickname and \
@ -3025,7 +3025,7 @@ class PubServer(BaseHTTPRequestHandler):
followingActor = followingActor.split('&')[0]
followingNickname = getNicknameFromActor(followingActor)
followingDomain, followingPort = \
getDomainFromActor(followingActor)
get_domain_from_actor(followingActor)
if followerNickname == followingNickname and \
followingDomain == domain and \
followingPort == port:
@ -3125,7 +3125,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.POSTbusy = False
return
blockingDomain, blockingPort = \
getDomainFromActor(blockingActor)
get_domain_from_actor(blockingActor)
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
if blockerNickname == blockingNickname and \
blockingDomain == domain and \
@ -3212,7 +3212,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.POSTbusy = False
return
blockingDomain, blockingPort = \
getDomainFromActor(blockingActor)
get_domain_from_actor(blockingActor)
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
if blockerNickname == blockingNickname and \
blockingDomain == domain and \
@ -3514,7 +3514,7 @@ class PubServer(BaseHTTPRequestHandler):
if not has_users_path(searchStr):
searchNickname = getNicknameFromActor(searchStr)
searchDomain, searchPort = \
getDomainFromActor(searchStr)
get_domain_from_actor(searchStr)
searchDomainFull = \
get_full_domain(searchDomain, searchPort)
actor = \
@ -3874,7 +3874,7 @@ class PubServer(BaseHTTPRequestHandler):
itemID = itemID.split('&')[0]
shareNickname = getNicknameFromActor(shareActor)
if shareNickname:
shareDomain, sharePort = getDomainFromActor(shareActor)
shareDomain, sharePort = get_domain_from_actor(shareActor)
removeSharedItem(base_dir,
shareNickname, shareDomain, itemID,
http_prefix, domain_full, 'shares')
@ -3941,7 +3941,7 @@ class PubServer(BaseHTTPRequestHandler):
itemID = itemID.split('&')[0]
shareNickname = getNicknameFromActor(shareActor)
if shareNickname:
shareDomain, sharePort = getDomainFromActor(shareActor)
shareDomain, sharePort = get_domain_from_actor(shareActor)
removeSharedItem(base_dir,
shareNickname, shareDomain, itemID,
http_prefix, domain_full, 'wanted')
@ -7904,7 +7904,7 @@ class PubServer(BaseHTTPRequestHandler):
followingHandle = path.split('/followapprove=')[1]
if '://' in followingHandle:
handleNickname = getNicknameFromActor(followingHandle)
handleDomain, handlePort = getDomainFromActor(followingHandle)
handleDomain, handlePort = get_domain_from_actor(followingHandle)
followingHandle = \
handleNickname + '@' + \
get_full_domain(handleDomain, handlePort)
@ -8063,7 +8063,7 @@ class PubServer(BaseHTTPRequestHandler):
followingHandle = path.split('/followdeny=')[1]
if '://' in followingHandle:
handleNickname = getNicknameFromActor(followingHandle)
handleDomain, handlePort = getDomainFromActor(followingHandle)
handleDomain, handlePort = get_domain_from_actor(followingHandle)
followingHandle = \
handleNickname + '@' + \
get_full_domain(handleDomain, handlePort)
@ -13265,11 +13265,11 @@ class PubServer(BaseHTTPRequestHandler):
refererDomain = None
if self.headers.get('referer'):
refererDomain, refererPort = \
getDomainFromActor(self.headers['referer'])
get_domain_from_actor(self.headers['referer'])
refererDomain = get_full_domain(refererDomain, refererPort)
elif self.headers.get('Referer'):
refererDomain, refererPort = \
getDomainFromActor(self.headers['Referer'])
get_domain_from_actor(self.headers['Referer'])
refererDomain = get_full_domain(refererDomain, refererPort)
elif self.headers.get('Signature'):
if 'keyId="' in self.headers['Signature']:

View File

@ -15,7 +15,7 @@ from utils import has_users_path
from utils import get_full_domain
from utils import remove_id_ending
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import deletePost
from utils import removeModerationPostFromIndex
@ -153,7 +153,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
print("DEBUG: you can't delete a post which " +
"wasn't created by you (nickname does not match)")
return
deleteDomain, deletePort = getDomainFromActor(messageId)
deleteDomain, deletePort = get_domain_from_actor(messageId)
domain = remove_domain_port(domain)
if deleteDomain != domain:
if debug:

View File

@ -23,7 +23,7 @@ from utils import is_dm
from utils import load_translations_from_file
from utils import remove_html
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import is_pgp_encrypted
from utils import local_actor_url
from session import createSession
@ -143,7 +143,7 @@ def _createDesktopConfig(actor: str) -> None:
if not os.path.isdir(homeDir + '/.config/epicyon'):
os.mkdir(homeDir + '/.config/epicyon')
nickname = getNicknameFromActor(actor)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
handle = nickname + '@' + domain
if port != 443 and port != 80:
handle += '_' + str(port)
@ -158,7 +158,7 @@ def _markPostAsRead(actor: str, post_id: str, postCategory: str) -> None:
homeDir = str(Path.home())
_createDesktopConfig(actor)
nickname = getNicknameFromActor(actor)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
handle = nickname + '@' + domain
if port != 443 and port != 80:
handle += '_' + str(port)
@ -188,7 +188,7 @@ def _hasReadPost(actor: str, post_id: str, postCategory: str) -> bool:
homeDir = str(Path.home())
_createDesktopConfig(actor)
nickname = getNicknameFromActor(actor)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
handle = nickname + '@' + domain
if port != 443 and port != 80:
handle += '_' + str(port)
@ -427,7 +427,7 @@ def _desktopReplyToPost(session, post_id: str,
if '://' not in post_id:
return
toNickname = getNicknameFromActor(post_id)
toDomain, toPort = getDomainFromActor(post_id)
toDomain, toPort = get_domain_from_actor(post_id)
sayStr = 'Replying to ' + toNickname + '@' + toDomain
_sayCommand(sayStr, sayStr,
screenreader, system_language, espeak)
@ -805,7 +805,7 @@ def _desktopShowActor(base_dir: str, actor_json: {}, translate: {},
"""
actor = actor_json['id']
actorNickname = getNicknameFromActor(actor)
actorDomain, actorPort = getDomainFromActor(actor)
actorDomain, actorPort = get_domain_from_actor(actor)
actorDomainFull = get_full_domain(actorDomain, actorPort)
handle = '@' + actorNickname + '@' + actorDomainFull
@ -1018,7 +1018,7 @@ def _desktopShowBox(indent: str,
announcedNickname = \
getNicknameFromActor(post_json_object['object'])
announcedDomain, announcedPort = \
getDomainFromActor(post_json_object['object'])
get_domain_from_actor(post_json_object['object'])
announcedHandle = announcedNickname + '@' + announcedDomain
lineStr = \
indent + str(posStr) + ' | ' + name + ' | ' + \
@ -1175,7 +1175,7 @@ def _desktopNewDMbase(session, toHandle: str,
toPort = port
if '://' in toHandle:
toNickname = getNicknameFromActor(toHandle)
toDomain, toPort = getDomainFromActor(toHandle)
toDomain, toPort = get_domain_from_actor(toHandle)
toHandle = toNickname + '@' + toDomain
else:
if toHandle.startswith('@'):
@ -1282,7 +1282,7 @@ def _desktopShowFollowRequests(followRequestsJson: {}, translate: {}) -> None:
print('')
for item in followRequestsJson['orderedItems']:
handleNickname = getNicknameFromActor(item)
handleDomain, handlePort = getDomainFromActor(item)
handleDomain, handlePort = get_domain_from_actor(item)
handleDomainFull = \
get_full_domain(handleDomain, handlePort)
print(indent + ' 👤 ' +
@ -1308,7 +1308,7 @@ def _desktopShowFollowing(followingJson: {}, translate: {},
print('')
for item in followingJson['orderedItems']:
handleNickname = getNicknameFromActor(item)
handleDomain, handlePort = getDomainFromActor(item)
handleDomain, handlePort = get_domain_from_actor(item)
handleDomainFull = \
get_full_domain(handleDomain, handlePort)
print(indent + ' 👤 ' +
@ -2214,7 +2214,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
if '@' in followHandle or '://' in followHandle:
followNickname = getNicknameFromActor(followHandle)
followDomain, followPort = \
getDomainFromActor(followHandle)
get_domain_from_actor(followHandle)
if followNickname and followDomain:
sayStr = 'Sending follow request to ' + \
followNickname + '@' + followDomain
@ -2250,7 +2250,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
if '@' in followHandle or '://' in followHandle:
followNickname = getNicknameFromActor(followHandle)
followDomain, followPort = \
getDomainFromActor(followHandle)
get_domain_from_actor(followHandle)
if followNickname and followDomain:
sayStr = 'Stop following ' + \
followNickname + '@' + followDomain
@ -2281,7 +2281,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
if '@' in approveHandle or '://' in approveHandle:
approveNickname = getNicknameFromActor(approveHandle)
approveDomain, approvePort = \
getDomainFromActor(approveHandle)
get_domain_from_actor(approveHandle)
if approveNickname and approveDomain:
sayStr = 'Sending approve follow request for ' + \
approveNickname + '@' + approveDomain
@ -2314,7 +2314,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
if '@' in denyHandle or '://' in denyHandle:
denyNickname = getNicknameFromActor(denyHandle)
denyDomain, denyPort = \
getDomainFromActor(denyHandle)
get_domain_from_actor(denyHandle)
if denyNickname and denyDomain:
sayStr = 'Sending deny follow request for ' + \
denyNickname + '@' + denyDomain

View File

@ -71,7 +71,7 @@ from utils import has_users_path
from utils import get_full_domain
from utils import setConfigParam
from utils import get_config_param
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import follow_person
from utils import validNickname
@ -702,7 +702,7 @@ if args.posts:
if '@' not in args.posts:
if '/users/' in args.posts:
postsNickname = getNicknameFromActor(args.posts)
postsDomain, postsPort = getDomainFromActor(args.posts)
postsDomain, postsPort = get_domain_from_actor(args.posts)
args.posts = \
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
else:
@ -736,7 +736,7 @@ if args.postDomains:
if '@' not in args.postDomains:
if '/users/' in args.postDomains:
postsNickname = getNicknameFromActor(args.postDomains)
postsDomain, postsPort = getDomainFromActor(args.postDomains)
postsDomain, postsPort = get_domain_from_actor(args.postDomains)
args.postDomains = \
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
else:
@ -788,7 +788,7 @@ if args.postDomainsBlocked:
if '/users/' in args.postDomainsBlocked:
postsNickname = getNicknameFromActor(args.postDomainsBlocked)
postsDomain, postsPort = \
getDomainFromActor(args.postDomainsBlocked)
get_domain_from_actor(args.postDomainsBlocked)
args.postDomainsBlocked = \
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
else:
@ -834,7 +834,7 @@ if args.checkDomains:
if '@' not in args.checkDomains:
if '/users/' in args.checkDomains:
postsNickname = getNicknameFromActor(args.posts)
postsDomain, postsPort = getDomainFromActor(args.posts)
postsDomain, postsPort = get_domain_from_actor(args.posts)
args.checkDomains = \
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
else:
@ -1882,7 +1882,7 @@ if args.follow:
if not followNickname:
print('Unable to find nickname in ' + args.follow)
sys.exit()
followDomain, followPort = getDomainFromActor(args.follow)
followDomain, followPort = get_domain_from_actor(args.follow)
session = createSession(proxy_type)
person_cache = {}
@ -1928,7 +1928,7 @@ if args.unfollow:
if not followNickname:
print('WARN: unable to find nickname in ' + args.unfollow)
sys.exit()
followDomain, followPort = getDomainFromActor(args.unfollow)
followDomain, followPort = get_domain_from_actor(args.unfollow)
session = createSession(proxy_type)
person_cache = {}

View File

@ -17,7 +17,7 @@ from utils import get_full_domain
from utils import get_followers_list
from utils import validNickname
from utils import domain_permitted
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import get_status_number
from utils import follow_person
@ -182,7 +182,7 @@ def isFollowingActor(base_dir: str,
if not followingNickname:
print('WARN: unable to find nickname in ' + actor)
return False
followingDomain, followingPort = getDomainFromActor(actor)
followingDomain, followingPort = get_domain_from_actor(actor)
followingHandle = \
get_full_domain(followingNickname + '@' + followingDomain,
followingPort)
@ -237,7 +237,7 @@ def getFollowerDomains(base_dir: str, nickname: str, domain: str) -> []:
domainsList = []
for handle in lines:
handle = handle.replace('\n', '')
followerDomain, _ = getDomainFromActor(handle)
followerDomain, _ = get_domain_from_actor(handle)
if not followerDomain:
continue
if followerDomain not in domainsList:
@ -1346,7 +1346,7 @@ def getFollowersOfActor(base_dir: str, actor: str, debug: bool) -> {}:
if debug:
print('DEBUG: no nickname found in ' + actor)
return recipientsDict
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
if not domain:
if debug:
print('DEBUG: no domain found in ' + actor)
@ -1404,7 +1404,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
message_json['object']['actor'])
return
domainFollower, portFollower = \
getDomainFromActor(message_json['object']['actor'])
get_domain_from_actor(message_json['object']['actor'])
domainFollowerFull = get_full_domain(domainFollower, portFollower)
nicknameFollowing = getNicknameFromActor(message_json['object']['object'])
@ -1413,7 +1413,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
message_json['object']['object'])
return
domainFollowing, portFollowing = \
getDomainFromActor(message_json['object']['object'])
get_domain_from_actor(message_json['object']['object'])
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
group_account = \

View File

@ -49,7 +49,7 @@ from utils import remove_post_from_cache
from utils import urlPermitted
from utils import create_inbox_queue_dir
from utils import get_status_number
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import locate_post
from utils import deletePost
@ -480,7 +480,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
if not postNickname:
print('No post Nickname in actor ' + post_json_object['actor'])
return None
postDomain, postPort = getDomainFromActor(post_json_object['actor'])
postDomain, postPort = get_domain_from_actor(post_json_object['actor'])
if not postDomain:
if debug:
pprint(post_json_object)
@ -499,7 +499,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
inReplyTo = \
post_json_object['object']['inReplyTo']
replyDomain, replyPort = \
getDomainFromActor(inReplyTo)
get_domain_from_actor(inReplyTo)
if isBlockedDomain(base_dir, replyDomain, blockedCache):
if debug:
print('WARN: post contains reply from ' +
@ -764,7 +764,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
message_json['object']['actor'])
return False
domainFollower, portFollower = \
getDomainFromActor(message_json['object']['actor'])
get_domain_from_actor(message_json['object']['actor'])
domainFollowerFull = get_full_domain(domainFollower, portFollower)
nicknameFollowing = \
@ -774,7 +774,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
message_json['object']['object'])
return False
domainFollowing, portFollowing = \
getDomainFromActor(message_json['object']['object'])
get_domain_from_actor(message_json['object']['object'])
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
group_account = \
@ -978,7 +978,7 @@ def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
updateNickname = getNicknameFromActor(message_json['actor'])
if updateNickname:
updateDomain, updatePort = \
getDomainFromActor(message_json['actor'])
get_domain_from_actor(message_json['actor'])
if _personReceiveUpdate(base_dir,
domain, port,
updateNickname, updateDomain,
@ -1873,7 +1873,7 @@ def _receiveAnnounce(recent_posts_cache: {},
# is the announce actor blocked?
nickname = handle.split('@')[0]
actorNickname = getNicknameFromActor(message_json['actor'])
actorDomain, actorPort = getDomainFromActor(message_json['actor'])
actorDomain, actorPort = get_domain_from_actor(message_json['actor'])
if isBlocked(base_dir, nickname, domain, actorNickname, actorDomain):
print('Receive announce blocked for actor: ' +
actorNickname + '@' + actorDomain)
@ -1882,7 +1882,7 @@ def _receiveAnnounce(recent_posts_cache: {},
# also check the actor for the url being announced
announcedActorNickname = getNicknameFromActor(message_json['object'])
announcedActorDomain, announcedActorPort = \
getDomainFromActor(message_json['object'])
get_domain_from_actor(message_json['object'])
if isBlocked(base_dir, nickname, domain,
announcedActorNickname, announcedActorDomain):
print('Receive announce object blocked for actor: ' +
@ -2145,7 +2145,7 @@ def populateReplies(base_dir: str, http_prefix: str, domain: str,
if not replyToNickname:
print('DEBUG: no nickname found for ' + replyTo)
return False
replyToDomain, replyToPort = getDomainFromActor(replyTo)
replyToDomain, replyToPort = get_domain_from_actor(replyTo)
if not replyToDomain:
if debug:
print('DEBUG: no domain found for ' + replyTo)
@ -2454,7 +2454,7 @@ def _likeNotify(base_dir: str, domain: str, onion_domain: str,
return
likerNickname = getNicknameFromActor(actor)
likerDomain, likerPort = getDomainFromActor(actor)
likerDomain, likerPort = get_domain_from_actor(actor)
if likerNickname and likerDomain:
likerHandle = likerNickname + '@' + likerDomain
else:
@ -2516,7 +2516,7 @@ def _reactionNotify(base_dir: str, domain: str, onion_domain: str,
return
reactionNickname = getNicknameFromActor(actor)
reactionDomain, reactionPort = getDomainFromActor(actor)
reactionDomain, reactionPort = get_domain_from_actor(actor)
if reactionNickname and reactionDomain:
reactionHandle = reactionNickname + '@' + reactionDomain
else:
@ -2705,7 +2705,7 @@ def _inboxUpdateCalendar(base_dir: str, handle: str,
actor = post_json_object['actor']
actorNickname = getNicknameFromActor(actor)
actorDomain, actorPort = getDomainFromActor(actor)
actorDomain, actorPort = get_domain_from_actor(actor)
handleNickname = handle.split('@')[0]
handleDomain = handle.split('@')[1]
if not receivingCalendarEvents(base_dir,
@ -2922,7 +2922,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
if not sendingActorNickname:
return False
sendingActorDomain, sendingActorPort = \
getDomainFromActor(sendingActor)
get_domain_from_actor(sendingActor)
if not sendingActorDomain:
return False
# Is this DM to yourself? eg. a reminder
@ -3145,7 +3145,7 @@ def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
if not isinstance(attributedTo, str):
return
fromNickname = getNicknameFromActor(attributedTo)
fromDomain, fromPort = getDomainFromActor(attributedTo)
fromDomain, fromPort = get_domain_from_actor(attributedTo)
fromDomainFull = get_full_domain(fromDomain, fromPort)
if notifyWhenPersonPosts(base_dir, nickname, domain,
fromNickname, fromDomainFull):
@ -3173,7 +3173,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
if not isinstance(attributedTo, str):
return 0
fromNickname = getNicknameFromActor(attributedTo)
fromDomain, fromPort = getDomainFromActor(attributedTo)
fromDomain, fromPort = get_domain_from_actor(attributedTo)
fromDomainFull = get_full_domain(fromDomain, fromPort)
if receiveGitPatch(base_dir, nickname, domain,
jsonObj['type'], jsonObj['summary'],
@ -3876,7 +3876,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
if debug:
print('DEBUG: users/profile/accounts/channel missing from actor')
return False
domain, tempPort = getDomainFromActor(message_json['actor'])
domain, tempPort = get_domain_from_actor(message_json['actor'])
fromPort = port
domain_full = get_full_domain(domain, tempPort)
if tempPort:
@ -3899,7 +3899,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
print('DEBUG: users/profile/channel/accounts ' +
'not found within object')
return False
domainToFollow, tempPort = getDomainFromActor(message_json['object'])
domainToFollow, tempPort = get_domain_from_actor(message_json['object'])
if not domain_permitted(domainToFollow, federation_list):
if debug:
print('DEBUG: follow domain not permitted ' + domainToFollow)

View File

@ -19,7 +19,7 @@ from utils import get_full_domain
from utils import remove_id_ending
from utils import urlPermitted
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import undoLikesCollectionEntry
from utils import has_group_type
@ -105,12 +105,12 @@ def _like(recent_posts_cache: {},
group_account = False
if actorLiked:
likedPostNickname = getNicknameFromActor(actorLiked)
likedPostDomain, likedPostPort = getDomainFromActor(actorLiked)
likedPostDomain, likedPostPort = get_domain_from_actor(actorLiked)
group_account = has_group_type(base_dir, actorLiked, person_cache)
else:
if has_users_path(objectUrl):
likedPostNickname = getNicknameFromActor(objectUrl)
likedPostDomain, likedPostPort = getDomainFromActor(objectUrl)
likedPostDomain, likedPostPort = get_domain_from_actor(objectUrl)
if '/' + str(likedPostNickname) + '/' in objectUrl:
actorLiked = \
objectUrl.split('/' + likedPostNickname + '/')[0] + \

View File

@ -10,7 +10,7 @@ __module_group__ = "Core"
import os
from utils import is_account_dir
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import acct_dir
from utils import has_group_type
from webfinger import webfingerHandle
@ -99,7 +99,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
movedToNickname = getNicknameFromActor(movedToUrl)
if not movedToNickname:
return ctr
movedToDomain, movedToPort = getDomainFromActor(movedToUrl)
movedToDomain, movedToPort = get_domain_from_actor(movedToUrl)
if not movedToDomain:
return ctr
movedToDomainFull = movedToDomain

View File

@ -22,7 +22,7 @@ from utils import has_object_dict
from utils import getLocalNetworkAddresses
from utils import get_full_domain
from utils import remove_id_ending
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import dangerousMarkup
from utils import is_featured_writer
from utils import load_json
@ -279,7 +279,7 @@ def postMessageToOutbox(session, translate: {},
if localNetworkPattern in message_json['actor']:
return False
testDomain, testPort = getDomainFromActor(message_json['actor'])
testDomain, testPort = get_domain_from_actor(message_json['actor'])
testDomain = get_full_domain(testDomain, testPort)
if isBlockedDomain(base_dir, testDomain):
if debug:

View File

@ -55,7 +55,7 @@ from utils import get_status_number
from utils import createPersonDir
from utils import urlPermitted
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import deletePost
from utils import validNickname
from utils import locate_post
@ -790,7 +790,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
if item['object'].get('inReplyTo'):
if isinstance(item['object']['inReplyTo'], str):
postDomain, postPort = \
getDomainFromActor(item['object']['inReplyTo'])
get_domain_from_actor(item['object']['inReplyTo'])
if postDomain not in postDomains:
postDomains.append(postDomain)
@ -802,7 +802,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
if tagType == 'mention':
if tagItem.get('href'):
postDomain, postPort = \
getDomainFromActor(tagItem['href'])
get_domain_from_actor(tagItem['href'])
if postDomain not in postDomains:
postDomains.append(postDomain)
return postDomains
@ -852,7 +852,7 @@ def _getPostsForBlockedDomains(base_dir: str,
if item['object'].get('inReplyTo'):
if isinstance(item['object']['inReplyTo'], str):
postDomain, postPort = \
getDomainFromActor(item['object']['inReplyTo'])
get_domain_from_actor(item['object']['inReplyTo'])
if isBlockedDomain(base_dir, postDomain):
if item['object'].get('url'):
url = item['object']['url']
@ -871,7 +871,7 @@ def _getPostsForBlockedDomains(base_dir: str,
tagType = tagItem['type'].lower()
if tagType == 'mention' and tagItem.get('href'):
postDomain, postPort = \
getDomainFromActor(tagItem['href'])
get_domain_from_actor(tagItem['href'])
if isBlockedDomain(base_dir, postDomain):
if item['object'].get('url'):
url = item['object']['url']
@ -2955,7 +2955,7 @@ def _sendToNamedAddresses(session, base_dir: str,
toNickname = getNicknameFromActor(address)
if not toNickname:
continue
toDomain, toPort = getDomainFromActor(address)
toDomain, toPort = get_domain_from_actor(address)
if not toDomain:
continue
# Don't send profile/actor updates to yourself
@ -4571,7 +4571,8 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
'Accept': acceptStr
}
actorNickname = getNicknameFromActor(post_json_object['actor'])
actorDomain, actorPort = getDomainFromActor(post_json_object['actor'])
actorDomain, actorPort = \
get_domain_from_actor(post_json_object['actor'])
if not actorDomain:
print('Announce actor does not contain a ' +
'valid domain or port number: ' +
@ -4583,7 +4584,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
return None
objectNickname = getNicknameFromActor(post_json_object['object'])
objectDomain, objectPort = \
getDomainFromActor(post_json_object['object'])
get_domain_from_actor(post_json_object['object'])
if not objectDomain:
print('Announce object does not contain a ' +
'valid domain or port number: ' +
@ -4725,7 +4726,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
attributedNickname = \
getNicknameFromActor(announcedJson['object']['id'])
attributedDomain, attributedPort = \
getDomainFromActor(announcedJson['object']['id'])
get_domain_from_actor(announcedJson['object']['id'])
if attributedNickname and attributedDomain:
attributedDomain = \
get_full_domain(attributedDomain, attributedPort)
@ -5305,7 +5306,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
if has_users_path(origPostId):
# get the actor from the original post url
origNick = getNicknameFromActor(origPostId)
origDomain, origPort = getDomainFromActor(origPostId)
origDomain, origPort = get_domain_from_actor(origPostId)
if origNick and origDomain:
actor = \
origPostId.split('/' + origNick + '/')[0] + \

View File

@ -21,7 +21,7 @@ from utils import get_full_domain
from utils import remove_id_ending
from utils import urlPermitted
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import undoReactionCollectionEntry
from utils import has_group_type
@ -103,13 +103,13 @@ def _reaction(recent_posts_cache: {},
if actorReaction:
reactionPostNickname = getNicknameFromActor(actorReaction)
reactionPostDomain, reactionPostPort = \
getDomainFromActor(actorReaction)
get_domain_from_actor(actorReaction)
group_account = has_group_type(base_dir, actorReaction, person_cache)
else:
if has_users_path(objectUrl):
reactionPostNickname = getNicknameFromActor(objectUrl)
reactionPostDomain, reactionPostPort = \
getDomainFromActor(objectUrl)
get_domain_from_actor(objectUrl)
if '/' + str(reactionPostNickname) + '/' in objectUrl:
actorReaction = \
objectUrl.split('/' + reactionPostNickname + '/')[0] + \
@ -534,7 +534,7 @@ def htmlEmojiReactions(post_json_object: {}, interactive: bool,
emojiContent = item['content']
emojiActor = item['actor']
emojiNickname = getNicknameFromActor(emojiActor)
emojiDomain, _ = getDomainFromActor(emojiActor)
emojiDomain, _ = get_domain_from_actor(emojiActor)
emojiHandle = emojiNickname + '@' + emojiDomain
if emojiActor == actor:
if emojiContent not in reactedToByThisActor:

View File

@ -15,7 +15,7 @@ from session import postJson
from utils import has_object_string
from utils import get_full_domain
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import load_json
from utils import get_occupation_skills
from utils import set_occupation_skills_list
@ -160,7 +160,7 @@ def outboxSkills(base_dir: str, nickname: str, message_json: {},
actorNickname = getNicknameFromActor(message_json['actor'])
if actorNickname != nickname:
return False
domain, port = getDomainFromActor(message_json['actor'])
domain, port = get_domain_from_actor(message_json['actor'])
skill = message_json['object'].replace('"', '').split(';')[0].strip()
skillLevelPercentStr = \
message_json['object'].replace('"', '').split(';')[1].strip()

View File

@ -15,7 +15,7 @@ from utils import remove_id_ending
from utils import is_dm
from utils import is_reply
from utils import camel_case_split
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import getGenderFromBio
from utils import getDisplayName
@ -480,7 +480,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
person_cache, translate)
if announcingActor:
announcedNickname = getNicknameFromActor(announcingActor)
announcedDomain, announcedport = getDomainFromActor(announcingActor)
announcedDomain, announcedport = get_domain_from_actor(announcingActor)
if announcedNickname and announcedDomain:
announcedHandle = announcedNickname + '@' + announcedDomain
sayContent = \

View File

@ -76,7 +76,7 @@ from utils import remove_id_ending
from utils import updateRecentPostsCache
from utils import follow_person
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import copytree
from utils import load_json
from utils import save_json
@ -3236,44 +3236,44 @@ def testClientToServer(base_dir: str):
def _testActorParsing():
print('testActorParsing')
actor = 'https://mydomain:72/users/mynick'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'mydomain'
assert port == 72
nickname = getNicknameFromActor(actor)
assert nickname == 'mynick'
actor = 'https://element/accounts/badger'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'element'
nickname = getNicknameFromActor(actor)
assert nickname == 'badger'
actor = 'egg@chicken.com'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'chicken.com'
nickname = getNicknameFromActor(actor)
assert nickname == 'egg'
actor = '@waffle@cardboard'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'cardboard'
nickname = getNicknameFromActor(actor)
assert nickname == 'waffle'
actor = 'https://astral/channel/sky'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'astral'
nickname = getNicknameFromActor(actor)
assert nickname == 'sky'
actor = 'https://randomain/users/rando'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'randomain'
nickname = getNicknameFromActor(actor)
assert nickname == 'rando'
actor = 'https://otherdomain:49/@othernick'
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
assert domain == 'otherdomain'
assert port == 49
nickname = getNicknameFromActor(actor)

View File

@ -1068,7 +1068,7 @@ def get_group_paths() -> []:
return ['/c/', '/video-channels/']
def getDomainFromActor(actor: str) -> (str, int):
def get_domain_from_actor(actor: str) -> (str, int):
"""Returns the domain name from an actor url
"""
if actor.startswith('@'):

View File

@ -9,7 +9,7 @@ __module_group__ = "Timeline"
from utils import get_full_domain
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import remove_id_ending
from blocking import isBlocked
from filters import isFiltered
@ -64,7 +64,7 @@ def convertVideoToNote(base_dir: str, nickname: str, domain: str,
postNickname = getNicknameFromActor(attributedTo)
if not postNickname:
return None
postDomain, postDomainPort = getDomainFromActor(attributedTo)
postDomain, postDomainPort = get_domain_from_actor(attributedTo)
if not postDomain:
return None
postDomainFull = get_full_domain(postDomain, postDomainPort)

View File

@ -13,7 +13,7 @@ from datetime import date
from utils import getDisplayName
from utils import get_config_param
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import load_json
from utils import week_day_of_month_start
@ -40,7 +40,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
"""
nickname = getNicknameFromActor(path)
actor = local_actor_url(http_prefix, nickname, domain_full)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
messageId = actor + '/statuses/' + post_id
post_filename = locate_post(base_dir, nickname, domain, messageId)

View File

@ -11,7 +11,7 @@ import os
from shutil import copyfile
from utils import get_full_domain
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import locate_post
from utils import load_json
from utils import get_config_param
@ -44,7 +44,7 @@ def htmlConfirmDelete(cssCache: {},
return None
actor = messageId.split('/statuses/')[0]
nickname = getNicknameFromActor(actor)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
domain_full = get_full_domain(domain, port)
post_filename = locate_post(base_dir, nickname, domain, messageId)
@ -113,7 +113,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
"""Shows a screen asking to confirm the removal of a shared item
"""
nickname = getNicknameFromActor(actor)
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
domain_full = get_full_domain(domain, port)
sharesFile = \
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
@ -180,7 +180,7 @@ def htmlConfirmFollow(cssCache: {}, translate: {}, base_dir: str,
followProfileUrl: str) -> str:
"""Asks to confirm a follow
"""
followDomain, port = getDomainFromActor(followActor)
followDomain, port = get_domain_from_actor(followActor)
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
@ -225,7 +225,7 @@ def htmlConfirmUnfollow(cssCache: {}, translate: {}, base_dir: str,
followProfileUrl: str) -> str:
"""Asks to confirm unfollowing an actor
"""
followDomain, port = getDomainFromActor(followActor)
followDomain, port = get_domain_from_actor(followActor)
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
@ -271,7 +271,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, base_dir: str,
blockProfileUrl: str) -> str:
"""Asks to confirm unblocking an actor
"""
blockDomain, port = getDomainFromActor(blockActor)
blockDomain, port = get_domain_from_actor(blockActor)
setCustomBackground(base_dir, 'block-background', 'follow-background')

View File

@ -11,7 +11,7 @@ import os
from utils import get_new_post_endpoints
from utils import isPublicPostFromUrl
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import get_media_formats
from utils import get_config_param
from utils import acct_dir
@ -654,7 +654,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
mentionNickname = getNicknameFromActor(m)
if not mentionNickname:
continue
mentionDomain, mentionPort = getDomainFromActor(m)
mentionDomain, mentionPort = get_domain_from_actor(m)
if not mentionDomain:
continue
if mentionPort:

View File

@ -9,7 +9,7 @@ __module_group__ = "Timeline"
import os
from utils import is_system_account
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import get_config_param
from person import personBoxJson
from webapp_utils import htmlHeaderWithExternalStyle
@ -122,7 +122,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
return ""
if not is_system_account(nickname):
return ""
domain, port = getDomainFromActor(profile_json['id'])
domain, port = get_domain_from_actor(profile_json['id'])
if not domain:
return ""
domain_full = domain

View File

@ -14,7 +14,7 @@ from utils import get_full_domain
from utils import is_editor
from utils import load_json
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import get_config_param
from utils import local_actor_url
from posts import downloadFollowCollection
@ -104,7 +104,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
searchNickname = getNicknameFromActor(searchHandle)
searchDomain, searchPort = getDomainFromActor(searchHandle)
searchDomain, searchPort = get_domain_from_actor(searchHandle)
searchHandle = searchNickname + '@' + searchDomain
searchActor = \
@ -142,7 +142,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
blockedFollowers = []
for followerActor in followersList:
followerNickname = getNicknameFromActor(followerActor)
followerDomain, followerPort = getDomainFromActor(followerActor)
followerDomain, followerPort = get_domain_from_actor(followerActor)
followerDomainFull = get_full_domain(followerDomain, followerPort)
if isBlocked(base_dir, nickname, domain,
followerNickname, followerDomainFull):
@ -156,7 +156,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
blockedFollowing = []
for followingActor in followingList:
followingNickname = getNicknameFromActor(followingActor)
followingDomain, followingPort = getDomainFromActor(followingActor)
followingDomain, followingPort = get_domain_from_actor(followingActor)
followingDomainFull = get_full_domain(followingDomain, followingPort)
if isBlocked(base_dir, nickname, domain,
followingNickname, followingDomainFull):
@ -217,7 +217,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
':</p>\n'
for actor in blockedFollowing:
followingNickname = getNicknameFromActor(actor)
followingDomain, followingPort = getDomainFromActor(actor)
followingDomain, followingPort = get_domain_from_actor(actor)
followingDomainFull = \
get_full_domain(followingDomain, followingPort)
infoForm += '<a href="' + actor + '" ' + \
@ -236,7 +236,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
':</p>\n'
for actor in blockedFollowers:
followerNickname = getNicknameFromActor(actor)
followerDomain, followerPort = getDomainFromActor(actor)
followerDomain, followerPort = get_domain_from_actor(actor)
followerDomainFull = get_full_domain(followerDomain, followerPort)
infoForm += '<a href="' + actor + '" ' + \
'target="_blank" rel="nofollow noopener noreferrer">' + \

View File

@ -16,7 +16,7 @@ from utils import get_full_domain
from utils import get_config_param
from utils import is_dormant
from utils import remove_html
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import is_featured_writer
from utils import acct_dir
@ -65,7 +65,7 @@ def htmlPersonOptions(defaultTimeline: str,
isGroup: bool) -> str:
"""Show options for a person: view/follow/block/report
"""
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
optionsDomain, optionsPort = get_domain_from_actor(optionsActor)
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'):
@ -87,7 +87,7 @@ def htmlPersonOptions(defaultTimeline: str,
nickname = nickname.split('/')[0]
if '?' in nickname:
nickname = nickname.split('?')[0]
followerDomain, followerPort = getDomainFromActor(optionsActor)
followerDomain, followerPort = get_domain_from_actor(optionsActor)
if isFollowingActor(base_dir, nickname, domain, optionsActor):
followStr = 'Unfollow'
if isGroup:
@ -155,7 +155,7 @@ def htmlPersonOptions(defaultTimeline: str,
' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
newDomain, newPort = get_domain_from_actor(movedTo)
if newNickname and newDomain:
newHandle = newNickname + '@' + newDomain
optionsStr += \
@ -175,13 +175,13 @@ def htmlPersonOptions(defaultTimeline: str,
if ctr > 0:
otherAccountsHtml += ' '
ctr += 1
altDomain, altPort = getDomainFromActor(altActor)
altDomain, altPort = get_domain_from_actor(altActor)
otherAccountsHtml += \
'<a href="' + altActor + '">' + altDomain + '</a>'
elif isinstance(alsoKnownAs, str):
if alsoKnownAs != optionsActor:
ctr += 1
altDomain, altPort = getDomainFromActor(alsoKnownAs)
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
otherAccountsHtml += \
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
otherAccountsHtml += '</p>\n'

View File

@ -49,7 +49,7 @@ from utils import isPublicPost
from utils import updateRecentPostsCache
from utils import remove_id_ending
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import acct_dir
from utils import local_actor_url
from content import limitRepeatedWords
@ -99,7 +99,7 @@ def _htmlPostMetadataOpenGraph(domain: str, post_json_object: {}) -> str:
if isinstance(objJson['attributedTo'], str):
attrib = objJson['attributedTo']
actorNick = getNicknameFromActor(attrib)
actorDomain, _ = getDomainFromActor(attrib)
actorDomain, _ = get_domain_from_actor(attrib)
actorHandle = actorNick + '@' + actorDomain
metadata += \
" <meta content=\"@" + actorHandle + \
@ -400,7 +400,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
blockNickname = \
getNicknameFromActor(post_json_object['object']['replyTo'])
blockDomain, _ = \
getDomainFromActor(post_json_object['object']['replyTo'])
get_domain_from_actor(post_json_object['object']['replyTo'])
if not isBlocked(base_dir, nickname, domain,
blockNickname, blockDomain, {}):
replyToLink = post_json_object['object']['replyTo']
@ -995,7 +995,7 @@ def _getPostTitleAnnounceHtml(base_dir: str,
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
announceDomain, announcePort = getDomainFromActor(attributedTo)
announceDomain, announcePort = get_domain_from_actor(attributedTo)
getPersonFromCache(base_dir, attributedTo, person_cache, allowDownloads)
announceDisplayName = getDisplayName(base_dir, attributedTo, person_cache)
if not announceDisplayName:
@ -1173,7 +1173,7 @@ def _getPostTitleReplyHtml(base_dir: str,
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
replyDomain, replyPort = getDomainFromActor(replyActor)
replyDomain, replyPort = get_domain_from_actor(replyActor)
if not (replyNickname and replyDomain):
titleStr += _replyToUnknownHtml(translate, post_json_object)
return (titleStr, replyAvatarImageInPost,
@ -1425,7 +1425,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
if domain_full not in postActor:
# lookup the correct webfinger for the postActor
postActorNickname = getNicknameFromActor(postActor)
postActorDomain, postActorPort = getDomainFromActor(postActor)
postActorDomain, postActorPort = get_domain_from_actor(postActor)
postActorDomainFull = get_full_domain(postActorDomain, postActorPort)
postActorHandle = postActorNickname + '@' + postActorDomainFull
postActorWf = \
@ -1578,7 +1578,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
if not actorNickname:
# single user instance
actorNickname = 'dev'
actorDomain, actorPort = getDomainFromActor(postActor)
actorDomain, actorPort = get_domain_from_actor(postActor)
displayName = getDisplayName(base_dir, postActor, person_cache)
if displayName:
@ -2025,7 +2025,7 @@ def htmlIndividualPost(cssCache: {},
if byStr:
byStrNickname = getNicknameFromActor(byStr)
byStrDomain, byStrPort = getDomainFromActor(byStr)
byStrDomain, byStrPort = get_domain_from_actor(byStr)
byStrDomain = get_full_domain(byStrDomain, byStrPort)
byStrHandle = byStrNickname + '@' + byStrDomain
if translate.get(byText):

View File

@ -19,7 +19,7 @@ from utils import get_full_domain
from utils import is_artist
from utils import is_dormant
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import is_system_account
from utils import remove_html
from utils import load_json
@ -156,7 +156,7 @@ def htmlProfileAfterSearch(cssCache: {},
return None
personUrl = profile_json['id']
searchDomain, searchPort = getDomainFromActor(personUrl)
searchDomain, searchPort = get_domain_from_actor(personUrl)
if not searchDomain:
return None
searchNickname = getNicknameFromActor(personUrl)
@ -408,7 +408,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
joinedDate.split('T')[0] + '<br>\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
newDomain, newPort = get_domain_from_actor(movedTo)
newDomainFull = get_full_domain(newDomain, newPort)
if newNickname and newDomain:
htmlStr += \
@ -428,13 +428,13 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
if ctr > 0:
otherAccountsHtml += ' '
ctr += 1
altDomain, altPort = getDomainFromActor(altActor)
altDomain, altPort = get_domain_from_actor(altActor)
otherAccountsHtml += \
'<a href="' + altActor + '">' + altDomain + '</a>'
elif isinstance(alsoKnownAs, str):
if alsoKnownAs != actor:
ctr += 1
altDomain, altPort = getDomainFromActor(alsoKnownAs)
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
otherAccountsHtml += \
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
otherAccountsHtml += '</p>\n'
@ -502,7 +502,7 @@ def _getProfileHeaderAfterSearch(base_dir: str,
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
if movedTo:
newNickname = getNicknameFromActor(movedTo)
newDomain, newPort = getDomainFromActor(movedTo)
newDomain, newPort = get_domain_from_actor(movedTo)
newDomainFull = get_full_domain(newDomain, newPort)
if newNickname and newDomain:
newHandle = newNickname + '@' + newDomainFull
@ -520,13 +520,13 @@ def _getProfileHeaderAfterSearch(base_dir: str,
if ctr > 0:
otherAccountshtml += ' '
ctr += 1
altDomain, altPort = getDomainFromActor(altActor)
altDomain, altPort = get_domain_from_actor(altActor)
otherAccountshtml += \
'<a href="' + altActor + '">' + altDomain + '</a>'
elif isinstance(alsoKnownAs, str):
if alsoKnownAs != actor:
ctr += 1
altDomain, altPort = getDomainFromActor(alsoKnownAs)
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
otherAccountshtml += \
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
@ -589,7 +589,7 @@ def htmlProfile(signing_priv_key_pem: str,
pageNumber, maxItemsPerPage, cw_lists,
lists_enabled)
domain, port = getDomainFromActor(profile_json['id'])
domain, port = get_domain_from_actor(profile_json['id'])
if not domain:
return ""
displayName = \
@ -760,7 +760,7 @@ def htmlProfile(signing_priv_key_pem: str,
# is this a new domain?
# if so then append a new instance indicator
followerDomain, _ = \
getDomainFromActor(followerActor)
get_domain_from_actor(followerActor)
newFollowerDomain = ''
if followerDomain not in currFollowerDomains:
newFollowerDomain = ''
@ -2354,7 +2354,7 @@ def _individualFollowAsHtml(signing_priv_key_pem: str,
"""An individual follow entry on the profile screen
"""
followUrlNickname = getNicknameFromActor(followUrl)
followUrlDomain, followUrlPort = getDomainFromActor(followUrl)
followUrlDomain, followUrlPort = get_domain_from_actor(followUrl)
followUrlDomainFull = get_full_domain(followUrlDomain, followUrlPort)
titleStr = '@' + followUrlNickname + '@' + followUrlDomainFull
avatarUrl = getPersonAvatarUrl(base_dir, followUrl, person_cache, True)

View File

@ -17,7 +17,7 @@ from utils import get_config_param
from utils import get_full_domain
from utils import is_editor
from utils import load_json
from utils import getDomainFromActor
from utils import get_domain_from_actor
from utils import getNicknameFromActor
from utils import locate_post
from utils import isPublicPost
@ -337,7 +337,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
base_dir + '/emoji/emoji.json')
actor = path.replace('/search', '')
domain, port = getDomainFromActor(actor)
domain, port = get_domain_from_actor(actor)
setCustomBackground(base_dir, 'search-background', 'follow-background')