mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
8988485391
commit
7e3e299873
|
@ -12,7 +12,7 @@ from utils import has_object_string_object
|
||||||
from utils import has_users_path
|
from utils import has_users_path
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import domain_permitted
|
from utils import domain_permitted
|
||||||
from utils import follow_person
|
from utils import follow_person
|
||||||
|
@ -103,7 +103,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
||||||
if not nickname:
|
if not nickname:
|
||||||
print('WARN: no nickname found in ' + this_actor)
|
print('WARN: no nickname found in ' + this_actor)
|
||||||
return
|
return
|
||||||
acceptedDomain, acceptedPort = getDomainFromActor(this_actor)
|
acceptedDomain, acceptedPort = get_domain_from_actor(this_actor)
|
||||||
if not acceptedDomain:
|
if not acceptedDomain:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: domain not found in ' + this_actor)
|
print('DEBUG: domain not found in ' + this_actor)
|
||||||
|
@ -130,7 +130,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
||||||
print('DEBUG: unrecognized actor ' + this_actor)
|
print('DEBUG: unrecognized actor ' + this_actor)
|
||||||
return
|
return
|
||||||
followed_actor = message_json['object']['object']
|
followed_actor = message_json['object']['object']
|
||||||
followed_domain, port = getDomainFromActor(followed_actor)
|
followed_domain, port = get_domain_from_actor(followed_actor)
|
||||||
if not followed_domain:
|
if not followed_domain:
|
||||||
print('DEBUG: no domain found within Follow activity object ' +
|
print('DEBUG: no domain found within Follow activity object ' +
|
||||||
followed_actor)
|
followed_actor)
|
||||||
|
@ -200,7 +200,7 @@ def receiveAcceptReject(session, base_dir: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'] + '. Assuming single user instance.')
|
message_json['type'] + '. Assuming single user instance.')
|
||||||
domain, _ = getDomainFromActor(message_json['actor'])
|
domain, _ = get_domain_from_actor(message_json['actor'])
|
||||||
if not domain_permitted(domain, federation_list):
|
if not domain_permitted(domain, federation_list):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' + message_json['type'] +
|
print('DEBUG: ' + message_json['type'] +
|
||||||
|
|
|
@ -17,7 +17,7 @@ from utils import get_status_number
|
||||||
from utils import create_outbox_dir
|
from utils import create_outbox_dir
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import undo_announce_collection_entry
|
from utils import undo_announce_collection_entry
|
||||||
|
@ -73,7 +73,7 @@ def outboxAnnounce(recent_posts_cache: {},
|
||||||
if not nickname:
|
if not nickname:
|
||||||
print('WARN: no nickname found in ' + message_json['actor'])
|
print('WARN: no nickname found in ' + message_json['actor'])
|
||||||
return False
|
return False
|
||||||
domain, _ = getDomainFromActor(message_json['actor'])
|
domain, _ = get_domain_from_actor(message_json['actor'])
|
||||||
post_filename = locate_post(base_dir, nickname, domain,
|
post_filename = locate_post(base_dir, nickname, domain,
|
||||||
message_json['object'])
|
message_json['object'])
|
||||||
if post_filename:
|
if post_filename:
|
||||||
|
@ -92,7 +92,7 @@ def outboxAnnounce(recent_posts_cache: {},
|
||||||
if not nickname:
|
if not nickname:
|
||||||
print('WARN: no nickname found in ' + message_json['actor'])
|
print('WARN: no nickname found in ' + message_json['actor'])
|
||||||
return False
|
return False
|
||||||
domain, _ = getDomainFromActor(message_json['actor'])
|
domain, _ = get_domain_from_actor(message_json['actor'])
|
||||||
post_filename = locate_post(base_dir, nickname, domain,
|
post_filename = locate_post(base_dir, nickname, domain,
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
if post_filename:
|
if post_filename:
|
||||||
|
@ -167,7 +167,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
||||||
group_account = False
|
group_account = False
|
||||||
if has_users_path(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
announceNickname = getNicknameFromActor(objectUrl)
|
announceNickname = getNicknameFromActor(objectUrl)
|
||||||
announceDomain, announcePort = getDomainFromActor(objectUrl)
|
announceDomain, announcePort = get_domain_from_actor(objectUrl)
|
||||||
if '/' + str(announceNickname) + '/' in objectUrl:
|
if '/' + str(announceNickname) + '/' in objectUrl:
|
||||||
announceActor = \
|
announceActor = \
|
||||||
objectUrl.split('/' + announceNickname + '/')[0] + \
|
objectUrl.split('/' + announceNickname + '/')[0] + \
|
||||||
|
|
|
@ -15,7 +15,7 @@ from session import postJson
|
||||||
from utils import has_object_string
|
from utils import has_object_string
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
|
@ -70,7 +70,7 @@ def outboxAvailability(base_dir: str, nickname: str, message_json: {},
|
||||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||||
if actorNickname != nickname:
|
if actorNickname != nickname:
|
||||||
return False
|
return False
|
||||||
domain, port = getDomainFromActor(message_json['actor'])
|
domain, port = get_domain_from_actor(message_json['actor'])
|
||||||
status = message_json['object'].replace('"', '')
|
status = message_json['object'].replace('"', '')
|
||||||
|
|
||||||
return setAvailability(base_dir, nickname, domain, status)
|
return setAvailability(base_dir, nickname, domain, status)
|
||||||
|
|
|
@ -28,7 +28,7 @@ from utils import remove_id_ending
|
||||||
from utils import is_evil
|
from utils import is_evil
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import evil_incarnate
|
from utils import evil_incarnate
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
|
@ -452,7 +452,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
|
||||||
if not nicknameBlocked:
|
if not nicknameBlocked:
|
||||||
print('WARN: unable to find nickname in ' + message_json['object'])
|
print('WARN: unable to find nickname in ' + message_json['object'])
|
||||||
return False
|
return False
|
||||||
domainBlocked, portBlocked = getDomainFromActor(message_json['object'])
|
domainBlocked, portBlocked = get_domain_from_actor(message_json['object'])
|
||||||
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
|
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
|
||||||
|
|
||||||
addBlock(base_dir, nickname, domain,
|
addBlock(base_dir, nickname, domain,
|
||||||
|
@ -510,7 +510,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return
|
return
|
||||||
domainObject = message_json['object']['object']
|
domainObject = message_json['object']['object']
|
||||||
domainBlocked, portBlocked = getDomainFromActor(domainObject)
|
domainBlocked, portBlocked = get_domain_from_actor(domainObject)
|
||||||
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
|
domainBlockedFull = get_full_domain(domainBlocked, portBlocked)
|
||||||
|
|
||||||
removeBlock(base_dir, nickname, domain,
|
removeBlock(base_dir, nickname, domain,
|
||||||
|
|
4
blog.py
4
blog.py
|
@ -27,7 +27,7 @@ from utils import get_config_param
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import get_media_formats
|
from utils import get_media_formats
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import first_paragraph_from_string
|
from utils import first_paragraph_from_string
|
||||||
|
@ -218,7 +218,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
||||||
actor = post_json_object['object']['attributedTo']
|
actor = post_json_object['object']['attributedTo']
|
||||||
authorNickname = getNicknameFromActor(actor)
|
authorNickname = getNicknameFromActor(actor)
|
||||||
if authorNickname:
|
if authorNickname:
|
||||||
authorDomain, authorPort = getDomainFromActor(actor)
|
authorDomain, authorPort = get_domain_from_actor(actor)
|
||||||
if authorDomain:
|
if authorDomain:
|
||||||
# author must be from the given domain
|
# author must be from the given domain
|
||||||
if restrictToDomain and authorDomain != domain:
|
if restrictToDomain and authorDomain != domain:
|
||||||
|
|
12
bookmarks.py
12
bookmarks.py
|
@ -18,7 +18,7 @@ from utils import remove_id_ending
|
||||||
from utils import remove_post_from_cache
|
from utils import remove_post_from_cache
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
|
@ -286,12 +286,13 @@ def bookmark(recent_posts_cache: {},
|
||||||
if actorBookmarked:
|
if actorBookmarked:
|
||||||
acBm = actorBookmarked
|
acBm = actorBookmarked
|
||||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
|
||||||
else:
|
else:
|
||||||
if has_users_path(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
ou = objectUrl
|
ou = objectUrl
|
||||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
bookmarkedPostDomain, bookmarkedPostPort = \
|
||||||
|
get_domain_from_actor(ou)
|
||||||
|
|
||||||
if bookmarkedPostNickname:
|
if bookmarkedPostNickname:
|
||||||
post_filename = locate_post(base_dir, nickname, domain, objectUrl)
|
post_filename = locate_post(base_dir, nickname, domain, objectUrl)
|
||||||
|
@ -350,12 +351,13 @@ def undoBookmark(recent_posts_cache: {},
|
||||||
if actorBookmarked:
|
if actorBookmarked:
|
||||||
acBm = actorBookmarked
|
acBm = actorBookmarked
|
||||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
bookmarkedPostDomain, bookmarkedPostPort = get_domain_from_actor(acBm)
|
||||||
else:
|
else:
|
||||||
if has_users_path(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
ou = objectUrl
|
ou = objectUrl
|
||||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
bookmarkedPostDomain, bookmarkedPostPort = \
|
||||||
|
get_domain_from_actor(ou)
|
||||||
|
|
||||||
if bookmarkedPostNickname:
|
if bookmarkedPostNickname:
|
||||||
post_filename = locate_post(base_dir, nickname, domain, objectUrl)
|
post_filename = locate_post(base_dir, nickname, domain, objectUrl)
|
||||||
|
|
36
daemon.py
36
daemon.py
|
@ -294,7 +294,7 @@ from utils import locate_post
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import remove_post_from_cache
|
from utils import remove_post_from_cache
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import get_status_number
|
from utils import get_status_number
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
|
@ -1457,7 +1457,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return 3
|
return 3
|
||||||
|
|
||||||
messageDomain, messagePort = \
|
messageDomain, messagePort = \
|
||||||
getDomainFromActor(message_json['actor'])
|
get_domain_from_actor(message_json['actor'])
|
||||||
|
|
||||||
self.server.blockedCacheLastUpdated = \
|
self.server.blockedCacheLastUpdated = \
|
||||||
updateBlockedCache(self.server.base_dir,
|
updateBlockedCache(self.server.base_dir,
|
||||||
|
@ -1885,7 +1885,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
searchNickname = \
|
searchNickname = \
|
||||||
getNicknameFromActor(searchHandle)
|
getNicknameFromActor(searchHandle)
|
||||||
searchDomain, searchPort = \
|
searchDomain, searchPort = \
|
||||||
getDomainFromActor(searchHandle)
|
get_domain_from_actor(searchHandle)
|
||||||
searchHandle = \
|
searchHandle = \
|
||||||
searchNickname + '@' + searchDomain
|
searchNickname + '@' + searchDomain
|
||||||
if '@' not in searchHandle:
|
if '@' not in searchHandle:
|
||||||
|
@ -1893,7 +1893,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
searchNickname = \
|
searchNickname = \
|
||||||
getNicknameFromActor(searchHandle)
|
getNicknameFromActor(searchHandle)
|
||||||
searchDomain, searchPort = \
|
searchDomain, searchPort = \
|
||||||
getDomainFromActor(searchHandle)
|
get_domain_from_actor(searchHandle)
|
||||||
searchHandle = \
|
searchHandle = \
|
||||||
searchNickname + '@' + searchDomain
|
searchNickname + '@' + searchDomain
|
||||||
if '@' not in searchHandle:
|
if '@' not in searchHandle:
|
||||||
|
@ -1968,7 +1968,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
moderationText.startswith('hyper'):
|
moderationText.startswith('hyper'):
|
||||||
# https://domain
|
# https://domain
|
||||||
blockDomain, blockPort = \
|
blockDomain, blockPort = \
|
||||||
getDomainFromActor(moderationText)
|
get_domain_from_actor(moderationText)
|
||||||
fullBlockDomain = \
|
fullBlockDomain = \
|
||||||
get_full_domain(blockDomain, blockPort)
|
get_full_domain(blockDomain, blockPort)
|
||||||
if '@' in moderationText:
|
if '@' in moderationText:
|
||||||
|
@ -1987,7 +1987,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
moderationText.startswith('hyper'):
|
moderationText.startswith('hyper'):
|
||||||
# https://domain
|
# https://domain
|
||||||
blockDomain, blockPort = \
|
blockDomain, blockPort = \
|
||||||
getDomainFromActor(moderationText)
|
get_domain_from_actor(moderationText)
|
||||||
fullBlockDomain = \
|
fullBlockDomain = \
|
||||||
get_full_domain(blockDomain, blockPort)
|
get_full_domain(blockDomain, blockPort)
|
||||||
if '@' in moderationText:
|
if '@' in moderationText:
|
||||||
|
@ -2369,7 +2369,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
|
optionsDomain, optionsPort = get_domain_from_actor(optionsActor)
|
||||||
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
||||||
if chooserNickname == optionsNickname and \
|
if chooserNickname == optionsNickname and \
|
||||||
optionsDomain == domain and \
|
optionsDomain == domain and \
|
||||||
|
@ -2927,7 +2927,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followingActor = followingActor.split('&')[0]
|
followingActor = followingActor.split('&')[0]
|
||||||
followingNickname = getNicknameFromActor(followingActor)
|
followingNickname = getNicknameFromActor(followingActor)
|
||||||
followingDomain, followingPort = \
|
followingDomain, followingPort = \
|
||||||
getDomainFromActor(followingActor)
|
get_domain_from_actor(followingActor)
|
||||||
followingDomainFull = \
|
followingDomainFull = \
|
||||||
get_full_domain(followingDomain, followingPort)
|
get_full_domain(followingDomain, followingPort)
|
||||||
if followerNickname == followingNickname and \
|
if followerNickname == followingNickname and \
|
||||||
|
@ -3025,7 +3025,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followingActor = followingActor.split('&')[0]
|
followingActor = followingActor.split('&')[0]
|
||||||
followingNickname = getNicknameFromActor(followingActor)
|
followingNickname = getNicknameFromActor(followingActor)
|
||||||
followingDomain, followingPort = \
|
followingDomain, followingPort = \
|
||||||
getDomainFromActor(followingActor)
|
get_domain_from_actor(followingActor)
|
||||||
if followerNickname == followingNickname and \
|
if followerNickname == followingNickname and \
|
||||||
followingDomain == domain and \
|
followingDomain == domain and \
|
||||||
followingPort == port:
|
followingPort == port:
|
||||||
|
@ -3125,7 +3125,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
return
|
return
|
||||||
blockingDomain, blockingPort = \
|
blockingDomain, blockingPort = \
|
||||||
getDomainFromActor(blockingActor)
|
get_domain_from_actor(blockingActor)
|
||||||
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
|
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
|
||||||
if blockerNickname == blockingNickname and \
|
if blockerNickname == blockingNickname and \
|
||||||
blockingDomain == domain and \
|
blockingDomain == domain and \
|
||||||
|
@ -3212,7 +3212,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
return
|
return
|
||||||
blockingDomain, blockingPort = \
|
blockingDomain, blockingPort = \
|
||||||
getDomainFromActor(blockingActor)
|
get_domain_from_actor(blockingActor)
|
||||||
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
|
blockingDomainFull = get_full_domain(blockingDomain, blockingPort)
|
||||||
if blockerNickname == blockingNickname and \
|
if blockerNickname == blockingNickname and \
|
||||||
blockingDomain == domain and \
|
blockingDomain == domain and \
|
||||||
|
@ -3514,7 +3514,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if not has_users_path(searchStr):
|
if not has_users_path(searchStr):
|
||||||
searchNickname = getNicknameFromActor(searchStr)
|
searchNickname = getNicknameFromActor(searchStr)
|
||||||
searchDomain, searchPort = \
|
searchDomain, searchPort = \
|
||||||
getDomainFromActor(searchStr)
|
get_domain_from_actor(searchStr)
|
||||||
searchDomainFull = \
|
searchDomainFull = \
|
||||||
get_full_domain(searchDomain, searchPort)
|
get_full_domain(searchDomain, searchPort)
|
||||||
actor = \
|
actor = \
|
||||||
|
@ -3874,7 +3874,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
itemID = itemID.split('&')[0]
|
itemID = itemID.split('&')[0]
|
||||||
shareNickname = getNicknameFromActor(shareActor)
|
shareNickname = getNicknameFromActor(shareActor)
|
||||||
if shareNickname:
|
if shareNickname:
|
||||||
shareDomain, sharePort = getDomainFromActor(shareActor)
|
shareDomain, sharePort = get_domain_from_actor(shareActor)
|
||||||
removeSharedItem(base_dir,
|
removeSharedItem(base_dir,
|
||||||
shareNickname, shareDomain, itemID,
|
shareNickname, shareDomain, itemID,
|
||||||
http_prefix, domain_full, 'shares')
|
http_prefix, domain_full, 'shares')
|
||||||
|
@ -3941,7 +3941,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
itemID = itemID.split('&')[0]
|
itemID = itemID.split('&')[0]
|
||||||
shareNickname = getNicknameFromActor(shareActor)
|
shareNickname = getNicknameFromActor(shareActor)
|
||||||
if shareNickname:
|
if shareNickname:
|
||||||
shareDomain, sharePort = getDomainFromActor(shareActor)
|
shareDomain, sharePort = get_domain_from_actor(shareActor)
|
||||||
removeSharedItem(base_dir,
|
removeSharedItem(base_dir,
|
||||||
shareNickname, shareDomain, itemID,
|
shareNickname, shareDomain, itemID,
|
||||||
http_prefix, domain_full, 'wanted')
|
http_prefix, domain_full, 'wanted')
|
||||||
|
@ -7904,7 +7904,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followingHandle = path.split('/followapprove=')[1]
|
followingHandle = path.split('/followapprove=')[1]
|
||||||
if '://' in followingHandle:
|
if '://' in followingHandle:
|
||||||
handleNickname = getNicknameFromActor(followingHandle)
|
handleNickname = getNicknameFromActor(followingHandle)
|
||||||
handleDomain, handlePort = getDomainFromActor(followingHandle)
|
handleDomain, handlePort = get_domain_from_actor(followingHandle)
|
||||||
followingHandle = \
|
followingHandle = \
|
||||||
handleNickname + '@' + \
|
handleNickname + '@' + \
|
||||||
get_full_domain(handleDomain, handlePort)
|
get_full_domain(handleDomain, handlePort)
|
||||||
|
@ -8063,7 +8063,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
followingHandle = path.split('/followdeny=')[1]
|
followingHandle = path.split('/followdeny=')[1]
|
||||||
if '://' in followingHandle:
|
if '://' in followingHandle:
|
||||||
handleNickname = getNicknameFromActor(followingHandle)
|
handleNickname = getNicknameFromActor(followingHandle)
|
||||||
handleDomain, handlePort = getDomainFromActor(followingHandle)
|
handleDomain, handlePort = get_domain_from_actor(followingHandle)
|
||||||
followingHandle = \
|
followingHandle = \
|
||||||
handleNickname + '@' + \
|
handleNickname + '@' + \
|
||||||
get_full_domain(handleDomain, handlePort)
|
get_full_domain(handleDomain, handlePort)
|
||||||
|
@ -13265,11 +13265,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
refererDomain = None
|
refererDomain = None
|
||||||
if self.headers.get('referer'):
|
if self.headers.get('referer'):
|
||||||
refererDomain, refererPort = \
|
refererDomain, refererPort = \
|
||||||
getDomainFromActor(self.headers['referer'])
|
get_domain_from_actor(self.headers['referer'])
|
||||||
refererDomain = get_full_domain(refererDomain, refererPort)
|
refererDomain = get_full_domain(refererDomain, refererPort)
|
||||||
elif self.headers.get('Referer'):
|
elif self.headers.get('Referer'):
|
||||||
refererDomain, refererPort = \
|
refererDomain, refererPort = \
|
||||||
getDomainFromActor(self.headers['Referer'])
|
get_domain_from_actor(self.headers['Referer'])
|
||||||
refererDomain = get_full_domain(refererDomain, refererPort)
|
refererDomain = get_full_domain(refererDomain, refererPort)
|
||||||
elif self.headers.get('Signature'):
|
elif self.headers.get('Signature'):
|
||||||
if 'keyId="' in self.headers['Signature']:
|
if 'keyId="' in self.headers['Signature']:
|
||||||
|
|
|
@ -15,7 +15,7 @@ from utils import has_users_path
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import deletePost
|
from utils import deletePost
|
||||||
from utils import removeModerationPostFromIndex
|
from utils import removeModerationPostFromIndex
|
||||||
|
@ -153,7 +153,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
|
||||||
print("DEBUG: you can't delete a post which " +
|
print("DEBUG: you can't delete a post which " +
|
||||||
"wasn't created by you (nickname does not match)")
|
"wasn't created by you (nickname does not match)")
|
||||||
return
|
return
|
||||||
deleteDomain, deletePort = getDomainFromActor(messageId)
|
deleteDomain, deletePort = get_domain_from_actor(messageId)
|
||||||
domain = remove_domain_port(domain)
|
domain = remove_domain_port(domain)
|
||||||
if deleteDomain != domain:
|
if deleteDomain != domain:
|
||||||
if debug:
|
if debug:
|
||||||
|
|
|
@ -23,7 +23,7 @@ from utils import is_dm
|
||||||
from utils import load_translations_from_file
|
from utils import load_translations_from_file
|
||||||
from utils import remove_html
|
from utils import remove_html
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import is_pgp_encrypted
|
from utils import is_pgp_encrypted
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from session import createSession
|
from session import createSession
|
||||||
|
@ -143,7 +143,7 @@ def _createDesktopConfig(actor: str) -> None:
|
||||||
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
||||||
os.mkdir(homeDir + '/.config/epicyon')
|
os.mkdir(homeDir + '/.config/epicyon')
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
handle = nickname + '@' + domain
|
handle = nickname + '@' + domain
|
||||||
if port != 443 and port != 80:
|
if port != 443 and port != 80:
|
||||||
handle += '_' + str(port)
|
handle += '_' + str(port)
|
||||||
|
@ -158,7 +158,7 @@ def _markPostAsRead(actor: str, post_id: str, postCategory: str) -> None:
|
||||||
homeDir = str(Path.home())
|
homeDir = str(Path.home())
|
||||||
_createDesktopConfig(actor)
|
_createDesktopConfig(actor)
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
handle = nickname + '@' + domain
|
handle = nickname + '@' + domain
|
||||||
if port != 443 and port != 80:
|
if port != 443 and port != 80:
|
||||||
handle += '_' + str(port)
|
handle += '_' + str(port)
|
||||||
|
@ -188,7 +188,7 @@ def _hasReadPost(actor: str, post_id: str, postCategory: str) -> bool:
|
||||||
homeDir = str(Path.home())
|
homeDir = str(Path.home())
|
||||||
_createDesktopConfig(actor)
|
_createDesktopConfig(actor)
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
handle = nickname + '@' + domain
|
handle = nickname + '@' + domain
|
||||||
if port != 443 and port != 80:
|
if port != 443 and port != 80:
|
||||||
handle += '_' + str(port)
|
handle += '_' + str(port)
|
||||||
|
@ -427,7 +427,7 @@ def _desktopReplyToPost(session, post_id: str,
|
||||||
if '://' not in post_id:
|
if '://' not in post_id:
|
||||||
return
|
return
|
||||||
toNickname = getNicknameFromActor(post_id)
|
toNickname = getNicknameFromActor(post_id)
|
||||||
toDomain, toPort = getDomainFromActor(post_id)
|
toDomain, toPort = get_domain_from_actor(post_id)
|
||||||
sayStr = 'Replying to ' + toNickname + '@' + toDomain
|
sayStr = 'Replying to ' + toNickname + '@' + toDomain
|
||||||
_sayCommand(sayStr, sayStr,
|
_sayCommand(sayStr, sayStr,
|
||||||
screenreader, system_language, espeak)
|
screenreader, system_language, espeak)
|
||||||
|
@ -805,7 +805,7 @@ def _desktopShowActor(base_dir: str, actor_json: {}, translate: {},
|
||||||
"""
|
"""
|
||||||
actor = actor_json['id']
|
actor = actor_json['id']
|
||||||
actorNickname = getNicknameFromActor(actor)
|
actorNickname = getNicknameFromActor(actor)
|
||||||
actorDomain, actorPort = getDomainFromActor(actor)
|
actorDomain, actorPort = get_domain_from_actor(actor)
|
||||||
actorDomainFull = get_full_domain(actorDomain, actorPort)
|
actorDomainFull = get_full_domain(actorDomain, actorPort)
|
||||||
handle = '@' + actorNickname + '@' + actorDomainFull
|
handle = '@' + actorNickname + '@' + actorDomainFull
|
||||||
|
|
||||||
|
@ -1018,7 +1018,7 @@ def _desktopShowBox(indent: str,
|
||||||
announcedNickname = \
|
announcedNickname = \
|
||||||
getNicknameFromActor(post_json_object['object'])
|
getNicknameFromActor(post_json_object['object'])
|
||||||
announcedDomain, announcedPort = \
|
announcedDomain, announcedPort = \
|
||||||
getDomainFromActor(post_json_object['object'])
|
get_domain_from_actor(post_json_object['object'])
|
||||||
announcedHandle = announcedNickname + '@' + announcedDomain
|
announcedHandle = announcedNickname + '@' + announcedDomain
|
||||||
lineStr = \
|
lineStr = \
|
||||||
indent + str(posStr) + ' | ' + name + ' | ' + \
|
indent + str(posStr) + ' | ' + name + ' | ' + \
|
||||||
|
@ -1175,7 +1175,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
toPort = port
|
toPort = port
|
||||||
if '://' in toHandle:
|
if '://' in toHandle:
|
||||||
toNickname = getNicknameFromActor(toHandle)
|
toNickname = getNicknameFromActor(toHandle)
|
||||||
toDomain, toPort = getDomainFromActor(toHandle)
|
toDomain, toPort = get_domain_from_actor(toHandle)
|
||||||
toHandle = toNickname + '@' + toDomain
|
toHandle = toNickname + '@' + toDomain
|
||||||
else:
|
else:
|
||||||
if toHandle.startswith('@'):
|
if toHandle.startswith('@'):
|
||||||
|
@ -1282,7 +1282,7 @@ def _desktopShowFollowRequests(followRequestsJson: {}, translate: {}) -> None:
|
||||||
print('')
|
print('')
|
||||||
for item in followRequestsJson['orderedItems']:
|
for item in followRequestsJson['orderedItems']:
|
||||||
handleNickname = getNicknameFromActor(item)
|
handleNickname = getNicknameFromActor(item)
|
||||||
handleDomain, handlePort = getDomainFromActor(item)
|
handleDomain, handlePort = get_domain_from_actor(item)
|
||||||
handleDomainFull = \
|
handleDomainFull = \
|
||||||
get_full_domain(handleDomain, handlePort)
|
get_full_domain(handleDomain, handlePort)
|
||||||
print(indent + ' 👤 ' +
|
print(indent + ' 👤 ' +
|
||||||
|
@ -1308,7 +1308,7 @@ def _desktopShowFollowing(followingJson: {}, translate: {},
|
||||||
print('')
|
print('')
|
||||||
for item in followingJson['orderedItems']:
|
for item in followingJson['orderedItems']:
|
||||||
handleNickname = getNicknameFromActor(item)
|
handleNickname = getNicknameFromActor(item)
|
||||||
handleDomain, handlePort = getDomainFromActor(item)
|
handleDomain, handlePort = get_domain_from_actor(item)
|
||||||
handleDomainFull = \
|
handleDomainFull = \
|
||||||
get_full_domain(handleDomain, handlePort)
|
get_full_domain(handleDomain, handlePort)
|
||||||
print(indent + ' 👤 ' +
|
print(indent + ' 👤 ' +
|
||||||
|
@ -2214,7 +2214,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
if '@' in followHandle or '://' in followHandle:
|
if '@' in followHandle or '://' in followHandle:
|
||||||
followNickname = getNicknameFromActor(followHandle)
|
followNickname = getNicknameFromActor(followHandle)
|
||||||
followDomain, followPort = \
|
followDomain, followPort = \
|
||||||
getDomainFromActor(followHandle)
|
get_domain_from_actor(followHandle)
|
||||||
if followNickname and followDomain:
|
if followNickname and followDomain:
|
||||||
sayStr = 'Sending follow request to ' + \
|
sayStr = 'Sending follow request to ' + \
|
||||||
followNickname + '@' + followDomain
|
followNickname + '@' + followDomain
|
||||||
|
@ -2250,7 +2250,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
if '@' in followHandle or '://' in followHandle:
|
if '@' in followHandle or '://' in followHandle:
|
||||||
followNickname = getNicknameFromActor(followHandle)
|
followNickname = getNicknameFromActor(followHandle)
|
||||||
followDomain, followPort = \
|
followDomain, followPort = \
|
||||||
getDomainFromActor(followHandle)
|
get_domain_from_actor(followHandle)
|
||||||
if followNickname and followDomain:
|
if followNickname and followDomain:
|
||||||
sayStr = 'Stop following ' + \
|
sayStr = 'Stop following ' + \
|
||||||
followNickname + '@' + followDomain
|
followNickname + '@' + followDomain
|
||||||
|
@ -2281,7 +2281,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
if '@' in approveHandle or '://' in approveHandle:
|
if '@' in approveHandle or '://' in approveHandle:
|
||||||
approveNickname = getNicknameFromActor(approveHandle)
|
approveNickname = getNicknameFromActor(approveHandle)
|
||||||
approveDomain, approvePort = \
|
approveDomain, approvePort = \
|
||||||
getDomainFromActor(approveHandle)
|
get_domain_from_actor(approveHandle)
|
||||||
if approveNickname and approveDomain:
|
if approveNickname and approveDomain:
|
||||||
sayStr = 'Sending approve follow request for ' + \
|
sayStr = 'Sending approve follow request for ' + \
|
||||||
approveNickname + '@' + approveDomain
|
approveNickname + '@' + approveDomain
|
||||||
|
@ -2314,7 +2314,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
if '@' in denyHandle or '://' in denyHandle:
|
if '@' in denyHandle or '://' in denyHandle:
|
||||||
denyNickname = getNicknameFromActor(denyHandle)
|
denyNickname = getNicknameFromActor(denyHandle)
|
||||||
denyDomain, denyPort = \
|
denyDomain, denyPort = \
|
||||||
getDomainFromActor(denyHandle)
|
get_domain_from_actor(denyHandle)
|
||||||
if denyNickname and denyDomain:
|
if denyNickname and denyDomain:
|
||||||
sayStr = 'Sending deny follow request for ' + \
|
sayStr = 'Sending deny follow request for ' + \
|
||||||
denyNickname + '@' + denyDomain
|
denyNickname + '@' + denyDomain
|
||||||
|
|
14
epicyon.py
14
epicyon.py
|
@ -71,7 +71,7 @@ from utils import has_users_path
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import setConfigParam
|
from utils import setConfigParam
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import follow_person
|
from utils import follow_person
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
|
@ -702,7 +702,7 @@ if args.posts:
|
||||||
if '@' not in args.posts:
|
if '@' not in args.posts:
|
||||||
if '/users/' in args.posts:
|
if '/users/' in args.posts:
|
||||||
postsNickname = getNicknameFromActor(args.posts)
|
postsNickname = getNicknameFromActor(args.posts)
|
||||||
postsDomain, postsPort = getDomainFromActor(args.posts)
|
postsDomain, postsPort = get_domain_from_actor(args.posts)
|
||||||
args.posts = \
|
args.posts = \
|
||||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||||
else:
|
else:
|
||||||
|
@ -736,7 +736,7 @@ if args.postDomains:
|
||||||
if '@' not in args.postDomains:
|
if '@' not in args.postDomains:
|
||||||
if '/users/' in args.postDomains:
|
if '/users/' in args.postDomains:
|
||||||
postsNickname = getNicknameFromActor(args.postDomains)
|
postsNickname = getNicknameFromActor(args.postDomains)
|
||||||
postsDomain, postsPort = getDomainFromActor(args.postDomains)
|
postsDomain, postsPort = get_domain_from_actor(args.postDomains)
|
||||||
args.postDomains = \
|
args.postDomains = \
|
||||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||||
else:
|
else:
|
||||||
|
@ -788,7 +788,7 @@ if args.postDomainsBlocked:
|
||||||
if '/users/' in args.postDomainsBlocked:
|
if '/users/' in args.postDomainsBlocked:
|
||||||
postsNickname = getNicknameFromActor(args.postDomainsBlocked)
|
postsNickname = getNicknameFromActor(args.postDomainsBlocked)
|
||||||
postsDomain, postsPort = \
|
postsDomain, postsPort = \
|
||||||
getDomainFromActor(args.postDomainsBlocked)
|
get_domain_from_actor(args.postDomainsBlocked)
|
||||||
args.postDomainsBlocked = \
|
args.postDomainsBlocked = \
|
||||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||||
else:
|
else:
|
||||||
|
@ -834,7 +834,7 @@ if args.checkDomains:
|
||||||
if '@' not in args.checkDomains:
|
if '@' not in args.checkDomains:
|
||||||
if '/users/' in args.checkDomains:
|
if '/users/' in args.checkDomains:
|
||||||
postsNickname = getNicknameFromActor(args.posts)
|
postsNickname = getNicknameFromActor(args.posts)
|
||||||
postsDomain, postsPort = getDomainFromActor(args.posts)
|
postsDomain, postsPort = get_domain_from_actor(args.posts)
|
||||||
args.checkDomains = \
|
args.checkDomains = \
|
||||||
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
get_full_domain(postsNickname + '@' + postsDomain, postsPort)
|
||||||
else:
|
else:
|
||||||
|
@ -1882,7 +1882,7 @@ if args.follow:
|
||||||
if not followNickname:
|
if not followNickname:
|
||||||
print('Unable to find nickname in ' + args.follow)
|
print('Unable to find nickname in ' + args.follow)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
followDomain, followPort = getDomainFromActor(args.follow)
|
followDomain, followPort = get_domain_from_actor(args.follow)
|
||||||
|
|
||||||
session = createSession(proxy_type)
|
session = createSession(proxy_type)
|
||||||
person_cache = {}
|
person_cache = {}
|
||||||
|
@ -1928,7 +1928,7 @@ if args.unfollow:
|
||||||
if not followNickname:
|
if not followNickname:
|
||||||
print('WARN: unable to find nickname in ' + args.unfollow)
|
print('WARN: unable to find nickname in ' + args.unfollow)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
followDomain, followPort = getDomainFromActor(args.unfollow)
|
followDomain, followPort = get_domain_from_actor(args.unfollow)
|
||||||
|
|
||||||
session = createSession(proxy_type)
|
session = createSession(proxy_type)
|
||||||
person_cache = {}
|
person_cache = {}
|
||||||
|
|
12
follow.py
12
follow.py
|
@ -17,7 +17,7 @@ from utils import get_full_domain
|
||||||
from utils import get_followers_list
|
from utils import get_followers_list
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
from utils import domain_permitted
|
from utils import domain_permitted
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import get_status_number
|
from utils import get_status_number
|
||||||
from utils import follow_person
|
from utils import follow_person
|
||||||
|
@ -182,7 +182,7 @@ def isFollowingActor(base_dir: str,
|
||||||
if not followingNickname:
|
if not followingNickname:
|
||||||
print('WARN: unable to find nickname in ' + actor)
|
print('WARN: unable to find nickname in ' + actor)
|
||||||
return False
|
return False
|
||||||
followingDomain, followingPort = getDomainFromActor(actor)
|
followingDomain, followingPort = get_domain_from_actor(actor)
|
||||||
followingHandle = \
|
followingHandle = \
|
||||||
get_full_domain(followingNickname + '@' + followingDomain,
|
get_full_domain(followingNickname + '@' + followingDomain,
|
||||||
followingPort)
|
followingPort)
|
||||||
|
@ -237,7 +237,7 @@ def getFollowerDomains(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
domainsList = []
|
domainsList = []
|
||||||
for handle in lines:
|
for handle in lines:
|
||||||
handle = handle.replace('\n', '')
|
handle = handle.replace('\n', '')
|
||||||
followerDomain, _ = getDomainFromActor(handle)
|
followerDomain, _ = get_domain_from_actor(handle)
|
||||||
if not followerDomain:
|
if not followerDomain:
|
||||||
continue
|
continue
|
||||||
if followerDomain not in domainsList:
|
if followerDomain not in domainsList:
|
||||||
|
@ -1346,7 +1346,7 @@ def getFollowersOfActor(base_dir: str, actor: str, debug: bool) -> {}:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: no nickname found in ' + actor)
|
print('DEBUG: no nickname found in ' + actor)
|
||||||
return recipientsDict
|
return recipientsDict
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
if not domain:
|
if not domain:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: no domain found in ' + actor)
|
print('DEBUG: no domain found in ' + actor)
|
||||||
|
@ -1404,7 +1404,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
|
||||||
message_json['object']['actor'])
|
message_json['object']['actor'])
|
||||||
return
|
return
|
||||||
domainFollower, portFollower = \
|
domainFollower, portFollower = \
|
||||||
getDomainFromActor(message_json['object']['actor'])
|
get_domain_from_actor(message_json['object']['actor'])
|
||||||
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
||||||
|
|
||||||
nicknameFollowing = getNicknameFromActor(message_json['object']['object'])
|
nicknameFollowing = getNicknameFromActor(message_json['object']['object'])
|
||||||
|
@ -1413,7 +1413,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return
|
return
|
||||||
domainFollowing, portFollowing = \
|
domainFollowing, portFollowing = \
|
||||||
getDomainFromActor(message_json['object']['object'])
|
get_domain_from_actor(message_json['object']['object'])
|
||||||
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
|
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
|
||||||
|
|
||||||
group_account = \
|
group_account = \
|
||||||
|
|
34
inbox.py
34
inbox.py
|
@ -49,7 +49,7 @@ from utils import remove_post_from_cache
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import create_inbox_queue_dir
|
from utils import create_inbox_queue_dir
|
||||||
from utils import get_status_number
|
from utils import get_status_number
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import deletePost
|
from utils import deletePost
|
||||||
|
@ -480,7 +480,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
||||||
if not postNickname:
|
if not postNickname:
|
||||||
print('No post Nickname in actor ' + post_json_object['actor'])
|
print('No post Nickname in actor ' + post_json_object['actor'])
|
||||||
return None
|
return None
|
||||||
postDomain, postPort = getDomainFromActor(post_json_object['actor'])
|
postDomain, postPort = get_domain_from_actor(post_json_object['actor'])
|
||||||
if not postDomain:
|
if not postDomain:
|
||||||
if debug:
|
if debug:
|
||||||
pprint(post_json_object)
|
pprint(post_json_object)
|
||||||
|
@ -499,7 +499,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
||||||
inReplyTo = \
|
inReplyTo = \
|
||||||
post_json_object['object']['inReplyTo']
|
post_json_object['object']['inReplyTo']
|
||||||
replyDomain, replyPort = \
|
replyDomain, replyPort = \
|
||||||
getDomainFromActor(inReplyTo)
|
get_domain_from_actor(inReplyTo)
|
||||||
if isBlockedDomain(base_dir, replyDomain, blockedCache):
|
if isBlockedDomain(base_dir, replyDomain, blockedCache):
|
||||||
if debug:
|
if debug:
|
||||||
print('WARN: post contains reply from ' +
|
print('WARN: post contains reply from ' +
|
||||||
|
@ -764,7 +764,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
||||||
message_json['object']['actor'])
|
message_json['object']['actor'])
|
||||||
return False
|
return False
|
||||||
domainFollower, portFollower = \
|
domainFollower, portFollower = \
|
||||||
getDomainFromActor(message_json['object']['actor'])
|
get_domain_from_actor(message_json['object']['actor'])
|
||||||
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
domainFollowerFull = get_full_domain(domainFollower, portFollower)
|
||||||
|
|
||||||
nicknameFollowing = \
|
nicknameFollowing = \
|
||||||
|
@ -774,7 +774,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return False
|
return False
|
||||||
domainFollowing, portFollowing = \
|
domainFollowing, portFollowing = \
|
||||||
getDomainFromActor(message_json['object']['object'])
|
get_domain_from_actor(message_json['object']['object'])
|
||||||
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
|
domainFollowingFull = get_full_domain(domainFollowing, portFollowing)
|
||||||
|
|
||||||
group_account = \
|
group_account = \
|
||||||
|
@ -978,7 +978,7 @@ def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
|
||||||
updateNickname = getNicknameFromActor(message_json['actor'])
|
updateNickname = getNicknameFromActor(message_json['actor'])
|
||||||
if updateNickname:
|
if updateNickname:
|
||||||
updateDomain, updatePort = \
|
updateDomain, updatePort = \
|
||||||
getDomainFromActor(message_json['actor'])
|
get_domain_from_actor(message_json['actor'])
|
||||||
if _personReceiveUpdate(base_dir,
|
if _personReceiveUpdate(base_dir,
|
||||||
domain, port,
|
domain, port,
|
||||||
updateNickname, updateDomain,
|
updateNickname, updateDomain,
|
||||||
|
@ -1873,7 +1873,7 @@ def _receiveAnnounce(recent_posts_cache: {},
|
||||||
# is the announce actor blocked?
|
# is the announce actor blocked?
|
||||||
nickname = handle.split('@')[0]
|
nickname = handle.split('@')[0]
|
||||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||||
actorDomain, actorPort = getDomainFromActor(message_json['actor'])
|
actorDomain, actorPort = get_domain_from_actor(message_json['actor'])
|
||||||
if isBlocked(base_dir, nickname, domain, actorNickname, actorDomain):
|
if isBlocked(base_dir, nickname, domain, actorNickname, actorDomain):
|
||||||
print('Receive announce blocked for actor: ' +
|
print('Receive announce blocked for actor: ' +
|
||||||
actorNickname + '@' + actorDomain)
|
actorNickname + '@' + actorDomain)
|
||||||
|
@ -1882,7 +1882,7 @@ def _receiveAnnounce(recent_posts_cache: {},
|
||||||
# also check the actor for the url being announced
|
# also check the actor for the url being announced
|
||||||
announcedActorNickname = getNicknameFromActor(message_json['object'])
|
announcedActorNickname = getNicknameFromActor(message_json['object'])
|
||||||
announcedActorDomain, announcedActorPort = \
|
announcedActorDomain, announcedActorPort = \
|
||||||
getDomainFromActor(message_json['object'])
|
get_domain_from_actor(message_json['object'])
|
||||||
if isBlocked(base_dir, nickname, domain,
|
if isBlocked(base_dir, nickname, domain,
|
||||||
announcedActorNickname, announcedActorDomain):
|
announcedActorNickname, announcedActorDomain):
|
||||||
print('Receive announce object blocked for actor: ' +
|
print('Receive announce object blocked for actor: ' +
|
||||||
|
@ -2145,7 +2145,7 @@ def populateReplies(base_dir: str, http_prefix: str, domain: str,
|
||||||
if not replyToNickname:
|
if not replyToNickname:
|
||||||
print('DEBUG: no nickname found for ' + replyTo)
|
print('DEBUG: no nickname found for ' + replyTo)
|
||||||
return False
|
return False
|
||||||
replyToDomain, replyToPort = getDomainFromActor(replyTo)
|
replyToDomain, replyToPort = get_domain_from_actor(replyTo)
|
||||||
if not replyToDomain:
|
if not replyToDomain:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: no domain found for ' + replyTo)
|
print('DEBUG: no domain found for ' + replyTo)
|
||||||
|
@ -2454,7 +2454,7 @@ def _likeNotify(base_dir: str, domain: str, onion_domain: str,
|
||||||
return
|
return
|
||||||
|
|
||||||
likerNickname = getNicknameFromActor(actor)
|
likerNickname = getNicknameFromActor(actor)
|
||||||
likerDomain, likerPort = getDomainFromActor(actor)
|
likerDomain, likerPort = get_domain_from_actor(actor)
|
||||||
if likerNickname and likerDomain:
|
if likerNickname and likerDomain:
|
||||||
likerHandle = likerNickname + '@' + likerDomain
|
likerHandle = likerNickname + '@' + likerDomain
|
||||||
else:
|
else:
|
||||||
|
@ -2516,7 +2516,7 @@ def _reactionNotify(base_dir: str, domain: str, onion_domain: str,
|
||||||
return
|
return
|
||||||
|
|
||||||
reactionNickname = getNicknameFromActor(actor)
|
reactionNickname = getNicknameFromActor(actor)
|
||||||
reactionDomain, reactionPort = getDomainFromActor(actor)
|
reactionDomain, reactionPort = get_domain_from_actor(actor)
|
||||||
if reactionNickname and reactionDomain:
|
if reactionNickname and reactionDomain:
|
||||||
reactionHandle = reactionNickname + '@' + reactionDomain
|
reactionHandle = reactionNickname + '@' + reactionDomain
|
||||||
else:
|
else:
|
||||||
|
@ -2705,7 +2705,7 @@ def _inboxUpdateCalendar(base_dir: str, handle: str,
|
||||||
|
|
||||||
actor = post_json_object['actor']
|
actor = post_json_object['actor']
|
||||||
actorNickname = getNicknameFromActor(actor)
|
actorNickname = getNicknameFromActor(actor)
|
||||||
actorDomain, actorPort = getDomainFromActor(actor)
|
actorDomain, actorPort = get_domain_from_actor(actor)
|
||||||
handleNickname = handle.split('@')[0]
|
handleNickname = handle.split('@')[0]
|
||||||
handleDomain = handle.split('@')[1]
|
handleDomain = handle.split('@')[1]
|
||||||
if not receivingCalendarEvents(base_dir,
|
if not receivingCalendarEvents(base_dir,
|
||||||
|
@ -2922,7 +2922,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
if not sendingActorNickname:
|
if not sendingActorNickname:
|
||||||
return False
|
return False
|
||||||
sendingActorDomain, sendingActorPort = \
|
sendingActorDomain, sendingActorPort = \
|
||||||
getDomainFromActor(sendingActor)
|
get_domain_from_actor(sendingActor)
|
||||||
if not sendingActorDomain:
|
if not sendingActorDomain:
|
||||||
return False
|
return False
|
||||||
# Is this DM to yourself? eg. a reminder
|
# Is this DM to yourself? eg. a reminder
|
||||||
|
@ -3145,7 +3145,7 @@ def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
|
||||||
if not isinstance(attributedTo, str):
|
if not isinstance(attributedTo, str):
|
||||||
return
|
return
|
||||||
fromNickname = getNicknameFromActor(attributedTo)
|
fromNickname = getNicknameFromActor(attributedTo)
|
||||||
fromDomain, fromPort = getDomainFromActor(attributedTo)
|
fromDomain, fromPort = get_domain_from_actor(attributedTo)
|
||||||
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
||||||
if notifyWhenPersonPosts(base_dir, nickname, domain,
|
if notifyWhenPersonPosts(base_dir, nickname, domain,
|
||||||
fromNickname, fromDomainFull):
|
fromNickname, fromDomainFull):
|
||||||
|
@ -3173,7 +3173,7 @@ def _checkForGitPatches(base_dir: str, nickname: str, domain: str,
|
||||||
if not isinstance(attributedTo, str):
|
if not isinstance(attributedTo, str):
|
||||||
return 0
|
return 0
|
||||||
fromNickname = getNicknameFromActor(attributedTo)
|
fromNickname = getNicknameFromActor(attributedTo)
|
||||||
fromDomain, fromPort = getDomainFromActor(attributedTo)
|
fromDomain, fromPort = get_domain_from_actor(attributedTo)
|
||||||
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
fromDomainFull = get_full_domain(fromDomain, fromPort)
|
||||||
if receiveGitPatch(base_dir, nickname, domain,
|
if receiveGitPatch(base_dir, nickname, domain,
|
||||||
jsonObj['type'], jsonObj['summary'],
|
jsonObj['type'], jsonObj['summary'],
|
||||||
|
@ -3876,7 +3876,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: users/profile/accounts/channel missing from actor')
|
print('DEBUG: users/profile/accounts/channel missing from actor')
|
||||||
return False
|
return False
|
||||||
domain, tempPort = getDomainFromActor(message_json['actor'])
|
domain, tempPort = get_domain_from_actor(message_json['actor'])
|
||||||
fromPort = port
|
fromPort = port
|
||||||
domain_full = get_full_domain(domain, tempPort)
|
domain_full = get_full_domain(domain, tempPort)
|
||||||
if tempPort:
|
if tempPort:
|
||||||
|
@ -3899,7 +3899,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||||
print('DEBUG: users/profile/channel/accounts ' +
|
print('DEBUG: users/profile/channel/accounts ' +
|
||||||
'not found within object')
|
'not found within object')
|
||||||
return False
|
return False
|
||||||
domainToFollow, tempPort = getDomainFromActor(message_json['object'])
|
domainToFollow, tempPort = get_domain_from_actor(message_json['object'])
|
||||||
if not domain_permitted(domainToFollow, federation_list):
|
if not domain_permitted(domainToFollow, federation_list):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: follow domain not permitted ' + domainToFollow)
|
print('DEBUG: follow domain not permitted ' + domainToFollow)
|
||||||
|
|
6
like.py
6
like.py
|
@ -19,7 +19,7 @@ from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import undoLikesCollectionEntry
|
from utils import undoLikesCollectionEntry
|
||||||
from utils import has_group_type
|
from utils import has_group_type
|
||||||
|
@ -105,12 +105,12 @@ def _like(recent_posts_cache: {},
|
||||||
group_account = False
|
group_account = False
|
||||||
if actorLiked:
|
if actorLiked:
|
||||||
likedPostNickname = getNicknameFromActor(actorLiked)
|
likedPostNickname = getNicknameFromActor(actorLiked)
|
||||||
likedPostDomain, likedPostPort = getDomainFromActor(actorLiked)
|
likedPostDomain, likedPostPort = get_domain_from_actor(actorLiked)
|
||||||
group_account = has_group_type(base_dir, actorLiked, person_cache)
|
group_account = has_group_type(base_dir, actorLiked, person_cache)
|
||||||
else:
|
else:
|
||||||
if has_users_path(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
likedPostNickname = getNicknameFromActor(objectUrl)
|
likedPostNickname = getNicknameFromActor(objectUrl)
|
||||||
likedPostDomain, likedPostPort = getDomainFromActor(objectUrl)
|
likedPostDomain, likedPostPort = get_domain_from_actor(objectUrl)
|
||||||
if '/' + str(likedPostNickname) + '/' in objectUrl:
|
if '/' + str(likedPostNickname) + '/' in objectUrl:
|
||||||
actorLiked = \
|
actorLiked = \
|
||||||
objectUrl.split('/' + likedPostNickname + '/')[0] + \
|
objectUrl.split('/' + likedPostNickname + '/')[0] + \
|
||||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Core"
|
||||||
import os
|
import os
|
||||||
from utils import is_account_dir
|
from utils import is_account_dir
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from utils import has_group_type
|
from utils import has_group_type
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
|
@ -99,7 +99,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
||||||
movedToNickname = getNicknameFromActor(movedToUrl)
|
movedToNickname = getNicknameFromActor(movedToUrl)
|
||||||
if not movedToNickname:
|
if not movedToNickname:
|
||||||
return ctr
|
return ctr
|
||||||
movedToDomain, movedToPort = getDomainFromActor(movedToUrl)
|
movedToDomain, movedToPort = get_domain_from_actor(movedToUrl)
|
||||||
if not movedToDomain:
|
if not movedToDomain:
|
||||||
return ctr
|
return ctr
|
||||||
movedToDomainFull = movedToDomain
|
movedToDomainFull = movedToDomain
|
||||||
|
|
|
@ -22,7 +22,7 @@ from utils import has_object_dict
|
||||||
from utils import getLocalNetworkAddresses
|
from utils import getLocalNetworkAddresses
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import is_featured_writer
|
from utils import is_featured_writer
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
|
@ -279,7 +279,7 @@ def postMessageToOutbox(session, translate: {},
|
||||||
if localNetworkPattern in message_json['actor']:
|
if localNetworkPattern in message_json['actor']:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
testDomain, testPort = getDomainFromActor(message_json['actor'])
|
testDomain, testPort = get_domain_from_actor(message_json['actor'])
|
||||||
testDomain = get_full_domain(testDomain, testPort)
|
testDomain = get_full_domain(testDomain, testPort)
|
||||||
if isBlockedDomain(base_dir, testDomain):
|
if isBlockedDomain(base_dir, testDomain):
|
||||||
if debug:
|
if debug:
|
||||||
|
|
21
posts.py
21
posts.py
|
@ -55,7 +55,7 @@ from utils import get_status_number
|
||||||
from utils import createPersonDir
|
from utils import createPersonDir
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import deletePost
|
from utils import deletePost
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
|
@ -790,7 +790,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
|
||||||
if item['object'].get('inReplyTo'):
|
if item['object'].get('inReplyTo'):
|
||||||
if isinstance(item['object']['inReplyTo'], str):
|
if isinstance(item['object']['inReplyTo'], str):
|
||||||
postDomain, postPort = \
|
postDomain, postPort = \
|
||||||
getDomainFromActor(item['object']['inReplyTo'])
|
get_domain_from_actor(item['object']['inReplyTo'])
|
||||||
if postDomain not in postDomains:
|
if postDomain not in postDomains:
|
||||||
postDomains.append(postDomain)
|
postDomains.append(postDomain)
|
||||||
|
|
||||||
|
@ -802,7 +802,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
|
||||||
if tagType == 'mention':
|
if tagType == 'mention':
|
||||||
if tagItem.get('href'):
|
if tagItem.get('href'):
|
||||||
postDomain, postPort = \
|
postDomain, postPort = \
|
||||||
getDomainFromActor(tagItem['href'])
|
get_domain_from_actor(tagItem['href'])
|
||||||
if postDomain not in postDomains:
|
if postDomain not in postDomains:
|
||||||
postDomains.append(postDomain)
|
postDomains.append(postDomain)
|
||||||
return postDomains
|
return postDomains
|
||||||
|
@ -852,7 +852,7 @@ def _getPostsForBlockedDomains(base_dir: str,
|
||||||
if item['object'].get('inReplyTo'):
|
if item['object'].get('inReplyTo'):
|
||||||
if isinstance(item['object']['inReplyTo'], str):
|
if isinstance(item['object']['inReplyTo'], str):
|
||||||
postDomain, postPort = \
|
postDomain, postPort = \
|
||||||
getDomainFromActor(item['object']['inReplyTo'])
|
get_domain_from_actor(item['object']['inReplyTo'])
|
||||||
if isBlockedDomain(base_dir, postDomain):
|
if isBlockedDomain(base_dir, postDomain):
|
||||||
if item['object'].get('url'):
|
if item['object'].get('url'):
|
||||||
url = item['object']['url']
|
url = item['object']['url']
|
||||||
|
@ -871,7 +871,7 @@ def _getPostsForBlockedDomains(base_dir: str,
|
||||||
tagType = tagItem['type'].lower()
|
tagType = tagItem['type'].lower()
|
||||||
if tagType == 'mention' and tagItem.get('href'):
|
if tagType == 'mention' and tagItem.get('href'):
|
||||||
postDomain, postPort = \
|
postDomain, postPort = \
|
||||||
getDomainFromActor(tagItem['href'])
|
get_domain_from_actor(tagItem['href'])
|
||||||
if isBlockedDomain(base_dir, postDomain):
|
if isBlockedDomain(base_dir, postDomain):
|
||||||
if item['object'].get('url'):
|
if item['object'].get('url'):
|
||||||
url = item['object']['url']
|
url = item['object']['url']
|
||||||
|
@ -2955,7 +2955,7 @@ def _sendToNamedAddresses(session, base_dir: str,
|
||||||
toNickname = getNicknameFromActor(address)
|
toNickname = getNicknameFromActor(address)
|
||||||
if not toNickname:
|
if not toNickname:
|
||||||
continue
|
continue
|
||||||
toDomain, toPort = getDomainFromActor(address)
|
toDomain, toPort = get_domain_from_actor(address)
|
||||||
if not toDomain:
|
if not toDomain:
|
||||||
continue
|
continue
|
||||||
# Don't send profile/actor updates to yourself
|
# Don't send profile/actor updates to yourself
|
||||||
|
@ -4571,7 +4571,8 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
||||||
'Accept': acceptStr
|
'Accept': acceptStr
|
||||||
}
|
}
|
||||||
actorNickname = getNicknameFromActor(post_json_object['actor'])
|
actorNickname = getNicknameFromActor(post_json_object['actor'])
|
||||||
actorDomain, actorPort = getDomainFromActor(post_json_object['actor'])
|
actorDomain, actorPort = \
|
||||||
|
get_domain_from_actor(post_json_object['actor'])
|
||||||
if not actorDomain:
|
if not actorDomain:
|
||||||
print('Announce actor does not contain a ' +
|
print('Announce actor does not contain a ' +
|
||||||
'valid domain or port number: ' +
|
'valid domain or port number: ' +
|
||||||
|
@ -4583,7 +4584,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
||||||
return None
|
return None
|
||||||
objectNickname = getNicknameFromActor(post_json_object['object'])
|
objectNickname = getNicknameFromActor(post_json_object['object'])
|
||||||
objectDomain, objectPort = \
|
objectDomain, objectPort = \
|
||||||
getDomainFromActor(post_json_object['object'])
|
get_domain_from_actor(post_json_object['object'])
|
||||||
if not objectDomain:
|
if not objectDomain:
|
||||||
print('Announce object does not contain a ' +
|
print('Announce object does not contain a ' +
|
||||||
'valid domain or port number: ' +
|
'valid domain or port number: ' +
|
||||||
|
@ -4725,7 +4726,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
||||||
attributedNickname = \
|
attributedNickname = \
|
||||||
getNicknameFromActor(announcedJson['object']['id'])
|
getNicknameFromActor(announcedJson['object']['id'])
|
||||||
attributedDomain, attributedPort = \
|
attributedDomain, attributedPort = \
|
||||||
getDomainFromActor(announcedJson['object']['id'])
|
get_domain_from_actor(announcedJson['object']['id'])
|
||||||
if attributedNickname and attributedDomain:
|
if attributedNickname and attributedDomain:
|
||||||
attributedDomain = \
|
attributedDomain = \
|
||||||
get_full_domain(attributedDomain, attributedPort)
|
get_full_domain(attributedDomain, attributedPort)
|
||||||
|
@ -5305,7 +5306,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
|
||||||
if has_users_path(origPostId):
|
if has_users_path(origPostId):
|
||||||
# get the actor from the original post url
|
# get the actor from the original post url
|
||||||
origNick = getNicknameFromActor(origPostId)
|
origNick = getNicknameFromActor(origPostId)
|
||||||
origDomain, origPort = getDomainFromActor(origPostId)
|
origDomain, origPort = get_domain_from_actor(origPostId)
|
||||||
if origNick and origDomain:
|
if origNick and origDomain:
|
||||||
actor = \
|
actor = \
|
||||||
origPostId.split('/' + origNick + '/')[0] + \
|
origPostId.split('/' + origNick + '/')[0] + \
|
||||||
|
|
|
@ -21,7 +21,7 @@ from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import undoReactionCollectionEntry
|
from utils import undoReactionCollectionEntry
|
||||||
from utils import has_group_type
|
from utils import has_group_type
|
||||||
|
@ -103,13 +103,13 @@ def _reaction(recent_posts_cache: {},
|
||||||
if actorReaction:
|
if actorReaction:
|
||||||
reactionPostNickname = getNicknameFromActor(actorReaction)
|
reactionPostNickname = getNicknameFromActor(actorReaction)
|
||||||
reactionPostDomain, reactionPostPort = \
|
reactionPostDomain, reactionPostPort = \
|
||||||
getDomainFromActor(actorReaction)
|
get_domain_from_actor(actorReaction)
|
||||||
group_account = has_group_type(base_dir, actorReaction, person_cache)
|
group_account = has_group_type(base_dir, actorReaction, person_cache)
|
||||||
else:
|
else:
|
||||||
if has_users_path(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
reactionPostNickname = getNicknameFromActor(objectUrl)
|
reactionPostNickname = getNicknameFromActor(objectUrl)
|
||||||
reactionPostDomain, reactionPostPort = \
|
reactionPostDomain, reactionPostPort = \
|
||||||
getDomainFromActor(objectUrl)
|
get_domain_from_actor(objectUrl)
|
||||||
if '/' + str(reactionPostNickname) + '/' in objectUrl:
|
if '/' + str(reactionPostNickname) + '/' in objectUrl:
|
||||||
actorReaction = \
|
actorReaction = \
|
||||||
objectUrl.split('/' + reactionPostNickname + '/')[0] + \
|
objectUrl.split('/' + reactionPostNickname + '/')[0] + \
|
||||||
|
@ -534,7 +534,7 @@ def htmlEmojiReactions(post_json_object: {}, interactive: bool,
|
||||||
emojiContent = item['content']
|
emojiContent = item['content']
|
||||||
emojiActor = item['actor']
|
emojiActor = item['actor']
|
||||||
emojiNickname = getNicknameFromActor(emojiActor)
|
emojiNickname = getNicknameFromActor(emojiActor)
|
||||||
emojiDomain, _ = getDomainFromActor(emojiActor)
|
emojiDomain, _ = get_domain_from_actor(emojiActor)
|
||||||
emojiHandle = emojiNickname + '@' + emojiDomain
|
emojiHandle = emojiNickname + '@' + emojiDomain
|
||||||
if emojiActor == actor:
|
if emojiActor == actor:
|
||||||
if emojiContent not in reactedToByThisActor:
|
if emojiContent not in reactedToByThisActor:
|
||||||
|
|
|
@ -15,7 +15,7 @@ from session import postJson
|
||||||
from utils import has_object_string
|
from utils import has_object_string
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import get_occupation_skills
|
from utils import get_occupation_skills
|
||||||
from utils import set_occupation_skills_list
|
from utils import set_occupation_skills_list
|
||||||
|
@ -160,7 +160,7 @@ def outboxSkills(base_dir: str, nickname: str, message_json: {},
|
||||||
actorNickname = getNicknameFromActor(message_json['actor'])
|
actorNickname = getNicknameFromActor(message_json['actor'])
|
||||||
if actorNickname != nickname:
|
if actorNickname != nickname:
|
||||||
return False
|
return False
|
||||||
domain, port = getDomainFromActor(message_json['actor'])
|
domain, port = get_domain_from_actor(message_json['actor'])
|
||||||
skill = message_json['object'].replace('"', '').split(';')[0].strip()
|
skill = message_json['object'].replace('"', '').split(';')[0].strip()
|
||||||
skillLevelPercentStr = \
|
skillLevelPercentStr = \
|
||||||
message_json['object'].replace('"', '').split(';')[1].strip()
|
message_json['object'].replace('"', '').split(';')[1].strip()
|
||||||
|
|
|
@ -15,7 +15,7 @@ from utils import remove_id_ending
|
||||||
from utils import is_dm
|
from utils import is_dm
|
||||||
from utils import is_reply
|
from utils import is_reply
|
||||||
from utils import camel_case_split
|
from utils import camel_case_split
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getGenderFromBio
|
from utils import getGenderFromBio
|
||||||
from utils import getDisplayName
|
from utils import getDisplayName
|
||||||
|
@ -480,7 +480,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
||||||
person_cache, translate)
|
person_cache, translate)
|
||||||
if announcingActor:
|
if announcingActor:
|
||||||
announcedNickname = getNicknameFromActor(announcingActor)
|
announcedNickname = getNicknameFromActor(announcingActor)
|
||||||
announcedDomain, announcedport = getDomainFromActor(announcingActor)
|
announcedDomain, announcedport = get_domain_from_actor(announcingActor)
|
||||||
if announcedNickname and announcedDomain:
|
if announcedNickname and announcedDomain:
|
||||||
announcedHandle = announcedNickname + '@' + announcedDomain
|
announcedHandle = announcedNickname + '@' + announcedDomain
|
||||||
sayContent = \
|
sayContent = \
|
||||||
|
|
16
tests.py
16
tests.py
|
@ -76,7 +76,7 @@ from utils import remove_id_ending
|
||||||
from utils import updateRecentPostsCache
|
from utils import updateRecentPostsCache
|
||||||
from utils import follow_person
|
from utils import follow_person
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import copytree
|
from utils import copytree
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
|
@ -3236,44 +3236,44 @@ def testClientToServer(base_dir: str):
|
||||||
def _testActorParsing():
|
def _testActorParsing():
|
||||||
print('testActorParsing')
|
print('testActorParsing')
|
||||||
actor = 'https://mydomain:72/users/mynick'
|
actor = 'https://mydomain:72/users/mynick'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'mydomain'
|
assert domain == 'mydomain'
|
||||||
assert port == 72
|
assert port == 72
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'mynick'
|
assert nickname == 'mynick'
|
||||||
|
|
||||||
actor = 'https://element/accounts/badger'
|
actor = 'https://element/accounts/badger'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'element'
|
assert domain == 'element'
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'badger'
|
assert nickname == 'badger'
|
||||||
|
|
||||||
actor = 'egg@chicken.com'
|
actor = 'egg@chicken.com'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'chicken.com'
|
assert domain == 'chicken.com'
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'egg'
|
assert nickname == 'egg'
|
||||||
|
|
||||||
actor = '@waffle@cardboard'
|
actor = '@waffle@cardboard'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'cardboard'
|
assert domain == 'cardboard'
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'waffle'
|
assert nickname == 'waffle'
|
||||||
|
|
||||||
actor = 'https://astral/channel/sky'
|
actor = 'https://astral/channel/sky'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'astral'
|
assert domain == 'astral'
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'sky'
|
assert nickname == 'sky'
|
||||||
|
|
||||||
actor = 'https://randomain/users/rando'
|
actor = 'https://randomain/users/rando'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'randomain'
|
assert domain == 'randomain'
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
assert nickname == 'rando'
|
assert nickname == 'rando'
|
||||||
|
|
||||||
actor = 'https://otherdomain:49/@othernick'
|
actor = 'https://otherdomain:49/@othernick'
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
assert domain == 'otherdomain'
|
assert domain == 'otherdomain'
|
||||||
assert port == 49
|
assert port == 49
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -1068,7 +1068,7 @@ def get_group_paths() -> []:
|
||||||
return ['/c/', '/video-channels/']
|
return ['/c/', '/video-channels/']
|
||||||
|
|
||||||
|
|
||||||
def getDomainFromActor(actor: str) -> (str, int):
|
def get_domain_from_actor(actor: str) -> (str, int):
|
||||||
"""Returns the domain name from an actor url
|
"""Returns the domain name from an actor url
|
||||||
"""
|
"""
|
||||||
if actor.startswith('@'):
|
if actor.startswith('@'):
|
||||||
|
|
4
video.py
4
video.py
|
@ -9,7 +9,7 @@ __module_group__ = "Timeline"
|
||||||
|
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from blocking import isBlocked
|
from blocking import isBlocked
|
||||||
from filters import isFiltered
|
from filters import isFiltered
|
||||||
|
@ -64,7 +64,7 @@ def convertVideoToNote(base_dir: str, nickname: str, domain: str,
|
||||||
postNickname = getNicknameFromActor(attributedTo)
|
postNickname = getNicknameFromActor(attributedTo)
|
||||||
if not postNickname:
|
if not postNickname:
|
||||||
return None
|
return None
|
||||||
postDomain, postDomainPort = getDomainFromActor(attributedTo)
|
postDomain, postDomainPort = get_domain_from_actor(attributedTo)
|
||||||
if not postDomain:
|
if not postDomain:
|
||||||
return None
|
return None
|
||||||
postDomainFull = get_full_domain(postDomain, postDomainPort)
|
postDomainFull = get_full_domain(postDomain, postDomainPort)
|
||||||
|
|
|
@ -13,7 +13,7 @@ from datetime import date
|
||||||
from utils import getDisplayName
|
from utils import getDisplayName
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import week_day_of_month_start
|
from utils import week_day_of_month_start
|
||||||
|
@ -40,7 +40,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
||||||
"""
|
"""
|
||||||
nickname = getNicknameFromActor(path)
|
nickname = getNicknameFromActor(path)
|
||||||
actor = local_actor_url(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
messageId = actor + '/statuses/' + post_id
|
messageId = actor + '/statuses/' + post_id
|
||||||
|
|
||||||
post_filename = locate_post(base_dir, nickname, domain, messageId)
|
post_filename = locate_post(base_dir, nickname, domain, messageId)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import os
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
|
@ -44,7 +44,7 @@ def htmlConfirmDelete(cssCache: {},
|
||||||
return None
|
return None
|
||||||
actor = messageId.split('/statuses/')[0]
|
actor = messageId.split('/statuses/')[0]
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
|
|
||||||
post_filename = locate_post(base_dir, nickname, domain, messageId)
|
post_filename = locate_post(base_dir, nickname, domain, messageId)
|
||||||
|
@ -113,7 +113,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
||||||
"""Shows a screen asking to confirm the removal of a shared item
|
"""Shows a screen asking to confirm the removal of a shared item
|
||||||
"""
|
"""
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
sharesFile = \
|
sharesFile = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||||
|
@ -180,7 +180,7 @@ def htmlConfirmFollow(cssCache: {}, translate: {}, base_dir: str,
|
||||||
followProfileUrl: str) -> str:
|
followProfileUrl: str) -> str:
|
||||||
"""Asks to confirm a follow
|
"""Asks to confirm a follow
|
||||||
"""
|
"""
|
||||||
followDomain, port = getDomainFromActor(followActor)
|
followDomain, port = get_domain_from_actor(followActor)
|
||||||
|
|
||||||
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
|
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
|
||||||
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
|
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
|
||||||
|
@ -225,7 +225,7 @@ def htmlConfirmUnfollow(cssCache: {}, translate: {}, base_dir: str,
|
||||||
followProfileUrl: str) -> str:
|
followProfileUrl: str) -> str:
|
||||||
"""Asks to confirm unfollowing an actor
|
"""Asks to confirm unfollowing an actor
|
||||||
"""
|
"""
|
||||||
followDomain, port = getDomainFromActor(followActor)
|
followDomain, port = get_domain_from_actor(followActor)
|
||||||
|
|
||||||
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
|
if os.path.isfile(base_dir + '/accounts/follow-background-custom.jpg'):
|
||||||
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
|
if not os.path.isfile(base_dir + '/accounts/follow-background.jpg'):
|
||||||
|
@ -271,7 +271,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, base_dir: str,
|
||||||
blockProfileUrl: str) -> str:
|
blockProfileUrl: str) -> str:
|
||||||
"""Asks to confirm unblocking an actor
|
"""Asks to confirm unblocking an actor
|
||||||
"""
|
"""
|
||||||
blockDomain, port = getDomainFromActor(blockActor)
|
blockDomain, port = get_domain_from_actor(blockActor)
|
||||||
|
|
||||||
setCustomBackground(base_dir, 'block-background', 'follow-background')
|
setCustomBackground(base_dir, 'block-background', 'follow-background')
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import os
|
||||||
from utils import get_new_post_endpoints
|
from utils import get_new_post_endpoints
|
||||||
from utils import isPublicPostFromUrl
|
from utils import isPublicPostFromUrl
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import get_media_formats
|
from utils import get_media_formats
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
|
@ -654,7 +654,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
|
||||||
mentionNickname = getNicknameFromActor(m)
|
mentionNickname = getNicknameFromActor(m)
|
||||||
if not mentionNickname:
|
if not mentionNickname:
|
||||||
continue
|
continue
|
||||||
mentionDomain, mentionPort = getDomainFromActor(m)
|
mentionDomain, mentionPort = get_domain_from_actor(m)
|
||||||
if not mentionDomain:
|
if not mentionDomain:
|
||||||
continue
|
continue
|
||||||
if mentionPort:
|
if mentionPort:
|
||||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Timeline"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import is_system_account
|
from utils import is_system_account
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from person import personBoxJson
|
from person import personBoxJson
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
|
@ -122,7 +122,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
|
||||||
return ""
|
return ""
|
||||||
if not is_system_account(nickname):
|
if not is_system_account(nickname):
|
||||||
return ""
|
return ""
|
||||||
domain, port = getDomainFromActor(profile_json['id'])
|
domain, port = get_domain_from_actor(profile_json['id'])
|
||||||
if not domain:
|
if not domain:
|
||||||
return ""
|
return ""
|
||||||
domain_full = domain
|
domain_full = domain
|
||||||
|
|
|
@ -14,7 +14,7 @@ from utils import get_full_domain
|
||||||
from utils import is_editor
|
from utils import is_editor
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from posts import downloadFollowCollection
|
from posts import downloadFollowCollection
|
||||||
|
@ -104,7 +104,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||||
|
|
||||||
searchNickname = getNicknameFromActor(searchHandle)
|
searchNickname = getNicknameFromActor(searchHandle)
|
||||||
searchDomain, searchPort = getDomainFromActor(searchHandle)
|
searchDomain, searchPort = get_domain_from_actor(searchHandle)
|
||||||
|
|
||||||
searchHandle = searchNickname + '@' + searchDomain
|
searchHandle = searchNickname + '@' + searchDomain
|
||||||
searchActor = \
|
searchActor = \
|
||||||
|
@ -142,7 +142,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
blockedFollowers = []
|
blockedFollowers = []
|
||||||
for followerActor in followersList:
|
for followerActor in followersList:
|
||||||
followerNickname = getNicknameFromActor(followerActor)
|
followerNickname = getNicknameFromActor(followerActor)
|
||||||
followerDomain, followerPort = getDomainFromActor(followerActor)
|
followerDomain, followerPort = get_domain_from_actor(followerActor)
|
||||||
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
||||||
if isBlocked(base_dir, nickname, domain,
|
if isBlocked(base_dir, nickname, domain,
|
||||||
followerNickname, followerDomainFull):
|
followerNickname, followerDomainFull):
|
||||||
|
@ -156,7 +156,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
blockedFollowing = []
|
blockedFollowing = []
|
||||||
for followingActor in followingList:
|
for followingActor in followingList:
|
||||||
followingNickname = getNicknameFromActor(followingActor)
|
followingNickname = getNicknameFromActor(followingActor)
|
||||||
followingDomain, followingPort = getDomainFromActor(followingActor)
|
followingDomain, followingPort = get_domain_from_actor(followingActor)
|
||||||
followingDomainFull = get_full_domain(followingDomain, followingPort)
|
followingDomainFull = get_full_domain(followingDomain, followingPort)
|
||||||
if isBlocked(base_dir, nickname, domain,
|
if isBlocked(base_dir, nickname, domain,
|
||||||
followingNickname, followingDomainFull):
|
followingNickname, followingDomainFull):
|
||||||
|
@ -217,7 +217,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
':</p>\n'
|
':</p>\n'
|
||||||
for actor in blockedFollowing:
|
for actor in blockedFollowing:
|
||||||
followingNickname = getNicknameFromActor(actor)
|
followingNickname = getNicknameFromActor(actor)
|
||||||
followingDomain, followingPort = getDomainFromActor(actor)
|
followingDomain, followingPort = get_domain_from_actor(actor)
|
||||||
followingDomainFull = \
|
followingDomainFull = \
|
||||||
get_full_domain(followingDomain, followingPort)
|
get_full_domain(followingDomain, followingPort)
|
||||||
infoForm += '<a href="' + actor + '" ' + \
|
infoForm += '<a href="' + actor + '" ' + \
|
||||||
|
@ -236,7 +236,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
':</p>\n'
|
':</p>\n'
|
||||||
for actor in blockedFollowers:
|
for actor in blockedFollowers:
|
||||||
followerNickname = getNicknameFromActor(actor)
|
followerNickname = getNicknameFromActor(actor)
|
||||||
followerDomain, followerPort = getDomainFromActor(actor)
|
followerDomain, followerPort = get_domain_from_actor(actor)
|
||||||
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
followerDomainFull = get_full_domain(followerDomain, followerPort)
|
||||||
infoForm += '<a href="' + actor + '" ' + \
|
infoForm += '<a href="' + actor + '" ' + \
|
||||||
'target="_blank" rel="nofollow noopener noreferrer">' + \
|
'target="_blank" rel="nofollow noopener noreferrer">' + \
|
||||||
|
|
|
@ -16,7 +16,7 @@ from utils import get_full_domain
|
||||||
from utils import get_config_param
|
from utils import get_config_param
|
||||||
from utils import is_dormant
|
from utils import is_dormant
|
||||||
from utils import remove_html
|
from utils import remove_html
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import is_featured_writer
|
from utils import is_featured_writer
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
|
@ -65,7 +65,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
isGroup: bool) -> str:
|
isGroup: bool) -> str:
|
||||||
"""Show options for a person: view/follow/block/report
|
"""Show options for a person: view/follow/block/report
|
||||||
"""
|
"""
|
||||||
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
|
optionsDomain, optionsPort = get_domain_from_actor(optionsActor)
|
||||||
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
||||||
|
|
||||||
if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'):
|
if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'):
|
||||||
|
@ -87,7 +87,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
if '?' in nickname:
|
if '?' in nickname:
|
||||||
nickname = nickname.split('?')[0]
|
nickname = nickname.split('?')[0]
|
||||||
followerDomain, followerPort = getDomainFromActor(optionsActor)
|
followerDomain, followerPort = get_domain_from_actor(optionsActor)
|
||||||
if isFollowingActor(base_dir, nickname, domain, optionsActor):
|
if isFollowingActor(base_dir, nickname, domain, optionsActor):
|
||||||
followStr = 'Unfollow'
|
followStr = 'Unfollow'
|
||||||
if isGroup:
|
if isGroup:
|
||||||
|
@ -155,7 +155,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
|
' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
|
||||||
if movedTo:
|
if movedTo:
|
||||||
newNickname = getNicknameFromActor(movedTo)
|
newNickname = getNicknameFromActor(movedTo)
|
||||||
newDomain, newPort = getDomainFromActor(movedTo)
|
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||||
if newNickname and newDomain:
|
if newNickname and newDomain:
|
||||||
newHandle = newNickname + '@' + newDomain
|
newHandle = newNickname + '@' + newDomain
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
|
@ -175,13 +175,13 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
otherAccountsHtml += ' '
|
otherAccountsHtml += ' '
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(altActor)
|
altDomain, altPort = get_domain_from_actor(altActor)
|
||||||
otherAccountsHtml += \
|
otherAccountsHtml += \
|
||||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||||
elif isinstance(alsoKnownAs, str):
|
elif isinstance(alsoKnownAs, str):
|
||||||
if alsoKnownAs != optionsActor:
|
if alsoKnownAs != optionsActor:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
|
||||||
otherAccountsHtml += \
|
otherAccountsHtml += \
|
||||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||||
otherAccountsHtml += '</p>\n'
|
otherAccountsHtml += '</p>\n'
|
||||||
|
|
|
@ -49,7 +49,7 @@ from utils import isPublicPost
|
||||||
from utils import updateRecentPostsCache
|
from utils import updateRecentPostsCache
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from content import limitRepeatedWords
|
from content import limitRepeatedWords
|
||||||
|
@ -99,7 +99,7 @@ def _htmlPostMetadataOpenGraph(domain: str, post_json_object: {}) -> str:
|
||||||
if isinstance(objJson['attributedTo'], str):
|
if isinstance(objJson['attributedTo'], str):
|
||||||
attrib = objJson['attributedTo']
|
attrib = objJson['attributedTo']
|
||||||
actorNick = getNicknameFromActor(attrib)
|
actorNick = getNicknameFromActor(attrib)
|
||||||
actorDomain, _ = getDomainFromActor(attrib)
|
actorDomain, _ = get_domain_from_actor(attrib)
|
||||||
actorHandle = actorNick + '@' + actorDomain
|
actorHandle = actorNick + '@' + actorDomain
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"@" + actorHandle + \
|
" <meta content=\"@" + actorHandle + \
|
||||||
|
@ -400,7 +400,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
|
||||||
blockNickname = \
|
blockNickname = \
|
||||||
getNicknameFromActor(post_json_object['object']['replyTo'])
|
getNicknameFromActor(post_json_object['object']['replyTo'])
|
||||||
blockDomain, _ = \
|
blockDomain, _ = \
|
||||||
getDomainFromActor(post_json_object['object']['replyTo'])
|
get_domain_from_actor(post_json_object['object']['replyTo'])
|
||||||
if not isBlocked(base_dir, nickname, domain,
|
if not isBlocked(base_dir, nickname, domain,
|
||||||
blockNickname, blockDomain, {}):
|
blockNickname, blockDomain, {}):
|
||||||
replyToLink = post_json_object['object']['replyTo']
|
replyToLink = post_json_object['object']['replyTo']
|
||||||
|
@ -995,7 +995,7 @@ def _getPostTitleAnnounceHtml(base_dir: str,
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
containerClassIcons, containerClass)
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
announceDomain, announcePort = getDomainFromActor(attributedTo)
|
announceDomain, announcePort = get_domain_from_actor(attributedTo)
|
||||||
getPersonFromCache(base_dir, attributedTo, person_cache, allowDownloads)
|
getPersonFromCache(base_dir, attributedTo, person_cache, allowDownloads)
|
||||||
announceDisplayName = getDisplayName(base_dir, attributedTo, person_cache)
|
announceDisplayName = getDisplayName(base_dir, attributedTo, person_cache)
|
||||||
if not announceDisplayName:
|
if not announceDisplayName:
|
||||||
|
@ -1173,7 +1173,7 @@ def _getPostTitleReplyHtml(base_dir: str,
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
containerClassIcons, containerClass)
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
replyDomain, replyPort = getDomainFromActor(replyActor)
|
replyDomain, replyPort = get_domain_from_actor(replyActor)
|
||||||
if not (replyNickname and replyDomain):
|
if not (replyNickname and replyDomain):
|
||||||
titleStr += _replyToUnknownHtml(translate, post_json_object)
|
titleStr += _replyToUnknownHtml(translate, post_json_object)
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
|
@ -1425,7 +1425,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
if domain_full not in postActor:
|
if domain_full not in postActor:
|
||||||
# lookup the correct webfinger for the postActor
|
# lookup the correct webfinger for the postActor
|
||||||
postActorNickname = getNicknameFromActor(postActor)
|
postActorNickname = getNicknameFromActor(postActor)
|
||||||
postActorDomain, postActorPort = getDomainFromActor(postActor)
|
postActorDomain, postActorPort = get_domain_from_actor(postActor)
|
||||||
postActorDomainFull = get_full_domain(postActorDomain, postActorPort)
|
postActorDomainFull = get_full_domain(postActorDomain, postActorPort)
|
||||||
postActorHandle = postActorNickname + '@' + postActorDomainFull
|
postActorHandle = postActorNickname + '@' + postActorDomainFull
|
||||||
postActorWf = \
|
postActorWf = \
|
||||||
|
@ -1578,7 +1578,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
if not actorNickname:
|
if not actorNickname:
|
||||||
# single user instance
|
# single user instance
|
||||||
actorNickname = 'dev'
|
actorNickname = 'dev'
|
||||||
actorDomain, actorPort = getDomainFromActor(postActor)
|
actorDomain, actorPort = get_domain_from_actor(postActor)
|
||||||
|
|
||||||
displayName = getDisplayName(base_dir, postActor, person_cache)
|
displayName = getDisplayName(base_dir, postActor, person_cache)
|
||||||
if displayName:
|
if displayName:
|
||||||
|
@ -2025,7 +2025,7 @@ def htmlIndividualPost(cssCache: {},
|
||||||
|
|
||||||
if byStr:
|
if byStr:
|
||||||
byStrNickname = getNicknameFromActor(byStr)
|
byStrNickname = getNicknameFromActor(byStr)
|
||||||
byStrDomain, byStrPort = getDomainFromActor(byStr)
|
byStrDomain, byStrPort = get_domain_from_actor(byStr)
|
||||||
byStrDomain = get_full_domain(byStrDomain, byStrPort)
|
byStrDomain = get_full_domain(byStrDomain, byStrPort)
|
||||||
byStrHandle = byStrNickname + '@' + byStrDomain
|
byStrHandle = byStrNickname + '@' + byStrDomain
|
||||||
if translate.get(byText):
|
if translate.get(byText):
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import get_full_domain
|
||||||
from utils import is_artist
|
from utils import is_artist
|
||||||
from utils import is_dormant
|
from utils import is_dormant
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import is_system_account
|
from utils import is_system_account
|
||||||
from utils import remove_html
|
from utils import remove_html
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
|
@ -156,7 +156,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
||||||
return None
|
return None
|
||||||
|
|
||||||
personUrl = profile_json['id']
|
personUrl = profile_json['id']
|
||||||
searchDomain, searchPort = getDomainFromActor(personUrl)
|
searchDomain, searchPort = get_domain_from_actor(personUrl)
|
||||||
if not searchDomain:
|
if not searchDomain:
|
||||||
return None
|
return None
|
||||||
searchNickname = getNicknameFromActor(personUrl)
|
searchNickname = getNicknameFromActor(personUrl)
|
||||||
|
@ -408,7 +408,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
||||||
joinedDate.split('T')[0] + '<br>\n'
|
joinedDate.split('T')[0] + '<br>\n'
|
||||||
if movedTo:
|
if movedTo:
|
||||||
newNickname = getNicknameFromActor(movedTo)
|
newNickname = getNicknameFromActor(movedTo)
|
||||||
newDomain, newPort = getDomainFromActor(movedTo)
|
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||||
newDomainFull = get_full_domain(newDomain, newPort)
|
newDomainFull = get_full_domain(newDomain, newPort)
|
||||||
if newNickname and newDomain:
|
if newNickname and newDomain:
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
|
@ -428,13 +428,13 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
otherAccountsHtml += ' '
|
otherAccountsHtml += ' '
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(altActor)
|
altDomain, altPort = get_domain_from_actor(altActor)
|
||||||
otherAccountsHtml += \
|
otherAccountsHtml += \
|
||||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||||
elif isinstance(alsoKnownAs, str):
|
elif isinstance(alsoKnownAs, str):
|
||||||
if alsoKnownAs != actor:
|
if alsoKnownAs != actor:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
|
||||||
otherAccountsHtml += \
|
otherAccountsHtml += \
|
||||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||||
otherAccountsHtml += '</p>\n'
|
otherAccountsHtml += '</p>\n'
|
||||||
|
@ -502,7 +502,7 @@ def _getProfileHeaderAfterSearch(base_dir: str,
|
||||||
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
|
htmlStr += ' <p><b>' + translate['Follows you'] + '</b></p>\n'
|
||||||
if movedTo:
|
if movedTo:
|
||||||
newNickname = getNicknameFromActor(movedTo)
|
newNickname = getNicknameFromActor(movedTo)
|
||||||
newDomain, newPort = getDomainFromActor(movedTo)
|
newDomain, newPort = get_domain_from_actor(movedTo)
|
||||||
newDomainFull = get_full_domain(newDomain, newPort)
|
newDomainFull = get_full_domain(newDomain, newPort)
|
||||||
if newNickname and newDomain:
|
if newNickname and newDomain:
|
||||||
newHandle = newNickname + '@' + newDomainFull
|
newHandle = newNickname + '@' + newDomainFull
|
||||||
|
@ -520,13 +520,13 @@ def _getProfileHeaderAfterSearch(base_dir: str,
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
otherAccountshtml += ' '
|
otherAccountshtml += ' '
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(altActor)
|
altDomain, altPort = get_domain_from_actor(altActor)
|
||||||
otherAccountshtml += \
|
otherAccountshtml += \
|
||||||
'<a href="' + altActor + '">' + altDomain + '</a>'
|
'<a href="' + altActor + '">' + altDomain + '</a>'
|
||||||
elif isinstance(alsoKnownAs, str):
|
elif isinstance(alsoKnownAs, str):
|
||||||
if alsoKnownAs != actor:
|
if alsoKnownAs != actor:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
altDomain, altPort = getDomainFromActor(alsoKnownAs)
|
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
|
||||||
otherAccountshtml += \
|
otherAccountshtml += \
|
||||||
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
pageNumber, maxItemsPerPage, cw_lists,
|
pageNumber, maxItemsPerPage, cw_lists,
|
||||||
lists_enabled)
|
lists_enabled)
|
||||||
|
|
||||||
domain, port = getDomainFromActor(profile_json['id'])
|
domain, port = get_domain_from_actor(profile_json['id'])
|
||||||
if not domain:
|
if not domain:
|
||||||
return ""
|
return ""
|
||||||
displayName = \
|
displayName = \
|
||||||
|
@ -760,7 +760,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
# is this a new domain?
|
# is this a new domain?
|
||||||
# if so then append a new instance indicator
|
# if so then append a new instance indicator
|
||||||
followerDomain, _ = \
|
followerDomain, _ = \
|
||||||
getDomainFromActor(followerActor)
|
get_domain_from_actor(followerActor)
|
||||||
newFollowerDomain = ''
|
newFollowerDomain = ''
|
||||||
if followerDomain not in currFollowerDomains:
|
if followerDomain not in currFollowerDomains:
|
||||||
newFollowerDomain = ' ✨'
|
newFollowerDomain = ' ✨'
|
||||||
|
@ -2354,7 +2354,7 @@ def _individualFollowAsHtml(signing_priv_key_pem: str,
|
||||||
"""An individual follow entry on the profile screen
|
"""An individual follow entry on the profile screen
|
||||||
"""
|
"""
|
||||||
followUrlNickname = getNicknameFromActor(followUrl)
|
followUrlNickname = getNicknameFromActor(followUrl)
|
||||||
followUrlDomain, followUrlPort = getDomainFromActor(followUrl)
|
followUrlDomain, followUrlPort = get_domain_from_actor(followUrl)
|
||||||
followUrlDomainFull = get_full_domain(followUrlDomain, followUrlPort)
|
followUrlDomainFull = get_full_domain(followUrlDomain, followUrlPort)
|
||||||
titleStr = '@' + followUrlNickname + '@' + followUrlDomainFull
|
titleStr = '@' + followUrlNickname + '@' + followUrlDomainFull
|
||||||
avatarUrl = getPersonAvatarUrl(base_dir, followUrl, person_cache, True)
|
avatarUrl = getPersonAvatarUrl(base_dir, followUrl, person_cache, True)
|
||||||
|
|
|
@ -17,7 +17,7 @@ from utils import get_config_param
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import is_editor
|
from utils import is_editor
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import getDomainFromActor
|
from utils import get_domain_from_actor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
|
@ -337,7 +337,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
|
||||||
base_dir + '/emoji/emoji.json')
|
base_dir + '/emoji/emoji.json')
|
||||||
|
|
||||||
actor = path.replace('/search', '')
|
actor = path.replace('/search', '')
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = get_domain_from_actor(actor)
|
||||||
|
|
||||||
setCustomBackground(base_dir, 'search-background', 'follow-background')
|
setCustomBackground(base_dir, 'search-background', 'follow-background')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue