diff --git a/acceptreject.py b/acceptreject.py
index e174d5aaa..d2ce54e33 100644
--- a/acceptreject.py
+++ b/acceptreject.py
@@ -18,7 +18,7 @@ from utils import domainPermitted
from utils import followPerson
from utils import acctDir
from utils import hasGroupType
-from utils import localActorUrl
+from utils import local_actor_url
from utils import hasActor
from utils import hasObjectStringType
@@ -44,7 +44,7 @@ def _create_accept_reject(base_dir: str, federation_list: [],
new_accept = {
"@context": "https://www.w3.org/ns/activitystreams",
'type': acceptType,
- 'actor': localActorUrl(http_prefix, nickname, domain),
+ 'actor': local_actor_url(http_prefix, nickname, domain),
'to': [toUrl],
'cc': [],
'object': objectJson
diff --git a/announce.py b/announce.py
index 31e3b111e..33ca9d03c 100644
--- a/announce.py
+++ b/announce.py
@@ -22,7 +22,7 @@ from utils import locatePost
from utils import saveJson
from utils import undoAnnounceCollectionEntry
from utils import updateAnnounceCollection
-from utils import localActorUrl
+from utils import local_actor_url
from utils import replaceUsersWithAt
from utils import hasActor
from utils import hasObjectStringType
@@ -139,11 +139,11 @@ def createAnnounce(session, base_dir: str, federation_list: [],
statusNumber, published = getStatusNumber()
newAnnounceId = http_prefix + '://' + fullDomain + \
'/users/' + nickname + '/statuses/' + statusNumber
- atomUriStr = localActorUrl(http_prefix, nickname, fullDomain) + \
+ atomUriStr = local_actor_url(http_prefix, nickname, fullDomain) + \
'/statuses/' + statusNumber
newAnnounce = {
"@context": "https://www.w3.org/ns/activitystreams",
- 'actor': localActorUrl(http_prefix, nickname, fullDomain),
+ 'actor': local_actor_url(http_prefix, nickname, fullDomain),
'atomUri': atomUriStr,
'cc': [],
'id': newAnnounceId + '/activity',
@@ -198,7 +198,7 @@ def announcePublic(session, base_dir: str, federation_list: [],
fromDomain = getFullDomain(domain, port)
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
- ccUrl = localActorUrl(http_prefix, nickname, fromDomain) + '/followers'
+ ccUrl = local_actor_url(http_prefix, nickname, fromDomain) + '/followers'
return createAnnounce(session, base_dir, federation_list,
nickname, domain, port,
toUrl, ccUrl, http_prefix,
@@ -225,7 +225,7 @@ def sendAnnounceViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
- actorStr = localActorUrl(http_prefix, fromNickname, fromDomainFull)
+ actorStr = local_actor_url(http_prefix, fromNickname, fromDomainFull)
ccUrl = actorStr + '/followers'
statusNumber, published = getStatusNumber()
@@ -317,7 +317,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
domain_full = getFullDomain(domain, port)
- actor = localActorUrl(http_prefix, nickname, domain_full)
+ actor = local_actor_url(http_prefix, nickname, domain_full)
handle = replaceUsersWithAt(actor)
statusNumber, published = getStatusNumber()
diff --git a/availability.py b/availability.py
index 562d2824d..b66a2b18a 100644
--- a/availability.py
+++ b/availability.py
@@ -19,7 +19,7 @@ from utils import getDomainFromActor
from utils import loadJson
from utils import saveJson
from utils import acctDir
-from utils import localActorUrl
+from utils import local_actor_url
from utils import hasActor
@@ -92,7 +92,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
domain_full = getFullDomain(domain, port)
- toUrl = localActorUrl(http_prefix, nickname, domain_full)
+ toUrl = local_actor_url(http_prefix, nickname, domain_full)
ccUrl = toUrl + '/followers'
newAvailabilityJson = {
diff --git a/blocking.py b/blocking.py
index b2ebbb4a8..0601fe8e6 100644
--- a/blocking.py
+++ b/blocking.py
@@ -31,7 +31,7 @@ from utils import evilIncarnate
from utils import getDomainFromActor
from utils import getNicknameFromActor
from utils import acctDir
-from utils import localActorUrl
+from utils import local_actor_url
from utils import hasActor
from conversation import muteConversation
from conversation import unmuteConversation
@@ -544,7 +544,7 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
alsoUpdatePostId = removeIdEnding(post_json_object['object'])
domain_full = getFullDomain(domain, port)
- actor = localActorUrl(http_prefix, nickname, domain_full)
+ actor = local_actor_url(http_prefix, nickname, domain_full)
if postJsonObj.get('conversation'):
muteConversation(base_dir, nickname, domain,
@@ -688,7 +688,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
if postJsonObj.get('ignores'):
domain_full = getFullDomain(domain, port)
- actor = localActorUrl(http_prefix, nickname, domain_full)
+ actor = local_actor_url(http_prefix, nickname, domain_full)
totalItems = 0
if postJsonObj['ignores'].get('totalItems'):
totalItems = postJsonObj['ignores']['totalItems']
@@ -907,13 +907,13 @@ def setBrochMode(base_dir: str, domain_full: str, enabled: bool) -> None:
return
# generate instance allow list
allowedDomains = [domain_full]
- followFiles = ('following.txt', 'followers.txt')
+ follow_files = ('following.txt', 'followers.txt')
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
for acct in dirs:
if not isAccountDir(acct):
continue
accountDir = os.path.join(base_dir + '/accounts', acct)
- for followFileType in followFiles:
+ for followFileType in follow_files:
followingFilename = accountDir + '/' + followFileType
if not os.path.isfile(followingFilename):
continue
diff --git a/blog.py b/blog.py
index 19ec22782..ffaca2742 100644
--- a/blog.py
+++ b/blog.py
@@ -17,7 +17,7 @@ from webapp_utils import htmlFooter
from webapp_utils import getPostAttachmentsAsHtml
from webapp_utils import editTextArea
from webapp_media import addEmbeddedElements
-from utils import localActorUrl
+from utils import local_actor_url
from utils import getActorLanguagesList
from utils import getBaseContentFromPost
from utils import getContentFromPost
@@ -265,7 +265,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
if attachmentStr:
blogStr += '
' + translate['About the author'] + \ '
\n' @@ -940,7 +940,7 @@ def pathContainsBlogLink(base_dir: str, return None, None if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read(): return None, None - messageId = localActorUrl(http_prefix, nickname, domain_full) + \ + messageId = local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + userEnding2[1] return locatePost(base_dir, nickname, domain, messageId), nickname diff --git a/bookmarks.py b/bookmarks.py index d0dc79d34..8e15143c4 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -25,7 +25,7 @@ from utils import loadJson from utils import saveJson from utils import hasObjectDict from utils import acctDir -from utils import localActorUrl +from utils import local_actor_url from utils import hasActor from utils import hasObjectStringType from posts import getPersonBox @@ -270,7 +270,7 @@ def bookmark(recentPostsCache: {}, newBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Bookmark', - 'actor': localActorUrl(http_prefix, nickname, fullDomain), + 'actor': local_actor_url(http_prefix, nickname, fullDomain), 'object': objectUrl } if ccList: @@ -329,10 +329,10 @@ def undoBookmark(recentPostsCache: {}, newUndoBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Undo', - 'actor': localActorUrl(http_prefix, nickname, fullDomain), + 'actor': local_actor_url(http_prefix, nickname, fullDomain), 'object': { 'type': 'Bookmark', - 'actor': localActorUrl(http_prefix, nickname, fullDomain), + 'actor': local_actor_url(http_prefix, nickname, fullDomain), 'object': objectUrl } } @@ -385,7 +385,7 @@ def sendBookmarkViaServer(base_dir: str, session, domain_full = getFullDomain(domain, fromPort) - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) newBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", @@ -475,7 +475,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session, domain_full = getFullDomain(domain, fromPort) - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) newBookmarkJson = { "@context": "https://www.w3.org/ns/activitystreams", diff --git a/daemon.py b/daemon.py index 6772f3723..fe12d6de9 100644 --- a/daemon.py +++ b/daemon.py @@ -250,7 +250,7 @@ from utils import setReplyIntervalHours from utils import canReplyTo from utils import isDM from utils import replaceUsersWithAt -from utils import localActorUrl +from utils import local_actor_url from utils import isfloat from utils import validPassword from utils import removeLineEndings @@ -2937,7 +2937,7 @@ class PubServer(BaseHTTPRequestHandler): print(followerNickname + ' stops following ' + followingActor) followActor = \ - localActorUrl(http_prefix, followerNickname, domain_full) + local_actor_url(http_prefix, followerNickname, domain_full) statusNumber, published = getStatusNumber() followId = followActor + '/statuses/' + str(statusNumber) unfollowJson = { @@ -3515,8 +3515,8 @@ class PubServer(BaseHTTPRequestHandler): searchDomainFull = \ getFullDomain(searchDomain, searchPort) actor = \ - localActorUrl(http_prefix, searchNickname, - searchDomainFull) + local_actor_url(http_prefix, searchNickname, + searchDomainFull) else: actor = searchStr avatarUrl = \ @@ -3861,7 +3861,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(base_dir, 'admin') adminActor = \ - localActorUrl(http_prefix, adminNickname, domain_full) + local_actor_url(http_prefix, adminNickname, domain_full) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ @@ -3928,7 +3928,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(base_dir, 'admin') adminActor = \ - localActorUrl(http_prefix, adminNickname, domain_full) + local_actor_url(http_prefix, adminNickname, domain_full) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ @@ -7685,7 +7685,7 @@ class PubServer(BaseHTTPRequestHandler): return self.server.actorRepeat = path.split('?actor=')[1] announceToStr = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + \ + local_actor_url(http_prefix, self.postToNickname, domain_full) + \ '/followers' if not repeatPrivate: announceToStr = 'https://www.w3.org/ns/activitystreams#Public' @@ -8136,7 +8136,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return likeActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) actorLiked = path.split('?actor=')[1] if '?' in actorLiked: actorLiked = actorLiked.split('?')[0] @@ -8300,7 +8300,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) actorLiked = path.split('?actor=')[1] if '?' in actorLiked: actorLiked = actorLiked.split('?')[0] @@ -8467,7 +8467,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return reactionActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) actorReaction = path.split('?actor=')[1] if '?' in actorReaction: actorReaction = actorReaction.split('?')[0] @@ -8651,7 +8651,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) actorReaction = path.split('?actor=')[1] if '?' in actorReaction: actorReaction = actorReaction.split('?')[0] @@ -8898,7 +8898,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return bookmarkActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) ccList = [] bookmark(self.server.recentPostsCache, self.server.session, @@ -9024,7 +9024,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domain_full) + local_actor_url(http_prefix, self.postToNickname, domain_full) ccList = [] undoBookmark(self.server.recentPostsCache, self.server.session, @@ -9462,15 +9462,15 @@ class PubServer(BaseHTTPRequestHandler): 'https://www.w3.org/ns/activitystreams' firstStr = \ - localActorUrl(http_prefix, nickname, domain_full) + \ + local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies?page=true' idStr = \ - localActorUrl(http_prefix, nickname, domain_full) + \ + local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies' lastStr = \ - localActorUrl(http_prefix, nickname, domain_full) + \ + local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies?page=true' repliesJson = { @@ -9552,11 +9552,11 @@ class PubServer(BaseHTTPRequestHandler): contextStr = 'https://www.w3.org/ns/activitystreams' idStr = \ - localActorUrl(http_prefix, nickname, domain_full) + \ + local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '?page=true' partOfStr = \ - localActorUrl(http_prefix, nickname, domain_full) + \ + local_actor_url(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber repliesJson = { @@ -13179,7 +13179,7 @@ class PubServer(BaseHTTPRequestHandler): postId = path.split('/editnewspost=')[1] if '?' in postId: postId = postId.split('?')[0] - postUrl = localActorUrl(http_prefix, postActor, domain_full) + \ + postUrl = local_actor_url(http_prefix, postActor, domain_full) + \ '/statuses/' + postId path = path.split('/editnewspost=')[0] msg = htmlEditNewsPost(self.server.cssCache, @@ -13229,7 +13229,7 @@ class PubServer(BaseHTTPRequestHandler): # don't block self return False blockActor = \ - localActorUrl(http_prefix, blockerNickname, blockerDomainFull) + local_actor_url(http_prefix, blockerNickname, blockerDomainFull) toUrl = 'https://www.w3.org/ns/activitystreams#Public' ccUrl = blockActor + '/followers' @@ -15686,8 +15686,8 @@ class PubServer(BaseHTTPRequestHandler): nickname = getNicknameFromActor(self.path.split('?')[0]) if nickname == actor: postUrl = \ - localActorUrl(self.server.http_prefix, nickname, - self.server.domain_full) + \ + local_actor_url(self.server.http_prefix, nickname, + self.server.domain_full) + \ '/statuses/' + messageId msg = htmlEditBlog(self.server.media_instance, self.server.translate, @@ -18028,8 +18028,8 @@ class PubServer(BaseHTTPRequestHandler): if callingDomain.endswith('.onion') and \ self.server.onion_domain: actorPathStr = \ - localActorUrl('http', nickname, - self.server.onion_domain) + \ + local_actor_url('http', nickname, + self.server.onion_domain) + \ '/' + postRedirect + \ '?page=' + str(pageNumber) self._redirect_headers(actorPathStr, cookie, @@ -18037,16 +18037,16 @@ class PubServer(BaseHTTPRequestHandler): elif (callingDomain.endswith('.i2p') and self.server.i2p_domain): actorPathStr = \ - localActorUrl('http', nickname, - self.server.i2p_domain) + \ + local_actor_url('http', nickname, + self.server.i2p_domain) + \ '/' + postRedirect + \ '?page=' + str(pageNumber) self._redirect_headers(actorPathStr, cookie, callingDomain) else: actorPathStr = \ - localActorUrl(self.server.http_prefix, nickname, - self.server.domain_full) + \ + local_actor_url(self.server.http_prefix, nickname, + self.server.domain_full) + \ '/' + postRedirect + '?page=' + str(pageNumber) self._redirect_headers(actorPathStr, cookie, callingDomain) diff --git a/delete.py b/delete.py index c30e96ab3..447fc90d0 100644 --- a/delete.py +++ b/delete.py @@ -19,7 +19,7 @@ from utils import getDomainFromActor from utils import locatePost from utils import deletePost from utils import removeModerationPostFromIndex -from utils import localActorUrl +from utils import local_actor_url from session import postJson from webfinger import webfingerHandle from auth import createBasicAuthHeader @@ -41,7 +41,7 @@ def sendDeleteViaServer(base_dir: str, session, fromDomainFull = getFullDomain(fromDomain, fromPort) - actor = localActorUrl(http_prefix, fromNickname, fromDomainFull) + actor = local_actor_url(http_prefix, fromNickname, fromDomainFull) toUrl = 'https://www.w3.org/ns/activitystreams#Public' ccUrl = actor + '/followers' diff --git a/desktop_client.py b/desktop_client.py index cb42103c9..945b18b80 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -25,7 +25,7 @@ from utils import removeHtml from utils import getNicknameFromActor from utils import getDomainFromActor from utils import isPGPEncrypted -from utils import localActorUrl +from utils import local_actor_url from session import createSession from speaker import speakableText from speaker import getSpeakerPitch @@ -1409,7 +1409,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, system_language, espeak) domain_full = getFullDomain(domain, port) - yourActor = localActorUrl(http_prefix, nickname, domain_full) + yourActor = local_actor_url(http_prefix, nickname, domain_full) actorJson = None notifyJson = { @@ -2010,8 +2010,9 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, blockDomain = blockHandle.split('@')[1] blockNickname = blockHandle.split('@')[0] blockActor = \ - localActorUrl(http_prefix, - blockNickname, blockDomain) + local_actor_url(http_prefix, + blockNickname, + blockDomain) if currIndex > 0 and boxJson and not blockActor: post_json_object = \ _desktopGetBoxPostObject(boxJson, currIndex) diff --git a/devices.py b/devices.py index 6a4fc34f9..7156ad4f0 100644 --- a/devices.py +++ b/devices.py @@ -34,7 +34,7 @@ import os from utils import loadJson from utils import saveJson from utils import acctDir -from utils import localActorUrl +from utils import local_actor_url def E2EEremoveDevice(base_dir: str, nickname: str, domain: str, @@ -146,7 +146,7 @@ def E2EEdevicesCollection(base_dir: str, nickname: str, domain: str, personDir = acctDir(base_dir, nickname, domain) if not os.path.isdir(personDir): return {} - personId = localActorUrl(http_prefix, nickname, domain_full) + personId = local_actor_url(http_prefix, nickname, domain_full) if not os.path.isdir(personDir + '/devices'): os.mkdir(personDir + '/devices') deviceList = [] diff --git a/follow.py b/follow.py index 3cea35a0f..a56929b40 100644 --- a/follow.py +++ b/follow.py @@ -29,7 +29,7 @@ from utils import isAccountDir from utils import getUserPaths from utils import acctDir from utils import hasGroupType -from utils import localActorUrl +from utils import local_actor_url from acceptreject import createAccept from acceptreject import createReject from webfinger import webfingerHandle @@ -70,7 +70,7 @@ def createInitialLastSeen(base_dir: str, http_prefix: str) -> None: domain = handle.split('@')[1] if nickname.startswith('!'): nickname = nickname[1:] - actor = localActorUrl(http_prefix, nickname, domain) + actor = local_actor_url(http_prefix, nickname, domain) lastSeenFilename = \ lastSeenDir + '/' + actor.replace('/', '#') + '.txt' if not os.path.isfile(lastSeenFilename): @@ -468,10 +468,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str, if headerOnly: firstStr = \ - localActorUrl(http_prefix, nickname, domain) + \ + local_actor_url(http_prefix, nickname, domain) + \ '/' + followFile + '?page=1' idStr = \ - localActorUrl(http_prefix, nickname, domain) + '/' + followFile + local_actor_url(http_prefix, nickname, domain) + '/' + followFile totalStr = \ _getNoOfFollows(base_dir, nickname, domain, authorized) following = { @@ -488,10 +488,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str, nextPageNumber = int(pageNumber + 1) idStr = \ - localActorUrl(http_prefix, nickname, domain) + \ + local_actor_url(http_prefix, nickname, domain) + \ '/' + followFile + '?page=' + str(pageNumber) partOfStr = \ - localActorUrl(http_prefix, nickname, domain) + '/' + followFile + local_actor_url(http_prefix, nickname, domain) + '/' + followFile following = { '@context': 'https://www.w3.org/ns/activitystreams', 'id': idStr, @@ -529,7 +529,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str, dom = line2.split('@')[1] if not nick.startswith('!'): # person actor - url = localActorUrl(http_prefix, nick, dom) + url = local_actor_url(http_prefix, nick, dom) else: # group actor url = http_prefix + '://' + dom + '/c/' + nick @@ -553,7 +553,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str, lastPage = 1 if nextPageNumber > lastPage: following['next'] = \ - localActorUrl(http_prefix, nickname, domain) + \ + local_actor_url(http_prefix, nickname, domain) + \ '/' + followFile + '?page=' + str(lastPage) return following @@ -863,7 +863,7 @@ def sendFollowRequest(session, base_dir: str, return None fullDomain = getFullDomain(domain, port) - followActor = localActorUrl(http_prefix, nickname, fullDomain) + followActor = local_actor_url(http_prefix, nickname, fullDomain) requestDomain = getFullDomain(followDomain, followPort) @@ -956,7 +956,7 @@ def sendFollowRequestViaServer(base_dir: str, session, followDomainFull = getFullDomain(followDomain, followPort) - followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull) + followActor = local_actor_url(http_prefix, fromNickname, fromDomainFull) followedId = \ http_prefix + '://' + followDomainFull + '/@' + followNickname @@ -1045,7 +1045,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session, fromDomainFull = getFullDomain(fromDomain, fromPort) followDomainFull = getFullDomain(followDomain, followPort) - followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull) + followActor = local_actor_url(http_prefix, fromNickname, fromDomainFull) followedId = \ http_prefix + '://' + followDomainFull + '/@' + followNickname statusNumber, published = getStatusNumber() @@ -1138,7 +1138,7 @@ def getFollowingViaServer(base_dir: str, session, return 6 domain_full = getFullDomain(domain, port) - followActor = localActorUrl(http_prefix, nickname, domain_full) + followActor = local_actor_url(http_prefix, nickname, domain_full) authHeader = createBasicAuthHeader(nickname, password) @@ -1179,7 +1179,7 @@ def getFollowersViaServer(base_dir: str, session, return 6 domain_full = getFullDomain(domain, port) - followActor = localActorUrl(http_prefix, nickname, domain_full) + followActor = local_actor_url(http_prefix, nickname, domain_full) authHeader = createBasicAuthHeader(nickname, password) @@ -1221,7 +1221,7 @@ def getFollowRequestsViaServer(base_dir: str, session, domain_full = getFullDomain(domain, port) - followActor = localActorUrl(http_prefix, nickname, domain_full) + followActor = local_actor_url(http_prefix, nickname, domain_full) authHeader = createBasicAuthHeader(nickname, password) headers = { @@ -1263,7 +1263,7 @@ def approveFollowRequestViaServer(base_dir: str, session, return 6 domain_full = getFullDomain(domain, port) - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) authHeader = createBasicAuthHeader(nickname, password) @@ -1304,7 +1304,7 @@ def denyFollowRequestViaServer(base_dir: str, session, return 6 domain_full = getFullDomain(domain, port) - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) authHeader = createBasicAuthHeader(nickname, password) diff --git a/httpsig.py b/httpsig.py index 38fbce90d..21ee5d504 100644 --- a/httpsig.py +++ b/httpsig.py @@ -25,7 +25,7 @@ import datetime from utils import getFullDomain from utils import getSHA256 from utils import getSHA512 -from utils import localActorUrl +from utils import local_actor_url def messageContentDigest(messageBodyJsonStr: str, digestAlgorithm: str) -> str: @@ -83,7 +83,7 @@ def signPostHeaders(dateStr: str, privateKeyPem: str, if not dateStr: dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime()) if nickname != domain and nickname.lower() != 'actor': - keyID = localActorUrl(http_prefix, nickname, domain) + keyID = local_actor_url(http_prefix, nickname, domain) else: # instance actor keyID = http_prefix + '://' + domain + '/actor' @@ -168,7 +168,7 @@ def signPostHeadersNew(dateStr: str, privateKeyPem: str, currTime = datetime.datetime.strptime(dateStr, timeFormat) secondsSinceEpoch = \ int((currTime - datetime.datetime(1970, 1, 1)).total_seconds()) - keyID = localActorUrl(http_prefix, nickname, domain) + '#main-key' + keyID = local_actor_url(http_prefix, nickname, domain) + '#main-key' if not messageBodyJsonStr: headers = { '@request-target': f'get {path}', diff --git a/inbox.py b/inbox.py index a3a9ccb0c..72f489b88 100644 --- a/inbox.py +++ b/inbox.py @@ -59,7 +59,7 @@ from utils import saveJson from utils import undoLikesCollectionEntry from utils import undoReactionCollectionEntry from utils import hasGroupType -from utils import localActorUrl +from utils import local_actor_url from utils import hasObjectStringType from categories import getHashtagCategories from categories import setHashtagCategory @@ -186,7 +186,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str, else: print('WARN: no modified date for ' + str(lastModified)) if saveSwarm: - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) newSwarmStr = htmlHashTagSwarm(base_dir, actor, translate) if newSwarmStr: try: @@ -544,7 +544,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str, if actor: postId = actor + '/statuses/' + statusNumber else: - postId = localActorUrl(http_prefix, nickname, originalDomain) + \ + postId = local_actor_url(http_prefix, nickname, originalDomain) + \ '/statuses/' + statusNumber # NOTE: don't change post_json_object['id'] before signature check @@ -2651,7 +2651,7 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int, nickname = handle.split('@')[0].replace('!', '') domain = handle.split('@')[1] domain_full = getFullDomain(domain, port) - groupActor = localActorUrl(http_prefix, nickname, domain_full) + groupActor = local_actor_url(http_prefix, nickname, domain_full) if groupActor not in post_json_object['to']: return cc = '' @@ -2904,7 +2904,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int, if not os.path.isfile(followDMsFilename): # dm index will be updated updateIndexList.append('dm') - actUrl = localActorUrl(http_prefix, nickname, domain) + actUrl = local_actor_url(http_prefix, nickname, domain) _dmNotify(base_dir, handle, actUrl + '/dm') return True @@ -2975,7 +2975,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int, # dm index will be updated updateIndexList.append('dm') - actUrl = localActorUrl(http_prefix, nickname, domain) + actUrl = local_actor_url(http_prefix, nickname, domain) _dmNotify(base_dir, handle, actUrl + '/dm') return True @@ -3108,7 +3108,7 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str, default_reply_interval_hrs) if canReplyTo(base_dir, nickname, domain, inReplyTo, replyIntervalHours): - actUrl = localActorUrl(http_prefix, nickname, domain) + actUrl = local_actor_url(http_prefix, nickname, domain) _replyNotify(base_dir, handle, actUrl + '/tlreplies') else: if debug: @@ -3148,7 +3148,7 @@ def _lowFrequencyPostNotification(base_dir: str, http_prefix: str, postId = removeIdEnding(jsonObj['id']) domFull = getFullDomain(domain, port) postLink = \ - localActorUrl(http_prefix, nickname, domFull) + \ + local_actor_url(http_prefix, nickname, domFull) + \ '?notifypost=' + postId.replace('/', '-') _notifyPostArrival(base_dir, handle, postLink) @@ -3495,7 +3495,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int, return False # get the actor being replied to - actor = localActorUrl(http_prefix, nickname, domain_full) + actor = local_actor_url(http_prefix, nickname, domain_full) # create a reply notification file if needed isReplyToMutedPost = \ diff --git a/languages.py b/languages.py index 7f367cdf8..4acf50411 100644 --- a/languages.py +++ b/languages.py @@ -14,7 +14,7 @@ from utils import getActorLanguagesList from utils import removeHtml from utils import hasObjectDict from utils import getConfigParam -from utils import localActorUrl +from utils import local_actor_url from cache import getPersonFromCache @@ -105,7 +105,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str, return True if msgObject['contentMap'].get(system_language): return True - personUrl = localActorUrl(http_prefix, nickname, domain_full) + personUrl = local_actor_url(http_prefix, nickname, domain_full) actorJson = getPersonFromCache(base_dir, personUrl, person_cache, False) if not actorJson: print('WARN: unable to load actor to check languages ' + personUrl) diff --git a/like.py b/like.py index 74502841d..004304363 100644 --- a/like.py +++ b/like.py @@ -23,7 +23,7 @@ from utils import getDomainFromActor from utils import locatePost from utils import undoLikesCollectionEntry from utils import hasGroupType -from utils import localActorUrl +from utils import local_actor_url from utils import loadJson from utils import saveJson from utils import removePostFromCache @@ -91,7 +91,7 @@ def _like(recentPostsCache: {}, newLikeJson = { "@context": "https://www.w3.org/ns/activitystreams", 'type': 'Like', - 'actor': localActorUrl(http_prefix, nickname, fullDomain), + 'actor': local_actor_url(http_prefix, nickname, fullDomain), 'object': objectUrl } if ccList: @@ -158,7 +158,7 @@ def likePost(recentPostsCache: {}, """ likeDomain = getFullDomain(likeDomain, likePort) - actorLiked = localActorUrl(http_prefix, likeNickname, likeDomain) + actorLiked = local_actor_url(http_prefix, likeNickname, likeDomain) objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber) return _like(recentPostsCache, @@ -183,7 +183,7 @@ def sendLikeViaServer(base_dir: str, session, fromDomainFull = getFullDomain(fromDomain, fromPort) - actor = localActorUrl(http_prefix, fromNickname, fromDomainFull) + actor = local_actor_url(http_prefix, fromNickname, fromDomainFull) newLikeJson = { "@context": "https://www.w3.org/ns/activitystreams", @@ -266,7 +266,7 @@ def sendUndoLikeViaServer(base_dir: str, session, fromDomainFull = getFullDomain(fromDomain, fromPort) - actor = localActorUrl(http_prefix, fromNickname, fromDomainFull) + actor = local_actor_url(http_prefix, fromNickname, fromDomainFull) newUndoLikeJson = { "@context": "https://www.w3.org/ns/activitystreams", diff --git a/newsdaemon.py b/newsdaemon.py index 2d45f3b72..6d7ac2d0d 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -33,7 +33,7 @@ from utils import saveJson from utils import getStatusNumber from utils import clearFromPostCaches from utils import dangerousMarkup -from utils import localActorUrl +from utils import local_actor_url from inbox import storeHashTags from session import createSession @@ -582,7 +582,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, statusNumber, published = getStatusNumber(dateStr) newPostId = \ - localActorUrl(http_prefix, 'news', domain) + \ + local_actor_url(http_prefix, 'news', domain) + \ '/statuses/' + statusNumber # file where the post is stored @@ -649,7 +649,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, continue idStr = \ - localActorUrl(http_prefix, 'news', domain) + \ + local_actor_url(http_prefix, 'news', domain) + \ '/statuses/' + statusNumber + '/replies' blog['news'] = True diff --git a/newswire.py b/newswire.py index 85e95f8b6..99595db69 100644 --- a/newswire.py +++ b/newswire.py @@ -32,7 +32,7 @@ from utils import containsInvalidChars from utils import removeHtml from utils import isAccountDir from utils import acctDir -from utils import localActorUrl +from utils import local_actor_url from blocking import isBlockedDomain from blocking import isBlockedHashtag from filters import isFiltered @@ -73,7 +73,7 @@ def rss2Header(http_prefix: str, rssStr += \ '