mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
4de863ac01
commit
b6ac0d6b24
|
@ -13,7 +13,7 @@ from utils import has_users_path
|
|||
from utils import get_full_domain
|
||||
from utils import url_permitted
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import domain_permitted
|
||||
from utils import follow_person
|
||||
from utils import acct_dir
|
||||
|
@ -99,7 +99,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
|||
if debug:
|
||||
print('DEBUG: follow Accept received')
|
||||
this_actor = message_json['object']['actor']
|
||||
nickname = getNicknameFromActor(this_actor)
|
||||
nickname = get_nickname_from_actor(this_actor)
|
||||
if not nickname:
|
||||
print('WARN: no nickname found in ' + this_actor)
|
||||
return
|
||||
|
@ -138,7 +138,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
|||
followed_domain_full = followed_domain
|
||||
if port:
|
||||
followed_domain_full = followed_domain + ':' + str(port)
|
||||
followed_nickname = getNicknameFromActor(followed_actor)
|
||||
followed_nickname = get_nickname_from_actor(followed_actor)
|
||||
if not followed_nickname:
|
||||
print('DEBUG: no nickname found within Follow activity object ' +
|
||||
followed_actor)
|
||||
|
@ -206,7 +206,7 @@ def receiveAcceptReject(session, base_dir: str,
|
|||
print('DEBUG: ' + message_json['type'] +
|
||||
' from domain not permitted - ' + domain)
|
||||
return False
|
||||
nickname = getNicknameFromActor(message_json['actor'])
|
||||
nickname = get_nickname_from_actor(message_json['actor'])
|
||||
if not nickname:
|
||||
# single user instance
|
||||
nickname = 'dev'
|
||||
|
|
|
@ -16,7 +16,7 @@ from utils import get_full_domain
|
|||
from utils import get_status_number
|
||||
from utils import create_outbox_dir
|
||||
from utils import url_permitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import save_json
|
||||
|
@ -69,7 +69,7 @@ def outboxAnnounce(recent_posts_cache: {},
|
|||
return False
|
||||
if isSelfAnnounce(message_json):
|
||||
return False
|
||||
nickname = getNicknameFromActor(message_json['actor'])
|
||||
nickname = get_nickname_from_actor(message_json['actor'])
|
||||
if not nickname:
|
||||
print('WARN: no nickname found in ' + message_json['actor'])
|
||||
return False
|
||||
|
@ -88,7 +88,7 @@ def outboxAnnounce(recent_posts_cache: {},
|
|||
if message_json['object']['type'] == 'Announce':
|
||||
if not isinstance(message_json['object']['object'], str):
|
||||
return False
|
||||
nickname = getNicknameFromActor(message_json['actor'])
|
||||
nickname = get_nickname_from_actor(message_json['actor'])
|
||||
if not nickname:
|
||||
print('WARN: no nickname found in ' + message_json['actor'])
|
||||
return False
|
||||
|
@ -166,7 +166,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
|||
announcePort = None
|
||||
group_account = False
|
||||
if has_users_path(objectUrl):
|
||||
announceNickname = getNicknameFromActor(objectUrl)
|
||||
announceNickname = get_nickname_from_actor(objectUrl)
|
||||
announceDomain, announcePort = get_domain_from_actor(objectUrl)
|
||||
if '/' + str(announceNickname) + '/' in objectUrl:
|
||||
announceActor = \
|
||||
|
|
|
@ -14,7 +14,7 @@ from posts import getPersonBox
|
|||
from session import postJson
|
||||
from utils import has_object_string
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import load_json
|
||||
from utils import save_json
|
||||
|
@ -67,7 +67,7 @@ def outboxAvailability(base_dir: str, nickname: str, message_json: {},
|
|||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
|
||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||
actorNickname = get_nickname_from_actor(message_json['actor'])
|
||||
if actorNickname != nickname:
|
||||
return False
|
||||
domain, port = get_domain_from_actor(message_json['actor'])
|
||||
|
|
10
blocking.py
10
blocking.py
|
@ -29,7 +29,7 @@ from utils import is_evil
|
|||
from utils import locate_post
|
||||
from utils import evil_incarnate
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import acct_dir
|
||||
from utils import local_actor_url
|
||||
from utils import has_actor
|
||||
|
@ -448,7 +448,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
|
|||
print('DEBUG: c2s block post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return False
|
||||
nicknameBlocked = getNicknameFromActor(message_json['object'])
|
||||
nicknameBlocked = get_nickname_from_actor(message_json['object'])
|
||||
if not nicknameBlocked:
|
||||
print('WARN: unable to find nickname in ' + message_json['object'])
|
||||
return False
|
||||
|
@ -504,7 +504,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
|
|||
print('DEBUG: c2s undo block post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return
|
||||
nicknameBlocked = getNicknameFromActor(message_json['object']['object'])
|
||||
nicknameBlocked = get_nickname_from_actor(message_json['object']['object'])
|
||||
if not nicknameBlocked:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['object'])
|
||||
|
@ -806,7 +806,7 @@ def outboxMute(base_dir: str, http_prefix: str,
|
|||
print('DEBUG: c2s mute post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return
|
||||
nicknameMuted = getNicknameFromActor(message_json['object'])
|
||||
nicknameMuted = get_nickname_from_actor(message_json['object'])
|
||||
if not nicknameMuted:
|
||||
print('WARN: unable to find nickname in ' + message_json['object'])
|
||||
return
|
||||
|
@ -861,7 +861,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
|
|||
print('DEBUG: c2s undo mute post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return
|
||||
nicknameMuted = getNicknameFromActor(message_json['object']['object'])
|
||||
nicknameMuted = get_nickname_from_actor(message_json['object']['object'])
|
||||
if not nicknameMuted:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['object'])
|
||||
|
|
4
blog.py
4
blog.py
|
@ -26,7 +26,7 @@ from utils import remove_html
|
|||
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 get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import load_json
|
||||
|
@ -216,7 +216,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
authorNickname = None
|
||||
if isinstance(post_json_object['object']['attributedTo'], str):
|
||||
actor = post_json_object['object']['attributedTo']
|
||||
authorNickname = getNicknameFromActor(actor)
|
||||
authorNickname = get_nickname_from_actor(actor)
|
||||
if authorNickname:
|
||||
authorDomain, authorPort = get_domain_from_actor(actor)
|
||||
if authorDomain:
|
||||
|
|
14
bookmarks.py
14
bookmarks.py
|
@ -17,7 +17,7 @@ from utils import get_full_domain
|
|||
from utils import remove_id_ending
|
||||
from utils import remove_post_from_cache
|
||||
from utils import url_permitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import get_cached_post_filename
|
||||
|
@ -44,7 +44,7 @@ def undoBookmarksCollectionEntry(recent_posts_cache: {},
|
|||
|
||||
# remove any cached version of this post so that the
|
||||
# bookmark icon is changed
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
cachedPostFilename = \
|
||||
get_cached_post_filename(base_dir, nickname,
|
||||
domain, post_json_object)
|
||||
|
@ -164,7 +164,7 @@ def updateBookmarksCollection(recent_posts_cache: {},
|
|||
if post_json_object:
|
||||
# remove any cached version of this post so that the
|
||||
# bookmark icon is changed
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
cachedPostFilename = \
|
||||
get_cached_post_filename(base_dir, nickname,
|
||||
domain, post_json_object)
|
||||
|
@ -285,12 +285,12 @@ def bookmark(recent_posts_cache: {},
|
|||
bookmarkedPostPort = None
|
||||
if actorBookmarked:
|
||||
acBm = actorBookmarked
|
||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||
bookmarkedPostNickname = get_nickname_from_actor(acBm)
|
||||
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
|
||||
else:
|
||||
if has_users_path(objectUrl):
|
||||
ou = objectUrl
|
||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||
bookmarkedPostNickname = get_nickname_from_actor(ou)
|
||||
bookmarkedPostDomain, bookmarkedPostPort = \
|
||||
get_domain_from_actor(ou)
|
||||
|
||||
|
@ -350,12 +350,12 @@ def undoBookmark(recent_posts_cache: {},
|
|||
bookmarkedPostPort = None
|
||||
if actorBookmarked:
|
||||
acBm = actorBookmarked
|
||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||
bookmarkedPostNickname = get_nickname_from_actor(acBm)
|
||||
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
|
||||
else:
|
||||
if has_users_path(objectUrl):
|
||||
ou = objectUrl
|
||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||
bookmarkedPostNickname = get_nickname_from_actor(ou)
|
||||
bookmarkedPostDomain, bookmarkedPostPort = \
|
||||
get_domain_from_actor(ou)
|
||||
|
||||
|
|
114
daemon.py
114
daemon.py
|
@ -293,7 +293,7 @@ from utils import remove_avatar_from_cache
|
|||
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 get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import get_status_number
|
||||
from utils import url_permitted
|
||||
|
@ -1883,7 +1883,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if searchHandle:
|
||||
if '/@' in searchHandle:
|
||||
searchNickname = \
|
||||
getNicknameFromActor(searchHandle)
|
||||
get_nickname_from_actor(searchHandle)
|
||||
searchDomain, searchPort = \
|
||||
get_domain_from_actor(searchHandle)
|
||||
searchHandle = \
|
||||
|
@ -1891,7 +1891,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '@' not in searchHandle:
|
||||
if searchHandle.startswith('http'):
|
||||
searchNickname = \
|
||||
getNicknameFromActor(searchHandle)
|
||||
get_nickname_from_actor(searchHandle)
|
||||
searchDomain, searchPort = \
|
||||
get_domain_from_actor(searchHandle)
|
||||
searchHandle = \
|
||||
|
@ -1951,7 +1951,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
nickname = moderationText
|
||||
if nickname.startswith('http') or \
|
||||
nickname.startswith('hyper'):
|
||||
nickname = getNicknameFromActor(nickname)
|
||||
nickname = get_nickname_from_actor(nickname)
|
||||
if '@' in nickname:
|
||||
nickname = nickname.split('@')[0]
|
||||
if moderationButton == 'suspend':
|
||||
|
@ -2274,7 +2274,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
usersPath = path.split('/personoptions')[0]
|
||||
originPathStr = http_prefix + '://' + domain_full + usersPath
|
||||
|
||||
chooserNickname = getNicknameFromActor(originPathStr)
|
||||
chooserNickname = get_nickname_from_actor(originPathStr)
|
||||
if not chooserNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -2358,7 +2358,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
personNotes = None
|
||||
|
||||
# get the nickname
|
||||
optionsNickname = getNicknameFromActor(optionsActor)
|
||||
optionsNickname = get_nickname_from_actor(optionsActor)
|
||||
if not optionsNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -2895,7 +2895,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
usersPath = path.split('/unfollowconfirm')[0]
|
||||
originPathStr = http_prefix + '://' + domain_full + usersPath
|
||||
followerNickname = getNicknameFromActor(originPathStr)
|
||||
followerNickname = get_nickname_from_actor(originPathStr)
|
||||
|
||||
length = int(self.headers['Content-length'])
|
||||
|
||||
|
@ -2925,7 +2925,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
followingActor = followingActor.split('actor=')[1]
|
||||
if '&' in followingActor:
|
||||
followingActor = followingActor.split('&')[0]
|
||||
followingNickname = getNicknameFromActor(followingActor)
|
||||
followingNickname = get_nickname_from_actor(followingActor)
|
||||
followingDomain, followingPort = \
|
||||
get_domain_from_actor(followingActor)
|
||||
followingDomainFull = \
|
||||
|
@ -2983,7 +2983,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
usersPath = path.split('/followconfirm')[0]
|
||||
originPathStr = http_prefix + '://' + domain_full + usersPath
|
||||
followerNickname = getNicknameFromActor(originPathStr)
|
||||
followerNickname = get_nickname_from_actor(originPathStr)
|
||||
|
||||
length = int(self.headers['Content-length'])
|
||||
|
||||
|
@ -3023,7 +3023,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
followingActor = followingActor.split('actor=')[1]
|
||||
if '&' in followingActor:
|
||||
followingActor = followingActor.split('&')[0]
|
||||
followingNickname = getNicknameFromActor(followingActor)
|
||||
followingNickname = get_nickname_from_actor(followingActor)
|
||||
followingDomain, followingPort = \
|
||||
get_domain_from_actor(followingActor)
|
||||
if followerNickname == followingNickname and \
|
||||
|
@ -3073,7 +3073,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
usersPath = path.split('/blockconfirm')[0]
|
||||
originPathStr = http_prefix + '://' + domain_full + usersPath
|
||||
blockerNickname = getNicknameFromActor(originPathStr)
|
||||
blockerNickname = get_nickname_from_actor(originPathStr)
|
||||
if not blockerNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -3113,7 +3113,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
blockingActor = blockingActor.split('actor=')[1]
|
||||
if '&' in blockingActor:
|
||||
blockingActor = blockingActor.split('&')[0]
|
||||
blockingNickname = getNicknameFromActor(blockingActor)
|
||||
blockingNickname = get_nickname_from_actor(blockingActor)
|
||||
if not blockingNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -3160,7 +3160,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
usersPath = path.split('/unblockconfirm')[0]
|
||||
originPathStr = http_prefix + '://' + domain_full + usersPath
|
||||
blockerNickname = getNicknameFromActor(originPathStr)
|
||||
blockerNickname = get_nickname_from_actor(originPathStr)
|
||||
if not blockerNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -3200,7 +3200,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
blockingActor = blockingActor.split('actor=')[1]
|
||||
if '&' in blockingActor:
|
||||
blockingActor = blockingActor.split('&')[0]
|
||||
blockingNickname = getNicknameFromActor(blockingActor)
|
||||
blockingNickname = get_nickname_from_actor(blockingActor)
|
||||
if not blockingNickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
originPathStr = 'http://' + onion_domain + usersPath
|
||||
|
@ -3292,7 +3292,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if searchForEmoji:
|
||||
searchStr = ':' + searchStr + ':'
|
||||
if searchStr.startswith('#'):
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
# hashtag search
|
||||
hashtagStr = \
|
||||
htmlHashtagSearch(self.server.cssCache,
|
||||
|
@ -3384,7 +3384,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
searchStr = searchStr.replace(possEnding, '')
|
||||
break
|
||||
# your post history search
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
searchStr = searchStr.replace("'", '', 1).strip()
|
||||
historyStr = \
|
||||
htmlHistorySearch(self.server.cssCache,
|
||||
|
@ -3452,7 +3452,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
searchStr = searchStr.replace(possEnding, '')
|
||||
break
|
||||
# bookmark search
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
searchStr = searchStr.replace('-', '', 1).strip()
|
||||
bookmarksStr = \
|
||||
htmlHistorySearch(self.server.cssCache,
|
||||
|
@ -3503,7 +3503,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.POSTbusy = False
|
||||
return
|
||||
# profile search
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
if not self._establishSession("handle search"):
|
||||
self.server.POSTbusy = False
|
||||
return
|
||||
|
@ -3512,7 +3512,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# are we already following the searched for handle?
|
||||
if isFollowingActor(base_dir, nickname, domain, searchStr):
|
||||
if not has_users_path(searchStr):
|
||||
searchNickname = getNicknameFromActor(searchStr)
|
||||
searchNickname = get_nickname_from_actor(searchStr)
|
||||
searchDomain, searchPort = \
|
||||
get_domain_from_actor(searchStr)
|
||||
searchDomainFull = \
|
||||
|
@ -3691,7 +3691,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# the actor who votes
|
||||
usersPath = path.replace('/question', '')
|
||||
actor = http_prefix + '://' + domain_full + usersPath
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
if not nickname:
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
actor = 'http://' + onion_domain + usersPath
|
||||
|
@ -3866,13 +3866,13 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
adminActor = \
|
||||
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||
actor = originPathStr
|
||||
actorNickname = getNicknameFromActor(actor)
|
||||
actorNickname = get_nickname_from_actor(actor)
|
||||
if actor == shareActor or actor == adminActor or \
|
||||
isModerator(base_dir, actorNickname):
|
||||
itemID = removeShareConfirmParams.split('itemID=')[1]
|
||||
if '&' in itemID:
|
||||
itemID = itemID.split('&')[0]
|
||||
shareNickname = getNicknameFromActor(shareActor)
|
||||
shareNickname = get_nickname_from_actor(shareActor)
|
||||
if shareNickname:
|
||||
shareDomain, sharePort = get_domain_from_actor(shareActor)
|
||||
removeSharedItem(base_dir,
|
||||
|
@ -3933,13 +3933,13 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
adminActor = \
|
||||
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||
actor = originPathStr
|
||||
actorNickname = getNicknameFromActor(actor)
|
||||
actorNickname = get_nickname_from_actor(actor)
|
||||
if actor == shareActor or actor == adminActor or \
|
||||
isModerator(base_dir, actorNickname):
|
||||
itemID = removeShareConfirmParams.split('itemID=')[1]
|
||||
if '&' in itemID:
|
||||
itemID = itemID.split('&')[0]
|
||||
shareNickname = getNicknameFromActor(shareActor)
|
||||
shareNickname = get_nickname_from_actor(shareActor)
|
||||
if shareNickname:
|
||||
shareDomain, sharePort = get_domain_from_actor(shareActor)
|
||||
removeSharedItem(base_dir,
|
||||
|
@ -4027,7 +4027,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'cc': [removePostActor + '/followers'],
|
||||
'type': 'Delete'
|
||||
}
|
||||
self.postToNickname = getNicknameFromActor(removePostActor)
|
||||
self.postToNickname = get_nickname_from_actor(removePostActor)
|
||||
if self.postToNickname:
|
||||
if monthStr and yearStr:
|
||||
if monthStr.isdigit() and yearStr.isdigit():
|
||||
|
@ -4072,7 +4072,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
boundary = boundary.split(';')[0]
|
||||
|
||||
# get the nickname
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
editor = None
|
||||
if nickname:
|
||||
editor = is_editor(base_dir, nickname)
|
||||
|
@ -4231,7 +4231,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
boundary = boundary.split(';')[0]
|
||||
|
||||
# get the nickname
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
editor = None
|
||||
if nickname:
|
||||
editor = is_editor(base_dir, nickname)
|
||||
|
@ -4314,7 +4314,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
boundary = boundary.split(';')[0]
|
||||
|
||||
# get the nickname
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
moderator = None
|
||||
if nickname:
|
||||
moderator = isModerator(base_dir, nickname)
|
||||
|
@ -4464,7 +4464,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
usersPath = path.replace('/citationsdata', '')
|
||||
actorStr = self._get_instance_url(calling_domain) + usersPath
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
|
||||
citationsFilename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/.citations.txt'
|
||||
|
@ -4559,7 +4559,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
boundary = boundary.split(';')[0]
|
||||
|
||||
# get the nickname
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
editorRole = None
|
||||
if nickname:
|
||||
editorRole = is_editor(base_dir, nickname)
|
||||
|
@ -4696,7 +4696,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
boundary = boundary.split(';')[0]
|
||||
|
||||
# get the nickname
|
||||
nickname = getNicknameFromActor(actorStr)
|
||||
nickname = get_nickname_from_actor(actorStr)
|
||||
if not nickname:
|
||||
print('WARN: nickname not found in ' + actorStr)
|
||||
self._redirect_headers(actorStr, cookie, calling_domain)
|
||||
|
@ -7607,7 +7607,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
actor = \
|
||||
http_prefix + '://' + domain_full + path
|
||||
nickname = \
|
||||
getNicknameFromActor(actor)
|
||||
get_nickname_from_actor(actor)
|
||||
hashtagStr = \
|
||||
rssHashtagSearch(nickname,
|
||||
domain, port,
|
||||
|
@ -7680,7 +7680,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
actor = path.split('?repeat=')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -7832,7 +7832,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
actor = path.split('?unrepeat=')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -7873,7 +7873,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in announceUrl:
|
||||
announceUrl = announceUrl.split('?')[0]
|
||||
post_filename = None
|
||||
nickname = getNicknameFromActor(announceUrl)
|
||||
nickname = get_nickname_from_actor(announceUrl)
|
||||
if nickname:
|
||||
if domain_full + '/users/' + nickname + '/' in announceUrl:
|
||||
post_filename = \
|
||||
|
@ -7908,7 +7908,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
followerNickname = originPathStr.replace('/users/', '')
|
||||
followingHandle = path.split('/followapprove=')[1]
|
||||
if '://' in followingHandle:
|
||||
handleNickname = getNicknameFromActor(followingHandle)
|
||||
handleNickname = get_nickname_from_actor(followingHandle)
|
||||
handleDomain, handlePort = get_domain_from_actor(followingHandle)
|
||||
followingHandle = \
|
||||
handleNickname + '@' + \
|
||||
|
@ -8067,7 +8067,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
followerNickname = originPathStr.replace('/users/', '')
|
||||
followingHandle = path.split('/followdeny=')[1]
|
||||
if '://' in followingHandle:
|
||||
handleNickname = getNicknameFromActor(followingHandle)
|
||||
handleNickname = get_nickname_from_actor(followingHandle)
|
||||
handleDomain, handlePort = get_domain_from_actor(followingHandle)
|
||||
followingHandle = \
|
||||
handleNickname + '@' + \
|
||||
|
@ -8134,7 +8134,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -8298,7 +8298,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
actor = path.split('?unlike=')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -8465,7 +8465,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
calling_domain)
|
||||
return
|
||||
emojiContent = urllib.parse.unquote_plus(emojiContentEncoded)
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -8634,7 +8634,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
actor = path.split('?unreact=')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -8802,7 +8802,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timelineStr = path.split('?tl=')[1]
|
||||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -8896,7 +8896,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -9022,7 +9022,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if '?' in timelineStr:
|
||||
timelineStr = timelineStr.split('?')[0]
|
||||
actor = path.split('?unbookmark=')[0]
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
actorAbsolute = self._get_instance_url(calling_domain) + actor
|
||||
|
@ -9163,7 +9163,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self._redirect_headers(actor + '/' + timelineStr,
|
||||
cookie, calling_domain)
|
||||
return
|
||||
self.postToNickname = getNicknameFromActor(actor)
|
||||
self.postToNickname = get_nickname_from_actor(actor)
|
||||
if not self.postToNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
|
@ -9249,7 +9249,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
pageNumber = int(pageNumberStr)
|
||||
actor = \
|
||||
http_prefix + '://' + domain_full + path.split('?mute=')[0]
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
mutePost(base_dir, nickname, domain, port,
|
||||
http_prefix, muteUrl,
|
||||
self.server.recent_posts_cache, debug)
|
||||
|
@ -9358,7 +9358,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
pageNumber = int(pageNumberStr)
|
||||
actor = \
|
||||
http_prefix + '://' + domain_full + path.split('?unmute=')[0]
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
unmutePost(base_dir, nickname, domain, port,
|
||||
http_prefix, muteUrl,
|
||||
self.server.recent_posts_cache, debug)
|
||||
|
@ -12526,7 +12526,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
GETstartTime) -> bool:
|
||||
"""Shows a QR code for an account
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
savePersonQrcode(base_dir, nickname, domain, port)
|
||||
qrFilename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||
|
@ -12567,7 +12567,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
GETstartTime) -> bool:
|
||||
"""Shows a banner image on the search screen
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
bannerFilename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/search_banner.png'
|
||||
if not os.path.isfile(bannerFilename):
|
||||
|
@ -12612,7 +12612,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
GETstartTime) -> bool:
|
||||
"""Shows an image at the top of the left/right column
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
self._404()
|
||||
return True
|
||||
|
@ -12954,7 +12954,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
isNewPostEndpoint = True
|
||||
break
|
||||
if isNewPostEndpoint:
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
|
||||
if inReplyToUrl:
|
||||
replyIntervalHours = self.server.default_reply_interval_hrs
|
||||
|
@ -13041,7 +13041,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
return False
|
||||
if not path.endswith('/crawlers'):
|
||||
return False
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
return False
|
||||
if not isModerator(base_dir, nickname):
|
||||
|
@ -13072,7 +13072,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
if '/users/' in path and path.endswith('/editprofile'):
|
||||
peertube_instances = self.server.peertube_instances
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if nickname:
|
||||
city = getSpoofedCity(self.server.city,
|
||||
base_dir, nickname, domain)
|
||||
|
@ -14385,7 +14385,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# show a list of who you are following
|
||||
if htmlGET and authorized and usersInPath and \
|
||||
self.path.endswith('/followingaccounts'):
|
||||
nickname = getNicknameFromActor(self.path)
|
||||
nickname = get_nickname_from_actor(self.path)
|
||||
followingFilename = \
|
||||
acct_dir(self.server.base_dir,
|
||||
nickname, self.server.domain) + '/following.txt'
|
||||
|
@ -14984,7 +14984,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
(not authorized and
|
||||
self.path.startswith('/users/news/') and
|
||||
self.server.news_instance)):
|
||||
nickname = getNicknameFromActor(self.path)
|
||||
nickname = get_nickname_from_actor(self.path)
|
||||
if not nickname:
|
||||
self._404()
|
||||
self.server.GETbusy = False
|
||||
|
@ -15028,7 +15028,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
(not authorized and
|
||||
self.path.startswith('/users/news/') and
|
||||
self.server.news_instance)):
|
||||
nickname = getNicknameFromActor(self.path)
|
||||
nickname = get_nickname_from_actor(self.path)
|
||||
if not nickname:
|
||||
self._404()
|
||||
self.server.GETbusy = False
|
||||
|
@ -15698,7 +15698,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
actor = self.path.split(';actor=')[1]
|
||||
if ';' in actor:
|
||||
actor = actor.split(';')[0]
|
||||
nickname = getNicknameFromActor(self.path.split('?')[0])
|
||||
nickname = get_nickname_from_actor(self.path.split('?')[0])
|
||||
if nickname == actor:
|
||||
postUrl = \
|
||||
local_actor_url(self.server.http_prefix, nickname,
|
||||
|
|
|
@ -14,7 +14,7 @@ from utils import remove_domain_port
|
|||
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 get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import deletePost
|
||||
|
@ -147,7 +147,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: c2s delete object has no nickname')
|
||||
return
|
||||
deleteNickname = getNicknameFromActor(messageId)
|
||||
deleteNickname = get_nickname_from_actor(messageId)
|
||||
if deleteNickname != nickname:
|
||||
if debug:
|
||||
print("DEBUG: you can't delete a post which " +
|
||||
|
|
|
@ -22,7 +22,7 @@ from utils import get_full_domain
|
|||
from utils import is_dm
|
||||
from utils import load_translations_from_file
|
||||
from utils import remove_html
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import is_pgp_encrypted
|
||||
from utils import local_actor_url
|
||||
|
@ -142,7 +142,7 @@ def _createDesktopConfig(actor: str) -> None:
|
|||
os.mkdir(homeDir + '/.config')
|
||||
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
||||
os.mkdir(homeDir + '/.config/epicyon')
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
handle = nickname + '@' + domain
|
||||
if port != 443 and port != 80:
|
||||
|
@ -157,7 +157,7 @@ def _markPostAsRead(actor: str, post_id: str, postCategory: str) -> None:
|
|||
"""
|
||||
homeDir = str(Path.home())
|
||||
_createDesktopConfig(actor)
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
handle = nickname + '@' + domain
|
||||
if port != 443 and port != 80:
|
||||
|
@ -187,7 +187,7 @@ def _hasReadPost(actor: str, post_id: str, postCategory: str) -> bool:
|
|||
"""
|
||||
homeDir = str(Path.home())
|
||||
_createDesktopConfig(actor)
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
handle = nickname + '@' + domain
|
||||
if port != 443 and port != 80:
|
||||
|
@ -426,7 +426,7 @@ def _desktopReplyToPost(session, post_id: str,
|
|||
"""
|
||||
if '://' not in post_id:
|
||||
return
|
||||
toNickname = getNicknameFromActor(post_id)
|
||||
toNickname = get_nickname_from_actor(post_id)
|
||||
toDomain, toPort = get_domain_from_actor(post_id)
|
||||
sayStr = 'Replying to ' + toNickname + '@' + toDomain
|
||||
_sayCommand(sayStr, sayStr,
|
||||
|
@ -695,7 +695,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
|
||||
if post_json_object['type'] == 'Announce':
|
||||
actor = post_json_object['actor']
|
||||
nameStr = getNicknameFromActor(actor)
|
||||
nameStr = get_nickname_from_actor(actor)
|
||||
recent_posts_cache = {}
|
||||
allow_local_network_access = False
|
||||
yt_replace_domain = None
|
||||
|
@ -725,7 +725,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
if isinstance(attributedTo, str) and content:
|
||||
actor = attributedTo
|
||||
nameStr += ' ' + translate['announces'] + ' ' + \
|
||||
getNicknameFromActor(actor)
|
||||
get_nickname_from_actor(actor)
|
||||
sayStr = nameStr
|
||||
_sayCommand(sayStr, sayStr, screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -751,7 +751,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
not isinstance(content, str):
|
||||
return {}
|
||||
actor = attributedTo
|
||||
nameStr = getNicknameFromActor(actor)
|
||||
nameStr = get_nickname_from_actor(actor)
|
||||
content = _textOnlyContent(content)
|
||||
content += _getImageDescription(post_json_object)
|
||||
|
||||
|
@ -804,7 +804,7 @@ def _desktopShowActor(base_dir: str, actor_json: {}, translate: {},
|
|||
"""Shows information for the given actor
|
||||
"""
|
||||
actor = actor_json['id']
|
||||
actorNickname = getNicknameFromActor(actor)
|
||||
actorNickname = get_nickname_from_actor(actor)
|
||||
actorDomain, actorPort = get_domain_from_actor(actor)
|
||||
actorDomainFull = get_full_domain(actorDomain, actorPort)
|
||||
handle = '@' + actorNickname + '@' + actorDomainFull
|
||||
|
@ -853,7 +853,7 @@ def _desktopShowProfile(session, nickname: str, domain: str,
|
|||
|
||||
actor = None
|
||||
if post_json_object['type'] == 'Announce':
|
||||
nickname = getNicknameFromActor(post_json_object['object'])
|
||||
nickname = get_nickname_from_actor(post_json_object['object'])
|
||||
if nickname:
|
||||
nickStr = '/' + nickname + '/'
|
||||
if nickStr in post_json_object['object']:
|
||||
|
@ -1010,13 +1010,13 @@ def _desktopShowBox(indent: str,
|
|||
post_json_object.get('object'):
|
||||
if isinstance(post_json_object['object'], str):
|
||||
authorActor = post_json_object['actor']
|
||||
name = getNicknameFromActor(authorActor) + ' ⮌'
|
||||
name = get_nickname_from_actor(authorActor) + ' ⮌'
|
||||
name = _padToWidth(name, nameWidth)
|
||||
ctrStr = str(ctr)
|
||||
posStr = _padToWidth(ctrStr, numberWidth)
|
||||
published = _formatPublished(post_json_object['published'])
|
||||
announcedNickname = \
|
||||
getNicknameFromActor(post_json_object['object'])
|
||||
get_nickname_from_actor(post_json_object['object'])
|
||||
announcedDomain, announcedPort = \
|
||||
get_domain_from_actor(post_json_object['object'])
|
||||
announcedHandle = announcedNickname + '@' + announcedDomain
|
||||
|
@ -1043,7 +1043,7 @@ def _desktopShowBox(indent: str,
|
|||
contentWarning = '⚡' + \
|
||||
_padToWidth(post_json_object['object']['summary'],
|
||||
contentWidth)
|
||||
name = getNicknameFromActor(authorActor)
|
||||
name = get_nickname_from_actor(authorActor)
|
||||
|
||||
# append icons to the end of the name
|
||||
spaceAdded = False
|
||||
|
@ -1174,7 +1174,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
|||
conversationId = None
|
||||
toPort = port
|
||||
if '://' in toHandle:
|
||||
toNickname = getNicknameFromActor(toHandle)
|
||||
toNickname = get_nickname_from_actor(toHandle)
|
||||
toDomain, toPort = get_domain_from_actor(toHandle)
|
||||
toHandle = toNickname + '@' + toDomain
|
||||
else:
|
||||
|
@ -1281,7 +1281,7 @@ def _desktopShowFollowRequests(followRequestsJson: {}, translate: {}) -> None:
|
|||
print(indent + 'Follow requests:')
|
||||
print('')
|
||||
for item in followRequestsJson['orderedItems']:
|
||||
handleNickname = getNicknameFromActor(item)
|
||||
handleNickname = get_nickname_from_actor(item)
|
||||
handleDomain, handlePort = get_domain_from_actor(item)
|
||||
handleDomainFull = \
|
||||
get_full_domain(handleDomain, handlePort)
|
||||
|
@ -1307,7 +1307,7 @@ def _desktopShowFollowing(followingJson: {}, translate: {},
|
|||
print(indent + 'Followers page ' + str(pageNumber))
|
||||
print('')
|
||||
for item in followingJson['orderedItems']:
|
||||
handleNickname = getNicknameFromActor(item)
|
||||
handleNickname = get_nickname_from_actor(item)
|
||||
handleDomain, handlePort = get_domain_from_actor(item)
|
||||
handleDomainFull = \
|
||||
get_full_domain(handleDomain, handlePort)
|
||||
|
@ -1802,7 +1802,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if post_json_object.get('id'):
|
||||
likeActor = post_json_object['object']['attributedTo']
|
||||
sayStr = 'Liking post by ' + \
|
||||
getNicknameFromActor(likeActor)
|
||||
get_nickname_from_actor(likeActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -1841,7 +1841,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if post_json_object.get('id'):
|
||||
muteActor = post_json_object['object']['attributedTo']
|
||||
sayStr = 'Unmuting post by ' + \
|
||||
getNicknameFromActor(muteActor)
|
||||
get_nickname_from_actor(muteActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -1873,7 +1873,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if post_json_object.get('id'):
|
||||
muteActor = post_json_object['object']['attributedTo']
|
||||
sayStr = 'Muting post by ' + \
|
||||
getNicknameFromActor(muteActor)
|
||||
get_nickname_from_actor(muteActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -1914,7 +1914,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if post_json_object.get('id'):
|
||||
bmActor = post_json_object['object']['attributedTo']
|
||||
sayStr = 'Unbookmarking post by ' + \
|
||||
getNicknameFromActor(bmActor)
|
||||
get_nickname_from_actor(bmActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -1945,7 +1945,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if post_json_object.get('id'):
|
||||
bmActor = post_json_object['object']['attributedTo']
|
||||
sayStr = 'Bookmarking post by ' + \
|
||||
getNicknameFromActor(bmActor)
|
||||
get_nickname_from_actor(bmActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -1979,7 +1979,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
blockActor = \
|
||||
post_json_object['object']['attributedTo']
|
||||
sayStr = 'Unblocking ' + \
|
||||
getNicknameFromActor(blockActor)
|
||||
get_nickname_from_actor(blockActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -2026,7 +2026,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
post_json_object['object']['attributedTo']
|
||||
if blockActor:
|
||||
sayStr = 'Blocking ' + \
|
||||
getNicknameFromActor(blockActor)
|
||||
get_nickname_from_actor(blockActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -2057,7 +2057,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
post_json_object['object']['attributedTo']
|
||||
sayStr = \
|
||||
'Undoing like of post by ' + \
|
||||
getNicknameFromActor(unlikeActor)
|
||||
get_nickname_from_actor(unlikeActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -2088,7 +2088,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
announceActor = \
|
||||
post_json_object['object']['attributedTo']
|
||||
sayStr = 'Announcing post by ' + \
|
||||
getNicknameFromActor(announceActor)
|
||||
get_nickname_from_actor(announceActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -2121,7 +2121,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
announceActor = \
|
||||
post_json_object['object']['attributedTo']
|
||||
sayStr = 'Undoing announce post by ' + \
|
||||
getNicknameFromActor(announceActor)
|
||||
get_nickname_from_actor(announceActor)
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
system_language, espeak)
|
||||
|
@ -2212,7 +2212,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
followHandle = followHandle[1:]
|
||||
|
||||
if '@' in followHandle or '://' in followHandle:
|
||||
followNickname = getNicknameFromActor(followHandle)
|
||||
followNickname = get_nickname_from_actor(followHandle)
|
||||
followDomain, followPort = \
|
||||
get_domain_from_actor(followHandle)
|
||||
if followNickname and followDomain:
|
||||
|
@ -2248,7 +2248,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if followHandle.startswith('@'):
|
||||
followHandle = followHandle[1:]
|
||||
if '@' in followHandle or '://' in followHandle:
|
||||
followNickname = getNicknameFromActor(followHandle)
|
||||
followNickname = get_nickname_from_actor(followHandle)
|
||||
followDomain, followPort = \
|
||||
get_domain_from_actor(followHandle)
|
||||
if followNickname and followDomain:
|
||||
|
@ -2279,7 +2279,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
approveHandle = approveHandle[1:]
|
||||
|
||||
if '@' in approveHandle or '://' in approveHandle:
|
||||
approveNickname = getNicknameFromActor(approveHandle)
|
||||
approveNickname = get_nickname_from_actor(approveHandle)
|
||||
approveDomain, approvePort = \
|
||||
get_domain_from_actor(approveHandle)
|
||||
if approveNickname and approveDomain:
|
||||
|
@ -2312,7 +2312,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
denyHandle = denyHandle[1:]
|
||||
|
||||
if '@' in denyHandle or '://' in denyHandle:
|
||||
denyNickname = getNicknameFromActor(denyHandle)
|
||||
denyNickname = get_nickname_from_actor(denyHandle)
|
||||
denyDomain, denyPort = \
|
||||
get_domain_from_actor(denyHandle)
|
||||
if denyNickname and denyDomain:
|
||||
|
|
14
epicyon.py
14
epicyon.py
|
@ -72,7 +72,7 @@ from utils import get_full_domain
|
|||
from utils import set_config_param
|
||||
from utils import get_config_param
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import follow_person
|
||||
from utils import validNickname
|
||||
from utils import get_protocol_prefixes
|
||||
|
@ -702,7 +702,7 @@ if args.posts:
|
|||
print('originDomain: ' + str(originDomain))
|
||||
if '@' not in args.posts:
|
||||
if '/users/' in args.posts:
|
||||
postsNickname = getNicknameFromActor(args.posts)
|
||||
postsNickname = get_nickname_from_actor(args.posts)
|
||||
postsDomain, postsPort = get_domain_from_actor(args.posts)
|
||||
args.posts = \
|
||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||
|
@ -736,7 +736,7 @@ if args.posts:
|
|||
if args.postDomains:
|
||||
if '@' not in args.postDomains:
|
||||
if '/users/' in args.postDomains:
|
||||
postsNickname = getNicknameFromActor(args.postDomains)
|
||||
postsNickname = get_nickname_from_actor(args.postDomains)
|
||||
postsDomain, postsPort = get_domain_from_actor(args.postDomains)
|
||||
args.postDomains = \
|
||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||
|
@ -787,7 +787,7 @@ if args.postDomainsBlocked:
|
|||
# given handle but which are globally blocked on this instance
|
||||
if '@' not in args.postDomainsBlocked:
|
||||
if '/users/' in args.postDomainsBlocked:
|
||||
postsNickname = getNicknameFromActor(args.postDomainsBlocked)
|
||||
postsNickname = get_nickname_from_actor(args.postDomainsBlocked)
|
||||
postsDomain, postsPort = \
|
||||
get_domain_from_actor(args.postDomainsBlocked)
|
||||
args.postDomainsBlocked = \
|
||||
|
@ -834,7 +834,7 @@ if args.checkDomains:
|
|||
# given handle but which are globally blocked on this instance
|
||||
if '@' not in args.checkDomains:
|
||||
if '/users/' in args.checkDomains:
|
||||
postsNickname = getNicknameFromActor(args.posts)
|
||||
postsNickname = get_nickname_from_actor(args.posts)
|
||||
postsDomain, postsPort = get_domain_from_actor(args.posts)
|
||||
args.checkDomains = \
|
||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||
|
@ -1879,7 +1879,7 @@ if args.follow:
|
|||
sys.exit()
|
||||
args.password = args.password.replace('\n', '')
|
||||
|
||||
followNickname = getNicknameFromActor(args.follow)
|
||||
followNickname = get_nickname_from_actor(args.follow)
|
||||
if not followNickname:
|
||||
print('Unable to find nickname in ' + args.follow)
|
||||
sys.exit()
|
||||
|
@ -1925,7 +1925,7 @@ if args.unfollow:
|
|||
sys.exit()
|
||||
args.password = args.password.replace('\n', '')
|
||||
|
||||
followNickname = getNicknameFromActor(args.unfollow)
|
||||
followNickname = get_nickname_from_actor(args.unfollow)
|
||||
if not followNickname:
|
||||
print('WARN: unable to find nickname in ' + args.unfollow)
|
||||
sys.exit()
|
||||
|
|
11
follow.py
11
follow.py
|
@ -18,7 +18,7 @@ from utils import get_followers_list
|
|||
from utils import validNickname
|
||||
from utils import domain_permitted
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_status_number
|
||||
from utils import follow_person
|
||||
from posts import sendSignedJson
|
||||
|
@ -178,7 +178,7 @@ def isFollowingActor(base_dir: str,
|
|||
return False
|
||||
if actor.lower() in open(followingFile).read().lower():
|
||||
return True
|
||||
followingNickname = getNicknameFromActor(actor)
|
||||
followingNickname = get_nickname_from_actor(actor)
|
||||
if not followingNickname:
|
||||
print('WARN: unable to find nickname in ' + actor)
|
||||
return False
|
||||
|
@ -1341,7 +1341,7 @@ def getFollowersOfActor(base_dir: str, actor: str, debug: bool) -> {}:
|
|||
recipientsDict = {}
|
||||
if ':' not in actor:
|
||||
return recipientsDict
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
if not nickname:
|
||||
if debug:
|
||||
print('DEBUG: no nickname found in ' + actor)
|
||||
|
@ -1398,7 +1398,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
|
|||
if debug:
|
||||
print('DEBUG: undo follow arrived in outbox')
|
||||
|
||||
nicknameFollower = getNicknameFromActor(message_json['object']['actor'])
|
||||
nicknameFollower = get_nickname_from_actor(message_json['object']['actor'])
|
||||
if not nicknameFollower:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['actor'])
|
||||
|
@ -1407,7 +1407,8 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
|
|||
get_domain_from_actor(message_json['object']['actor'])
|
||||
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
||||
|
||||
nicknameFollowing = getNicknameFromActor(message_json['object']['object'])
|
||||
nicknameFollowing = \
|
||||
get_nickname_from_actor(message_json['object']['object'])
|
||||
if not nicknameFollowing:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['object'])
|
||||
|
|
34
inbox.py
34
inbox.py
|
@ -50,7 +50,7 @@ from utils import url_permitted
|
|||
from utils import create_inbox_queue_dir
|
||||
from utils import get_status_number
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import locate_post
|
||||
from utils import deletePost
|
||||
from utils import removeModerationPostFromIndex
|
||||
|
@ -476,7 +476,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
|||
if not isinstance(post_json_object['actor'], str):
|
||||
return None
|
||||
actor = post_json_object['actor']
|
||||
postNickname = getNicknameFromActor(post_json_object['actor'])
|
||||
postNickname = get_nickname_from_actor(post_json_object['actor'])
|
||||
if not postNickname:
|
||||
print('No post Nickname in actor ' + post_json_object['actor'])
|
||||
return None
|
||||
|
@ -508,7 +508,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
|||
return None
|
||||
else:
|
||||
replyNickname = \
|
||||
getNicknameFromActor(inReplyTo)
|
||||
get_nickname_from_actor(inReplyTo)
|
||||
if replyNickname and replyDomain:
|
||||
if isBlocked(base_dir, nickname, domain,
|
||||
replyNickname, replyDomain,
|
||||
|
@ -758,7 +758,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
|||
return False
|
||||
|
||||
nicknameFollower = \
|
||||
getNicknameFromActor(message_json['object']['actor'])
|
||||
get_nickname_from_actor(message_json['object']['actor'])
|
||||
if not nicknameFollower:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['actor'])
|
||||
|
@ -768,7 +768,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
|||
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
||||
|
||||
nicknameFollowing = \
|
||||
getNicknameFromActor(message_json['object']['object'])
|
||||
get_nickname_from_actor(message_json['object']['object'])
|
||||
if not nicknameFollowing:
|
||||
print('WARN: unable to find nickname in ' +
|
||||
message_json['object']['object'])
|
||||
|
@ -975,7 +975,7 @@ def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
|
|||
message_json['object'].get('id'):
|
||||
if debug:
|
||||
print('Request to update actor: ' + str(message_json))
|
||||
updateNickname = getNicknameFromActor(message_json['actor'])
|
||||
updateNickname = get_nickname_from_actor(message_json['actor'])
|
||||
if updateNickname:
|
||||
updateDomain, updatePort = \
|
||||
get_domain_from_actor(message_json['actor'])
|
||||
|
@ -1872,7 +1872,7 @@ def _receiveAnnounce(recent_posts_cache: {},
|
|||
|
||||
# is the announce actor blocked?
|
||||
nickname = handle.split('@')[0]
|
||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||
actorNickname = get_nickname_from_actor(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: ' +
|
||||
|
@ -1880,7 +1880,7 @@ def _receiveAnnounce(recent_posts_cache: {},
|
|||
return False
|
||||
|
||||
# also check the actor for the url being announced
|
||||
announcedActorNickname = getNicknameFromActor(message_json['object'])
|
||||
announcedActorNickname = get_nickname_from_actor(message_json['object'])
|
||||
announcedActorDomain, announcedActorPort = \
|
||||
get_domain_from_actor(message_json['object'])
|
||||
if isBlocked(base_dir, nickname, domain,
|
||||
|
@ -2141,7 +2141,7 @@ def populateReplies(base_dir: str, http_prefix: str, domain: str,
|
|||
print(replyTo)
|
||||
print('Expected: ' + http_prefix + '://' + domain + '/')
|
||||
return False
|
||||
replyToNickname = getNicknameFromActor(replyTo)
|
||||
replyToNickname = get_nickname_from_actor(replyTo)
|
||||
if not replyToNickname:
|
||||
print('DEBUG: no nickname found for ' + replyTo)
|
||||
return False
|
||||
|
@ -2453,7 +2453,7 @@ def _likeNotify(base_dir: str, domain: str, onion_domain: str,
|
|||
if '##sent##' not in open(likeFile).read():
|
||||
return
|
||||
|
||||
likerNickname = getNicknameFromActor(actor)
|
||||
likerNickname = get_nickname_from_actor(actor)
|
||||
likerDomain, likerPort = get_domain_from_actor(actor)
|
||||
if likerNickname and likerDomain:
|
||||
likerHandle = likerNickname + '@' + likerDomain
|
||||
|
@ -2515,7 +2515,7 @@ def _reactionNotify(base_dir: str, domain: str, onion_domain: str,
|
|||
if '##sent##' not in open(reactionFile).read():
|
||||
return
|
||||
|
||||
reactionNickname = getNicknameFromActor(actor)
|
||||
reactionNickname = get_nickname_from_actor(actor)
|
||||
reactionDomain, reactionPort = get_domain_from_actor(actor)
|
||||
if reactionNickname and reactionDomain:
|
||||
reactionHandle = reactionNickname + '@' + reactionDomain
|
||||
|
@ -2704,7 +2704,7 @@ def _inboxUpdateCalendar(base_dir: str, handle: str,
|
|||
return
|
||||
|
||||
actor = post_json_object['actor']
|
||||
actorNickname = getNicknameFromActor(actor)
|
||||
actorNickname = get_nickname_from_actor(actor)
|
||||
actorDomain, actorPort = get_domain_from_actor(actor)
|
||||
handleNickname = handle.split('@')[0]
|
||||
handleDomain = handle.split('@')[1]
|
||||
|
@ -2918,7 +2918,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
|||
return False
|
||||
sendingActor = post_json_object['actor']
|
||||
sendingActorNickname = \
|
||||
getNicknameFromActor(sendingActor)
|
||||
get_nickname_from_actor(sendingActor)
|
||||
if not sendingActorNickname:
|
||||
return False
|
||||
sendingActorDomain, sendingActorPort = \
|
||||
|
@ -3144,7 +3144,7 @@ def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
|
|||
attributedTo = jsonObj['attributedTo']
|
||||
if not isinstance(attributedTo, str):
|
||||
return
|
||||
fromNickname = getNicknameFromActor(attributedTo)
|
||||
fromNickname = get_nickname_from_actor(attributedTo)
|
||||
fromDomain, fromPort = get_domain_from_actor(attributedTo)
|
||||
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
||||
if notifyWhenPersonPosts(base_dir, nickname, domain,
|
||||
|
@ -3172,7 +3172,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
|
|||
attributedTo = jsonObj['attributedTo']
|
||||
if not isinstance(attributedTo, str):
|
||||
return 0
|
||||
fromNickname = getNicknameFromActor(attributedTo)
|
||||
fromNickname = get_nickname_from_actor(attributedTo)
|
||||
fromDomain, fromPort = get_domain_from_actor(attributedTo)
|
||||
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
||||
if receiveGitPatch(base_dir, nickname, domain,
|
||||
|
@ -3885,7 +3885,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: follower from domain not permitted - ' + domain)
|
||||
return False
|
||||
nickname = getNicknameFromActor(message_json['actor'])
|
||||
nickname = get_nickname_from_actor(message_json['actor'])
|
||||
if not nickname:
|
||||
# single user instance
|
||||
nickname = 'dev'
|
||||
|
@ -3905,7 +3905,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
print('DEBUG: follow domain not permitted ' + domainToFollow)
|
||||
return True
|
||||
domainToFollowFull = get_full_domain(domainToFollow, tempPort)
|
||||
nicknameToFollow = getNicknameFromActor(message_json['object'])
|
||||
nicknameToFollow = get_nickname_from_actor(message_json['object'])
|
||||
if not nicknameToFollow:
|
||||
if debug:
|
||||
print('DEBUG: follow request does not contain a ' +
|
||||
|
|
6
like.py
6
like.py
|
@ -18,7 +18,7 @@ from utils import has_users_path
|
|||
from utils import get_full_domain
|
||||
from utils import remove_id_ending
|
||||
from utils import url_permitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import undoLikesCollectionEntry
|
||||
|
@ -104,12 +104,12 @@ def _like(recent_posts_cache: {},
|
|||
likedPostPort = None
|
||||
group_account = False
|
||||
if actorLiked:
|
||||
likedPostNickname = getNicknameFromActor(actorLiked)
|
||||
likedPostNickname = get_nickname_from_actor(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)
|
||||
likedPostNickname = get_nickname_from_actor(objectUrl)
|
||||
likedPostDomain, likedPostPort = get_domain_from_actor(objectUrl)
|
||||
if '/' + str(likedPostNickname) + '/' in objectUrl:
|
||||
actorLiked = \
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Core"
|
|||
|
||||
import os
|
||||
from utils import is_account_dir
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import acct_dir
|
||||
from utils import has_group_type
|
||||
|
@ -96,7 +96,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
|||
return ctr
|
||||
if '.' not in movedToUrl:
|
||||
return ctr
|
||||
movedToNickname = getNicknameFromActor(movedToUrl)
|
||||
movedToNickname = get_nickname_from_actor(movedToUrl)
|
||||
if not movedToNickname:
|
||||
return ctr
|
||||
movedToDomain, movedToPort = get_domain_from_actor(movedToUrl)
|
||||
|
|
14
posts.py
14
posts.py
|
@ -54,7 +54,7 @@ from utils import is_evil
|
|||
from utils import get_status_number
|
||||
from utils import create_person_dir
|
||||
from utils import url_permitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import deletePost
|
||||
from utils import validNickname
|
||||
|
@ -1339,7 +1339,7 @@ def getActorFromInReplyTo(inReplyTo: str) -> str:
|
|||
"""Tries to get the replied to actor from the inReplyTo post id
|
||||
Note: this will not always be successful for some instance types
|
||||
"""
|
||||
replyNickname = getNicknameFromActor(inReplyTo)
|
||||
replyNickname = get_nickname_from_actor(inReplyTo)
|
||||
if not replyNickname:
|
||||
return None
|
||||
replyActor = None
|
||||
|
@ -2952,7 +2952,7 @@ def _sendToNamedAddresses(session, base_dir: str,
|
|||
# this is after the message has arrived at the server
|
||||
client_to_server = False
|
||||
for address in recipients:
|
||||
toNickname = getNicknameFromActor(address)
|
||||
toNickname = get_nickname_from_actor(address)
|
||||
if not toNickname:
|
||||
continue
|
||||
toDomain, toPort = get_domain_from_actor(address)
|
||||
|
@ -4570,7 +4570,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
|||
asHeader = {
|
||||
'Accept': acceptStr
|
||||
}
|
||||
actorNickname = getNicknameFromActor(post_json_object['actor'])
|
||||
actorNickname = get_nickname_from_actor(post_json_object['actor'])
|
||||
actorDomain, actorPort = \
|
||||
get_domain_from_actor(post_json_object['actor'])
|
||||
if not actorDomain:
|
||||
|
@ -4582,7 +4582,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
|||
print('Announce download blocked actor: ' +
|
||||
actorNickname + '@' + actorDomain)
|
||||
return None
|
||||
objectNickname = getNicknameFromActor(post_json_object['object'])
|
||||
objectNickname = get_nickname_from_actor(post_json_object['object'])
|
||||
objectDomain, objectPort = \
|
||||
get_domain_from_actor(post_json_object['object'])
|
||||
if not objectDomain:
|
||||
|
@ -4724,7 +4724,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
|||
announcedJson['object']['id'] = post_json_object['object']
|
||||
# check that the repeat isn't for a blocked account
|
||||
attributedNickname = \
|
||||
getNicknameFromActor(announcedJson['object']['id'])
|
||||
get_nickname_from_actor(announcedJson['object']['id'])
|
||||
attributedDomain, attributedPort = \
|
||||
get_domain_from_actor(announcedJson['object']['id'])
|
||||
if attributedNickname and attributedDomain:
|
||||
|
@ -5305,7 +5305,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
|
|||
# we don't have the original post
|
||||
if has_users_path(origPostId):
|
||||
# get the actor from the original post url
|
||||
origNick = getNicknameFromActor(origPostId)
|
||||
origNick = get_nickname_from_actor(origPostId)
|
||||
origDomain, origPort = get_domain_from_actor(origPostId)
|
||||
if origNick and origDomain:
|
||||
actor = \
|
||||
|
|
|
@ -20,7 +20,7 @@ from utils import has_users_path
|
|||
from utils import get_full_domain
|
||||
from utils import remove_id_ending
|
||||
from utils import url_permitted
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import undoReactionCollectionEntry
|
||||
|
@ -101,13 +101,13 @@ def _reaction(recent_posts_cache: {},
|
|||
reactionPostPort = None
|
||||
group_account = False
|
||||
if actorReaction:
|
||||
reactionPostNickname = getNicknameFromActor(actorReaction)
|
||||
reactionPostNickname = get_nickname_from_actor(actorReaction)
|
||||
reactionPostDomain, reactionPostPort = \
|
||||
get_domain_from_actor(actorReaction)
|
||||
group_account = has_group_type(base_dir, actorReaction, person_cache)
|
||||
else:
|
||||
if has_users_path(objectUrl):
|
||||
reactionPostNickname = getNicknameFromActor(objectUrl)
|
||||
reactionPostNickname = get_nickname_from_actor(objectUrl)
|
||||
reactionPostDomain, reactionPostPort = \
|
||||
get_domain_from_actor(objectUrl)
|
||||
if '/' + str(reactionPostNickname) + '/' in objectUrl:
|
||||
|
@ -533,7 +533,7 @@ def htmlEmojiReactions(post_json_object: {}, interactive: bool,
|
|||
for item in post_json_object['object']['reactions']['items']:
|
||||
emojiContent = item['content']
|
||||
emojiActor = item['actor']
|
||||
emojiNickname = getNicknameFromActor(emojiActor)
|
||||
emojiNickname = get_nickname_from_actor(emojiActor)
|
||||
emojiDomain, _ = get_domain_from_actor(emojiActor)
|
||||
emojiHandle = emojiNickname + '@' + emojiDomain
|
||||
if emojiActor == actor:
|
||||
|
|
|
@ -14,7 +14,7 @@ from posts import getPersonBox
|
|||
from session import postJson
|
||||
from utils import has_object_string
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import load_json
|
||||
from utils import get_occupation_skills
|
||||
|
@ -157,7 +157,7 @@ def outboxSkills(base_dir: str, nickname: str, message_json: {},
|
|||
if not has_object_string(message_json, debug):
|
||||
return False
|
||||
|
||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||
actorNickname = get_nickname_from_actor(message_json['actor'])
|
||||
if actorNickname != nickname:
|
||||
return False
|
||||
domain, port = get_domain_from_actor(message_json['actor'])
|
||||
|
|
|
@ -16,7 +16,7 @@ from utils import is_dm
|
|||
from utils import is_reply
|
||||
from utils import camel_case_split
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_gender_from_bio
|
||||
from utils import get_display_name
|
||||
from utils import remove_html
|
||||
|
@ -479,7 +479,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
|||
gender = get_gender_from_bio(base_dir, post_json_object['actor'],
|
||||
person_cache, translate)
|
||||
if announcingActor:
|
||||
announcedNickname = getNicknameFromActor(announcingActor)
|
||||
announcedNickname = get_nickname_from_actor(announcingActor)
|
||||
announcedDomain, announcedport = get_domain_from_actor(announcingActor)
|
||||
if announcedNickname and announcedDomain:
|
||||
announcedHandle = announcedNickname + '@' + announcedDomain
|
||||
|
|
16
tests.py
16
tests.py
|
@ -75,7 +75,7 @@ from utils import first_paragraph_from_string
|
|||
from utils import remove_id_ending
|
||||
from utils import updateRecentPostsCache
|
||||
from utils import follow_person
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import copytree
|
||||
from utils import load_json
|
||||
|
@ -3239,44 +3239,44 @@ def _testActorParsing():
|
|||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'mydomain'
|
||||
assert port == 72
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'mynick'
|
||||
|
||||
actor = 'https://element/accounts/badger'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'element'
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'badger'
|
||||
|
||||
actor = 'egg@chicken.com'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'chicken.com'
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'egg'
|
||||
|
||||
actor = '@waffle@cardboard'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'cardboard'
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'waffle'
|
||||
|
||||
actor = 'https://astral/channel/sky'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'astral'
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'sky'
|
||||
|
||||
actor = 'https://randomain/users/rando'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'randomain'
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'rando'
|
||||
|
||||
actor = 'https://otherdomain:49/@othernick'
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
assert domain == 'otherdomain'
|
||||
assert port == 49
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
assert nickname == 'othernick'
|
||||
|
||||
|
||||
|
|
54
utils.py
54
utils.py
|
@ -963,48 +963,48 @@ def get_gender_from_bio(base_dir: str, actor: str, person_cache: {},
|
|||
"""Tries to ascertain gender from bio description
|
||||
This is for use by text-to-speech for pitch setting
|
||||
"""
|
||||
defaultGender = 'They/Them'
|
||||
default_gender = 'They/Them'
|
||||
if '/statuses/' in actor:
|
||||
actor = actor.split('/statuses/')[0]
|
||||
if not person_cache.get(actor):
|
||||
return defaultGender
|
||||
bioFound = None
|
||||
return default_gender
|
||||
bio_found = None
|
||||
if translate:
|
||||
pronounStr = translate['pronoun'].lower()
|
||||
pronoun_str = translate['pronoun'].lower()
|
||||
else:
|
||||
pronounStr = 'pronoun'
|
||||
pronoun_str = 'pronoun'
|
||||
actor_json = None
|
||||
if person_cache[actor].get('actor'):
|
||||
actor_json = person_cache[actor]['actor']
|
||||
else:
|
||||
# Try to obtain from the cached actors
|
||||
cachedActorFilename = \
|
||||
cached_actor_filename = \
|
||||
base_dir + '/cache/actors/' + (actor.replace('/', '#')) + '.json'
|
||||
if os.path.isfile(cachedActorFilename):
|
||||
actor_json = load_json(cachedActorFilename, 1)
|
||||
if os.path.isfile(cached_actor_filename):
|
||||
actor_json = load_json(cached_actor_filename, 1)
|
||||
if not actor_json:
|
||||
return defaultGender
|
||||
return default_gender
|
||||
# is gender defined as a profile tag?
|
||||
if actor_json.get('attachment'):
|
||||
tagsList = actor_json['attachment']
|
||||
if isinstance(tagsList, list):
|
||||
tags_list = actor_json['attachment']
|
||||
if isinstance(tags_list, list):
|
||||
# look for a gender field name
|
||||
for tag in tagsList:
|
||||
for tag in tags_list:
|
||||
if not isinstance(tag, dict):
|
||||
continue
|
||||
if not tag.get('name') or not tag.get('value'):
|
||||
continue
|
||||
if tag['name'].lower() == \
|
||||
translate['gender'].lower():
|
||||
bioFound = tag['value']
|
||||
bio_found = tag['value']
|
||||
break
|
||||
elif tag['name'].lower().startswith(pronounStr):
|
||||
bioFound = tag['value']
|
||||
if tag['name'].lower().startswith(pronoun_str):
|
||||
bio_found = tag['value']
|
||||
break
|
||||
# the field name could be anything,
|
||||
# just look at the value
|
||||
if not bioFound:
|
||||
for tag in tagsList:
|
||||
if not bio_found:
|
||||
for tag in tags_list:
|
||||
if not isinstance(tag, dict):
|
||||
continue
|
||||
if not tag.get('name') or not tag.get('value'):
|
||||
|
@ -1013,17 +1013,17 @@ def get_gender_from_bio(base_dir: str, actor: str, person_cache: {},
|
|||
if gender:
|
||||
return gender
|
||||
# if not then use the bio
|
||||
if not bioFound and actor_json.get('summary'):
|
||||
bioFound = actor_json['summary']
|
||||
if not bioFound:
|
||||
return defaultGender
|
||||
gender = _gender_from_string(translate, bioFound)
|
||||
if not bio_found and actor_json.get('summary'):
|
||||
bio_found = actor_json['summary']
|
||||
if not bio_found:
|
||||
return default_gender
|
||||
gender = _gender_from_string(translate, bio_found)
|
||||
if not gender:
|
||||
gender = defaultGender
|
||||
gender = default_gender
|
||||
return gender
|
||||
|
||||
|
||||
def getNicknameFromActor(actor: str) -> str:
|
||||
def get_nickname_from_actor(actor: str) -> str:
|
||||
"""Returns the nickname from an actor url
|
||||
"""
|
||||
if actor.startswith('@'):
|
||||
|
@ -2224,7 +2224,7 @@ def undoLikesCollectionEntry(recent_posts_cache: {},
|
|||
return
|
||||
# remove any cached version of this post so that the
|
||||
# like icon is changed
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
cached_post_filename = \
|
||||
get_cached_post_filename(base_dir, nickname,
|
||||
domain, post_json_object)
|
||||
|
@ -2290,7 +2290,7 @@ def undoReactionCollectionEntry(recent_posts_cache: {},
|
|||
return
|
||||
# remove any cached version of this post so that the
|
||||
# like icon is changed
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
cached_post_filename = \
|
||||
get_cached_post_filename(base_dir, nickname,
|
||||
domain, post_json_object)
|
||||
|
@ -2357,7 +2357,7 @@ def undo_announce_collection_entry(recent_posts_cache: {},
|
|||
return
|
||||
# remove any cached version of this announce so that the announce
|
||||
# icon is changed
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
cached_post_filename = \
|
||||
get_cached_post_filename(base_dir, nickname, domain,
|
||||
post_json_object)
|
||||
|
|
4
video.py
4
video.py
|
@ -8,7 +8,7 @@ __status__ = "Production"
|
|||
__module_group__ = "Timeline"
|
||||
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import remove_id_ending
|
||||
from blocking import isBlocked
|
||||
|
@ -61,7 +61,7 @@ def convertVideoToNote(base_dir: str, nickname: str, domain: str,
|
|||
postLanguage = post_json_object['language']['identifier']
|
||||
|
||||
# check that the attributed actor is not blocked
|
||||
postNickname = getNicknameFromActor(attributedTo)
|
||||
postNickname = get_nickname_from_actor(attributedTo)
|
||||
if not postNickname:
|
||||
return None
|
||||
postDomain, postDomainPort = get_domain_from_actor(attributedTo)
|
||||
|
|
|
@ -12,7 +12,7 @@ from datetime import datetime
|
|||
from datetime import date
|
||||
from utils import get_display_name
|
||||
from utils import get_config_param
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import load_json
|
||||
|
@ -38,7 +38,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
|||
dayNumber: int, calling_domain: str) -> str:
|
||||
"""Shows a screen asking to confirm the deletion of a calendar event
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
messageId = actor + '/statuses/' + post_id
|
||||
|
@ -282,7 +282,7 @@ def htmlCalendar(person_cache: {}, cssCache: {}, translate: {},
|
|||
year = currDate.year
|
||||
monthNumber = currDate.month
|
||||
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
|
||||
setCustomBackground(base_dir, 'calendar-background', 'calendar-background')
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Web Interface Columns"
|
|||
|
||||
import os
|
||||
from utils import get_config_param
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import is_editor
|
||||
from utils import is_artist
|
||||
from utils import remove_domain_port
|
||||
|
@ -424,7 +424,7 @@ def htmlEditLinks(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
path = path.replace('/inbox', '').replace('/outbox', '')
|
||||
path = path.replace('/shares', '').replace('/wanted', '')
|
||||
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ from utils import remove_html
|
|||
from utils import locate_post
|
||||
from utils import load_json
|
||||
from utils import votesOnNewswireItem
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import is_editor
|
||||
from utils import get_config_param
|
||||
from utils import remove_domain_port
|
||||
|
@ -530,7 +530,7 @@ def htmlEditNewswire(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
path = path.replace('/inbox', '').replace('/outbox', '')
|
||||
path = path.replace('/shares', '').replace('/wanted', '')
|
||||
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
|
||||
|
@ -651,7 +651,7 @@ def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
return ''
|
||||
pathOriginal = path
|
||||
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
|
|||
import os
|
||||
from shutil import copyfile
|
||||
from utils import get_full_domain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import locate_post
|
||||
from utils import load_json
|
||||
|
@ -43,7 +43,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
if '/statuses/' not in messageId:
|
||||
return None
|
||||
actor = messageId.split('/statuses/')[0]
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
||||
|
@ -112,7 +112,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
|||
sharesFileType: str) -> str:
|
||||
"""Shows a screen asking to confirm the removal of a shared item
|
||||
"""
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
domain, port = get_domain_from_actor(actor)
|
||||
domain_full = get_full_domain(domain, port)
|
||||
sharesFile = \
|
||||
|
@ -200,7 +200,7 @@ def htmlConfirmFollow(cssCache: {}, translate: {}, base_dir: str,
|
|||
followStr += ' <img loading="lazy" src="' + followProfileUrl + '"/></a>\n'
|
||||
followStr += \
|
||||
' <p class="followText">' + translate['Follow'] + ' ' + \
|
||||
getNicknameFromActor(followActor) + '@' + followDomain + ' ?</p>\n'
|
||||
get_nickname_from_actor(followActor) + '@' + followDomain + ' ?</p>\n'
|
||||
followStr += ' <form method="POST" action="' + \
|
||||
originPathStr + '/followconfirm">\n'
|
||||
followStr += ' <input type="hidden" name="actor" value="' + \
|
||||
|
@ -245,7 +245,7 @@ def htmlConfirmUnfollow(cssCache: {}, translate: {}, base_dir: str,
|
|||
followStr += ' <img loading="lazy" src="' + followProfileUrl + '"/></a>\n'
|
||||
followStr += \
|
||||
' <p class="followText">' + translate['Stop following'] + \
|
||||
' ' + getNicknameFromActor(followActor) + \
|
||||
' ' + get_nickname_from_actor(followActor) + \
|
||||
'@' + followDomain + ' ?</p>\n'
|
||||
followStr += ' <form method="POST" action="' + \
|
||||
originPathStr + '/unfollowconfirm">\n'
|
||||
|
@ -288,7 +288,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, base_dir: str,
|
|||
blockStr += ' <img loading="lazy" src="' + blockProfileUrl + '"/></a>\n'
|
||||
blockStr += \
|
||||
' <p class="blockText">' + translate['Stop blocking'] + ' ' + \
|
||||
getNicknameFromActor(blockActor) + '@' + blockDomain + ' ?</p>\n'
|
||||
get_nickname_from_actor(blockActor) + '@' + blockDomain + ' ?</p>\n'
|
||||
blockStr += ' <form method="POST" action="' + \
|
||||
originPathStr + '/unblockconfirm">\n'
|
||||
blockStr += ' <input type="hidden" name="actor" value="' + \
|
||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
|
|||
import os
|
||||
from utils import get_new_post_endpoints
|
||||
from utils import isPublicPostFromUrl
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import get_media_formats
|
||||
from utils import get_config_param
|
||||
|
@ -651,7 +651,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
|
|||
|
||||
mentionsStr = ''
|
||||
for m in mentions:
|
||||
mentionNickname = getNicknameFromActor(m)
|
||||
mentionNickname = get_nickname_from_actor(m)
|
||||
if not mentionNickname:
|
||||
continue
|
||||
mentionDomain, mentionPort = get_domain_from_actor(m)
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Web Interface"
|
|||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_config_param
|
||||
from categories import getHashtagCategories
|
||||
from categories import getHashtagCategory
|
||||
|
@ -199,7 +199,7 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
|||
"""
|
||||
actor = path.split('/category/')[0]
|
||||
categoryStr = path.split('/category/')[1].strip()
|
||||
searchNickname = getNicknameFromActor(actor)
|
||||
searchNickname = get_nickname_from_actor(actor)
|
||||
|
||||
setCustomBackground(base_dir, 'search-background', 'follow-background')
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from utils import is_account_dir
|
|||
from utils import get_full_domain
|
||||
from utils import is_editor
|
||||
from utils import load_json
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import get_config_param
|
||||
from utils import local_actor_url
|
||||
|
@ -103,7 +103,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
get_config_param(base_dir, 'instanceTitle')
|
||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
searchNickname = getNicknameFromActor(searchHandle)
|
||||
searchNickname = get_nickname_from_actor(searchHandle)
|
||||
searchDomain, searchPort = get_domain_from_actor(searchHandle)
|
||||
|
||||
searchHandle = searchNickname + '@' + searchDomain
|
||||
|
@ -141,7 +141,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
http_prefix, searchActor, 1, 5, debug)
|
||||
blockedFollowers = []
|
||||
for followerActor in followersList:
|
||||
followerNickname = getNicknameFromActor(followerActor)
|
||||
followerNickname = get_nickname_from_actor(followerActor)
|
||||
followerDomain, followerPort = get_domain_from_actor(followerActor)
|
||||
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
||||
if isBlocked(base_dir, nickname, domain,
|
||||
|
@ -155,7 +155,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
http_prefix, searchActor, 1, 5, debug)
|
||||
blockedFollowing = []
|
||||
for followingActor in followingList:
|
||||
followingNickname = getNicknameFromActor(followingActor)
|
||||
followingNickname = get_nickname_from_actor(followingActor)
|
||||
followingDomain, followingPort = get_domain_from_actor(followingActor)
|
||||
followingDomainFull = get_full_domain(followingDomain, followingPort)
|
||||
if isBlocked(base_dir, nickname, domain,
|
||||
|
@ -216,7 +216,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
translate['Receives posts from the following accounts'] + \
|
||||
':</p>\n'
|
||||
for actor in blockedFollowing:
|
||||
followingNickname = getNicknameFromActor(actor)
|
||||
followingNickname = get_nickname_from_actor(actor)
|
||||
followingDomain, followingPort = get_domain_from_actor(actor)
|
||||
followingDomainFull = \
|
||||
get_full_domain(followingDomain, followingPort)
|
||||
|
@ -235,7 +235,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
translate['Sends out posts to the following accounts'] + \
|
||||
':</p>\n'
|
||||
for actor in blockedFollowers:
|
||||
followerNickname = getNicknameFromActor(actor)
|
||||
followerNickname = get_nickname_from_actor(actor)
|
||||
followerDomain, followerPort = get_domain_from_actor(actor)
|
||||
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
||||
infoForm += '<a href="' + actor + '" ' + \
|
||||
|
|
|
@ -17,7 +17,7 @@ from utils import get_config_param
|
|||
from utils import is_dormant
|
||||
from utils import remove_html
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import is_featured_writer
|
||||
from utils import acct_dir
|
||||
from blocking import isBlocked
|
||||
|
@ -96,7 +96,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
is_dormant(base_dir, nickname, domain, optionsActor,
|
||||
dormant_months)
|
||||
|
||||
optionsNickname = getNicknameFromActor(optionsActor)
|
||||
optionsNickname = get_nickname_from_actor(optionsActor)
|
||||
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
||||
followsYou = \
|
||||
isFollowerOfPerson(base_dir,
|
||||
|
@ -139,7 +139,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
optionsStr += ' <a href="' + optionsActor + '">\n'
|
||||
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + \
|
||||
'" alt="" ' + getBrokenLinkSubstitute() + '/></a>\n'
|
||||
handle = getNicknameFromActor(optionsActor) + '@' + optionsDomain
|
||||
handle = get_nickname_from_actor(optionsActor) + '@' + optionsDomain
|
||||
handleShown = handle
|
||||
if lockedAccount:
|
||||
handleShown += '🔒'
|
||||
|
@ -154,7 +154,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
optionsStr += \
|
||||
' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
|
||||
if movedTo:
|
||||
newNickname = getNicknameFromActor(movedTo)
|
||||
newNickname = get_nickname_from_actor(movedTo)
|
||||
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||
if newNickname and newDomain:
|
||||
newHandle = newNickname + '@' + newDomain
|
||||
|
|
|
@ -48,7 +48,7 @@ from utils import get_display_name
|
|||
from utils import isPublicPost
|
||||
from utils import updateRecentPostsCache
|
||||
from utils import remove_id_ending
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import acct_dir
|
||||
from utils import local_actor_url
|
||||
|
@ -98,7 +98,7 @@ def _htmlPostMetadataOpenGraph(domain: str, post_json_object: {}) -> str:
|
|||
if objJson.get('attributedTo'):
|
||||
if isinstance(objJson['attributedTo'], str):
|
||||
attrib = objJson['attributedTo']
|
||||
actorNick = getNicknameFromActor(attrib)
|
||||
actorNick = get_nickname_from_actor(attrib)
|
||||
actorDomain, _ = get_domain_from_actor(attrib)
|
||||
actorHandle = actorNick + '@' + actorDomain
|
||||
metadata += \
|
||||
|
@ -398,7 +398,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
|
|||
if post_json_object['object'].get('replyTo'):
|
||||
# check that the alternative replyTo url is not blocked
|
||||
blockNickname = \
|
||||
getNicknameFromActor(post_json_object['object']['replyTo'])
|
||||
get_nickname_from_actor(post_json_object['object']['replyTo'])
|
||||
blockDomain, _ = \
|
||||
get_domain_from_actor(post_json_object['object']['replyTo'])
|
||||
if not isBlocked(base_dir, nickname, domain,
|
||||
|
@ -989,7 +989,7 @@ def _getPostTitleAnnounceHtml(base_dir: str,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '13.2')
|
||||
announceNickname = None
|
||||
if attributedTo:
|
||||
announceNickname = getNicknameFromActor(attributedTo)
|
||||
announceNickname = get_nickname_from_actor(attributedTo)
|
||||
if not announceNickname:
|
||||
titleStr += _announceUnattributedHtml(translate, post_json_object)
|
||||
return (titleStr, replyAvatarImageInPost,
|
||||
|
@ -1168,7 +1168,7 @@ def _getPostTitleReplyHtml(base_dir: str,
|
|||
|
||||
inReplyTo = objJson['inReplyTo']
|
||||
replyActor = inReplyTo.split('/statuses/')[0]
|
||||
replyNickname = getNicknameFromActor(replyActor)
|
||||
replyNickname = get_nickname_from_actor(replyActor)
|
||||
if not replyNickname:
|
||||
titleStr += _replyToUnknownHtml(translate, post_json_object)
|
||||
return (titleStr, replyAvatarImageInPost,
|
||||
|
@ -1425,7 +1425,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
# get the display name
|
||||
if domain_full not in postActor:
|
||||
# lookup the correct webfinger for the postActor
|
||||
postActorNickname = getNicknameFromActor(postActor)
|
||||
postActorNickname = get_nickname_from_actor(postActor)
|
||||
postActorDomain, postActorPort = get_domain_from_actor(postActor)
|
||||
postActorDomainFull = get_full_domain(postActorDomain, postActorPort)
|
||||
postActorHandle = postActorNickname + '@' + postActorDomainFull
|
||||
|
@ -1575,7 +1575,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
containerClass = 'container'
|
||||
containerClassIcons = 'containericons'
|
||||
timeClass = 'time-right'
|
||||
actorNickname = getNicknameFromActor(postActor)
|
||||
actorNickname = get_nickname_from_actor(postActor)
|
||||
if not actorNickname:
|
||||
# single user instance
|
||||
actorNickname = 'dev'
|
||||
|
@ -2025,7 +2025,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
byTextExtra = ' ' + reactEmoji
|
||||
|
||||
if byStr:
|
||||
byStrNickname = getNicknameFromActor(byStr)
|
||||
byStrNickname = get_nickname_from_actor(byStr)
|
||||
byStrDomain, byStrPort = get_domain_from_actor(byStr)
|
||||
byStrDomain = get_full_domain(byStrDomain, byStrPort)
|
||||
byStrHandle = byStrNickname + '@' + byStrDomain
|
||||
|
|
|
@ -18,7 +18,7 @@ from utils import get_locked_account
|
|||
from utils import get_full_domain
|
||||
from utils import is_artist
|
||||
from utils import is_dormant
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import get_domain_from_actor
|
||||
from utils import is_system_account
|
||||
from utils import remove_html
|
||||
|
@ -159,7 +159,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
searchDomain, searchPort = get_domain_from_actor(personUrl)
|
||||
if not searchDomain:
|
||||
return None
|
||||
searchNickname = getNicknameFromActor(personUrl)
|
||||
searchNickname = get_nickname_from_actor(personUrl)
|
||||
if not searchNickname:
|
||||
return None
|
||||
searchDomainFull = get_full_domain(searchDomain, searchPort)
|
||||
|
@ -407,7 +407,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
|||
' <p>' + translate['Joined'] + ' ' + \
|
||||
joinedDate.split('T')[0] + '<br>\n'
|
||||
if movedTo:
|
||||
newNickname = getNicknameFromActor(movedTo)
|
||||
newNickname = get_nickname_from_actor(movedTo)
|
||||
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||
newDomainFull = get_full_domain(newDomain, newPort)
|
||||
if newNickname and newDomain:
|
||||
|
@ -501,7 +501,7 @@ def _getProfileHeaderAfterSearch(base_dir: str,
|
|||
if followsYou:
|
||||
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
|
||||
if movedTo:
|
||||
newNickname = getNicknameFromActor(movedTo)
|
||||
newNickname = get_nickname_from_actor(movedTo)
|
||||
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||
newDomainFull = get_full_domain(newDomain, newPort)
|
||||
if newNickname and newDomain:
|
||||
|
@ -2102,7 +2102,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
"""
|
||||
path = path.replace('/inbox', '').replace('/outbox', '')
|
||||
path = path.replace('/shares', '').replace('/wanted', '')
|
||||
nickname = getNicknameFromActor(path)
|
||||
nickname = get_nickname_from_actor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2353,7 +2353,7 @@ def _individualFollowAsHtml(signing_priv_key_pem: str,
|
|||
buttons=[]) -> str:
|
||||
"""An individual follow entry on the profile screen
|
||||
"""
|
||||
followUrlNickname = getNicknameFromActor(followUrl)
|
||||
followUrlNickname = get_nickname_from_actor(followUrl)
|
||||
followUrlDomain, followUrlPort = get_domain_from_actor(followUrl)
|
||||
followUrlDomainFull = get_full_domain(followUrlDomain, followUrlPort)
|
||||
titleStr = '@' + followUrlNickname + '@' + followUrlDomainFull
|
||||
|
|
|
@ -18,7 +18,7 @@ from utils import get_full_domain
|
|||
from utils import is_editor
|
||||
from utils import load_json
|
||||
from utils import get_domain_from_actor
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import locate_post
|
||||
from utils import isPublicPost
|
||||
from utils import first_paragraph_from_string
|
||||
|
@ -377,7 +377,7 @@ def htmlSearch(cssCache: {}, translate: {},
|
|||
"""Search called from the timeline icon
|
||||
"""
|
||||
actor = path.replace('/search', '')
|
||||
searchNickname = getNicknameFromActor(actor)
|
||||
searchNickname = get_nickname_from_actor(actor)
|
||||
|
||||
setCustomBackground(base_dir, 'search-background', 'follow-background')
|
||||
|
||||
|
@ -820,7 +820,7 @@ def htmlHashtagSearch(cssCache: {},
|
|||
while index <= endIndex:
|
||||
post_id = lines[index].strip('\n').strip('\r')
|
||||
if ' ' not in post_id:
|
||||
nickname = getNicknameFromActor(post_id)
|
||||
nickname = get_nickname_from_actor(post_id)
|
||||
if not nickname:
|
||||
index += 1
|
||||
continue
|
||||
|
@ -941,7 +941,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
|||
for index in range(len(lines)):
|
||||
post_id = lines[index].strip('\n').strip('\r')
|
||||
if ' ' not in post_id:
|
||||
nickname = getNicknameFromActor(post_id)
|
||||
nickname = get_nickname_from_actor(post_id)
|
||||
if not nickname:
|
||||
index += 1
|
||||
if index >= maxFeedLength:
|
||||
|
|
|
@ -18,7 +18,7 @@ from utils import load_json
|
|||
from utils import get_cached_post_filename
|
||||
from utils import get_config_param
|
||||
from utils import acct_dir
|
||||
from utils import getNicknameFromActor
|
||||
from utils import get_nickname_from_actor
|
||||
from utils import is_float
|
||||
from utils import get_audio_extensions
|
||||
from utils import get_video_extensions
|
||||
|
@ -410,7 +410,7 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
|
|||
shareActor = itemID.split('--shareditems--')[0]
|
||||
shareActor = shareActor.replace('___', '://')
|
||||
shareActor = shareActor.replace('--', '/')
|
||||
shareNickname = getNicknameFromActor(shareActor)
|
||||
shareNickname = get_nickname_from_actor(shareActor)
|
||||
if isBlocked(base_dir, nickname, domain,
|
||||
shareNickname, federatedDomain, None):
|
||||
continue
|
||||
|
@ -1466,7 +1466,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
|||
|
||||
# should the remove button be shown?
|
||||
showRemoveButton = False
|
||||
nickname = getNicknameFromActor(actor)
|
||||
nickname = get_nickname_from_actor(actor)
|
||||
if actor.endswith('/users/' + contactNickname):
|
||||
showRemoveButton = True
|
||||
elif isModerator(base_dir, nickname):
|
||||
|
@ -1503,7 +1503,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
sharesJson = None
|
||||
|
||||
shareUrl = itemID.replace('___', '://').replace('--', '/')
|
||||
contactNickname = getNicknameFromActor(shareUrl)
|
||||
contactNickname = get_nickname_from_actor(shareUrl)
|
||||
if not contactNickname:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in New Issue