Snake case

main
Bob Mottram 2021-12-26 10:19:59 +00:00
parent a047d9785b
commit 963ed4aa1f
38 changed files with 201 additions and 198 deletions

View File

@ -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

View File

@ -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()

View File

@ -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 = {

View File

@ -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

View File

@ -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 += '<br><center>' + attachmentStr + '</center>'
personUrl = localActorUrl(http_prefix, nickname, domain_full)
personUrl = local_actor_url(http_prefix, nickname, domain_full)
actorJson = \
getPersonFromCache(base_dir, personUrl, person_cache, False)
languagesUnderstood = []
@ -311,7 +311,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
if not linkedAuthor:
blogStr += '<p class="about"><a class="about" href="' + \
localActorUrl(http_prefix, nickname, domain_full) + \
local_actor_url(http_prefix, nickname, domain_full) + \
'">' + translate['About the author'] + \
'</a></p>\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

View File

@ -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",

View File

@ -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)

View File

@ -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'

View File

@ -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)

View File

@ -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 = []

View File

@ -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)

View File

@ -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}',

View File

@ -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 = \

View File

@ -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)

10
like.py
View File

@ -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",

View File

@ -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

View File

@ -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 += \
' <title>' + translate[title] + '</title>' + \
' <link>' + \
localActorUrl(http_prefix, nickname, domain_full) + \
local_actor_url(http_prefix, nickname, domain_full) + \
'/rss.xml' + '</link>'
return rssStr

View File

@ -28,7 +28,7 @@ from utils import isFeaturedWriter
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
from blocking import isBlockedDomain
from blocking import outboxBlock
@ -101,7 +101,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
print('DEBUG: c2s actor update id is not a string')
return
domain_full = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
if len(message_json['to']) != 1:
if debug:
print('DEBUG: c2s actor update - to does not contain one actor ' +
@ -413,7 +413,7 @@ def postMessageToOutbox(session, translate: {},
if message_json['type'] in indexedActivities:
indexes = [outboxName, "inbox"]
selfActor = \
localActorUrl(http_prefix, postToNickname, domain_full)
local_actor_url(http_prefix, postToNickname, domain_full)
for boxNameIndex in indexes:
if not boxNameIndex:
continue

View File

@ -58,7 +58,7 @@ from utils import isImageFile
from utils import acctDir
from utils import getUserPaths
from utils import getGroupPaths
from utils import localActorUrl
from utils import local_actor_url
from utils import dangerousSVG
from session import createSession
from session import getJson
@ -149,7 +149,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
if personJson:
personJson[iconFilenameBase]['mediaType'] = mediaType
personJson[iconFilenameBase]['url'] = \
localActorUrl(http_prefix, nickname, fullDomain) + \
local_actor_url(http_prefix, nickname, fullDomain) + \
'/' + iconFilename
saveJson(personJson, personFilename)
@ -374,7 +374,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
# Enable follower approval by default
approveFollowers = manual_follower_approval
personName = nickname
personId = localActorUrl(http_prefix, nickname, domain)
personId = local_actor_url(http_prefix, nickname, domain)
inboxStr = personId + '/inbox'
personUrl = http_prefix + '://' + domain + '/@' + personName
if nickname == 'inbox':

4
pgp.py
View File

@ -15,7 +15,7 @@ from utils import containsPGPPublicKey
from utils import isPGPEncrypted
from utils import getFullDomain
from utils import getStatusNumber
from utils import localActorUrl
from utils import local_actor_url
from utils import replaceUsersWithAt
from webfinger import webfingerHandle
from posts import getPersonBox
@ -500,7 +500,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
if debug:
print('Actor for ' + handle + ' obtained')
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
handle = replaceUsersWithAt(actor)
# check that this looks like the correct actor

View File

@ -68,7 +68,7 @@ from utils import votesOnNewswireItem
from utils import removeHtml
from utils import dangerousMarkup
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from media import attachMedia
from media import replaceYouTube
from media import replaceTwitter
@ -359,7 +359,7 @@ def getPersonBox(signing_priv_key_pem: str, originDomain: str,
}
else:
# the final fallback is a mastodon style url
personUrl = localActorUrl(http_prefix, nickname, domain)
personUrl = local_actor_url(http_prefix, nickname, domain)
if not personUrl:
return None, None, None, None, None, None, None, None
@ -921,7 +921,7 @@ def savePostToBox(base_dir: str, http_prefix: str, postId: str,
if not postId:
statusNumber, published = getStatusNumber()
postId = \
localActorUrl(http_prefix, nickname, originalDomain) + \
local_actor_url(http_prefix, nickname, originalDomain) + \
'/statuses/' + statusNumber
post_json_object['id'] = postId + '/activity'
if hasObjectDict(post_json_object):
@ -1076,14 +1076,14 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
content_license_url: str) -> {}:
"""Creates a new server-to-server post
"""
actorUrl = localActorUrl(http_prefix, nickname, domain)
actorUrl = local_actor_url(http_prefix, nickname, domain)
idStr = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/statuses/' + statusNumber + '/replies'
newPostUrl = \
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
newPostAttributedTo = \
localActorUrl(http_prefix, nickname, domain)
local_actor_url(http_prefix, nickname, domain)
if not conversationId:
conversationId = newPostId
newPost = {
@ -1153,7 +1153,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
"""
domain_full = getFullDomain(domain, port)
idStr = \
localActorUrl(http_prefix, nickname, domain_full) + \
local_actor_url(http_prefix, nickname, domain_full) + \
'/statuses/' + statusNumber + '/replies'
newPostUrl = \
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
@ -1168,7 +1168,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
'inReplyTo': inReplyTo,
'published': published,
'url': newPostUrl,
'attributedTo': localActorUrl(http_prefix, nickname, domain_full),
'attributedTo': local_actor_url(http_prefix, nickname, domain_full),
'to': toRecipients,
'cc': toCC,
'sensitive': sensitive,
@ -1428,7 +1428,7 @@ def _createPostBase(base_dir: str,
statusNumber, published = getStatusNumber()
newPostId = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/statuses/' + statusNumber
sensitive = False
@ -1574,7 +1574,7 @@ def outboxMessageCreateWrap(http_prefix: str,
if message_json.get('published'):
published = message_json['published']
newPostId = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/statuses/' + statusNumber
cc = []
if message_json.get('cc'):
@ -1583,7 +1583,7 @@ def outboxMessageCreateWrap(http_prefix: str,
"@context": "https://www.w3.org/ns/activitystreams",
'id': newPostId + '/activity',
'type': 'Create',
'actor': localActorUrl(http_prefix, nickname, domain),
'actor': local_actor_url(http_prefix, nickname, domain),
'published': published,
'to': message_json['to'],
'cc': cc,
@ -1593,7 +1593,7 @@ def outboxMessageCreateWrap(http_prefix: str,
newPost['object']['url'] = \
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
newPost['object']['atomUri'] = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/statuses/' + statusNumber
return newPost
@ -1623,7 +1623,7 @@ def _postIsAddressedToFollowers(base_dir: str,
ccList = post_json_object['cc']
followersUrl = \
localActorUrl(http_prefix, nickname, domain_full) + '/followers'
local_actor_url(http_prefix, nickname, domain_full) + '/followers'
# does the followers url exist in 'to' or 'cc' lists?
addressedToFollowers = False
@ -1667,7 +1667,7 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
accountDir = acctDir(base_dir, nickname, domain)
pinnedFilename = accountDir + '/pinToProfile.txt'
pinnedPostJson = {}
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
if os.path.isfile(pinnedFilename):
pinnedContent = None
with open(pinnedFilename, 'r') as pinFile:
@ -1712,7 +1712,7 @@ def jsonPinPost(base_dir: str, http_prefix: str,
if pinnedPostJson:
itemsList = [pinnedPostJson]
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
postContext = getIndividualPostContext()
return {
'@context': postContext,
@ -1783,7 +1783,7 @@ def createPublicPost(base_dir: str,
anonymousParticipationEnabled = None
eventStatus = None
ticketUrl = None
localActor = localActorUrl(http_prefix, nickname, domain_full)
localActor = local_actor_url(http_prefix, nickname, domain_full)
return _createPostBase(base_dir, nickname, domain, port,
'https://www.w3.org/ns/activitystreams#Public',
localActor + '/followers',
@ -1908,7 +1908,7 @@ def createQuestionPost(base_dir: str,
"""Question post with multiple choice options
"""
domain_full = getFullDomain(domain, port)
localActor = localActorUrl(http_prefix, nickname, domain_full)
localActor = local_actor_url(http_prefix, nickname, domain_full)
message_json = \
_createPostBase(base_dir, nickname, domain, port,
'https://www.w3.org/ns/activitystreams#Public',
@ -1958,7 +1958,7 @@ def createUnlistedPost(base_dir: str,
"""Unlisted post. This has the #Public and followers links inverted.
"""
domain_full = getFullDomain(domain, port)
localActor = localActorUrl(http_prefix, nickname, domain_full)
localActor = local_actor_url(http_prefix, nickname, domain_full)
return _createPostBase(base_dir, nickname, domain, port,
localActor + '/followers',
'https://www.w3.org/ns/activitystreams#Public',
@ -1993,7 +1993,7 @@ def createFollowersOnlyPost(base_dir: str,
"""Followers only post
"""
domain_full = getFullDomain(domain, port)
localActor = localActorUrl(http_prefix, nickname, domain_full)
localActor = local_actor_url(http_prefix, nickname, domain_full)
return _createPostBase(base_dir, nickname, domain, port,
localActor + '/followers',
None,
@ -2040,7 +2040,8 @@ def getMentionedPeople(base_dir: str, http_prefix: str,
if not validNickname(mentionedDomain, mentionedNickname):
continue
actor = \
localActorUrl(http_prefix, mentionedNickname, handle.split('@')[1])
local_actor_url(http_prefix, mentionedNickname,
handle.split('@')[1])
mentions.append(actor)
return mentions
@ -2135,7 +2136,7 @@ def createReportPost(base_dir: str,
if '@' in line:
nick = line.split('@')[0]
moderatorActor = \
localActorUrl(http_prefix, nick, domain_full)
local_actor_url(http_prefix, nick, domain_full)
if moderatorActor not in moderatorsList:
moderatorsList.append(moderatorActor)
continue
@ -2147,14 +2148,15 @@ def createReportPost(base_dir: str,
else:
if '/' not in line:
moderatorActor = \
localActorUrl(http_prefix, line, domain_full)
local_actor_url(http_prefix, line, domain_full)
if moderatorActor not in moderatorsList:
moderatorsList.append(moderatorActor)
if len(moderatorsList) == 0:
# if there are no moderators then the admin becomes the moderator
adminNickname = getConfigParam(base_dir, 'admin')
if adminNickname:
localActor = localActorUrl(http_prefix, adminNickname, domain_full)
localActor = \
local_actor_url(http_prefix, adminNickname, domain_full)
moderatorsList.append(localActor)
if not moderatorsList:
return None
@ -2486,17 +2488,17 @@ def sendPostViaServer(signing_priv_key_pem: str, project_version: str,
client_to_server = True
if toDomain.lower().endswith('public'):
toPersonId = 'https://www.w3.org/ns/activitystreams#Public'
cc = localActorUrl(http_prefix, fromNickname, fromDomainFull) + \
cc = local_actor_url(http_prefix, fromNickname, fromDomainFull) + \
'/followers'
else:
if toDomain.lower().endswith('followers') or \
toDomain.lower().endswith('followersonly'):
toPersonId = \
localActorUrl(http_prefix, fromNickname, fromDomainFull) + \
local_actor_url(http_prefix, fromNickname, fromDomainFull) + \
'/followers'
else:
toDomainFull = getFullDomain(toDomain, toPort)
toPersonId = localActorUrl(http_prefix, toNickname, toDomainFull)
toPersonId = local_actor_url(http_prefix, toNickname, toDomainFull)
post_json_object = \
_createPostBase(base_dir,
@ -3400,7 +3402,7 @@ def createModeration(base_dir: str, nickname: str, domain: str, port: int,
pageNumber = 1
pageStr = '?page=' + str(pageNumber)
boxUrl = localActorUrl(http_prefix, nickname, domain) + '/' + boxname
boxUrl = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
boxHeader = {
'@context': 'https://www.w3.org/ns/activitystreams',
'first': boxUrl + '?page=true',
@ -3688,7 +3690,7 @@ def _createBoxIndexed(recentPostsCache: {},
originalDomain = domain
domain = getFullDomain(domain, port)
boxActor = localActorUrl(http_prefix, nickname, domain)
boxActor = local_actor_url(http_prefix, nickname, domain)
pageStr = '?page=true'
if pageNumber:
@ -3700,7 +3702,7 @@ def _createBoxIndexed(recentPostsCache: {},
print('EX: _createBoxIndexed ' +
'unable to convert page number to string')
pass
boxUrl = localActorUrl(http_prefix, nickname, domain) + '/' + boxname
boxUrl = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
boxHeader = {
'@context': 'https://www.w3.org/ns/activitystreams',
'first': boxUrl + '?page=true',
@ -3828,7 +3830,7 @@ def _createBoxIndexed(recentPostsCache: {},
if lastPage < 1:
lastPage = 1
boxHeader['last'] = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/' + boxname + '?page=' + str(lastPage)
if headerOnly:
@ -3837,12 +3839,12 @@ def _createBoxIndexed(recentPostsCache: {},
if pageNumber > 1:
prevPageStr = str(pageNumber - 1)
boxHeader['prev'] = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/' + boxname + '?page=' + prevPageStr
nextPageStr = str(pageNumber + 1)
boxHeader['next'] = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/' + boxname + '?page=' + nextPageStr
return boxHeader
@ -4772,7 +4774,7 @@ def sendBlockViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
blockActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
blockActor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
ccUrl = blockActor + '/followers'
@ -4856,7 +4858,7 @@ def sendMuteViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
handle = replaceUsersWithAt(actor)
newMuteJson = {
@ -4936,7 +4938,7 @@ def sendUndoMuteViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
handle = replaceUsersWithAt(actor)
undoMuteJson = {
@ -5022,7 +5024,7 @@ def sendUndoBlockViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
blockActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
blockActor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
ccUrl = blockActor + '/followers'
@ -5138,7 +5140,7 @@ def c2sBoxJson(base_dir: str, session,
return None
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)

View File

@ -25,7 +25,7 @@ from utils import getDomainFromActor
from utils import locatePost
from utils import undoReactionCollectionEntry
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
@ -87,7 +87,7 @@ def _reaction(recentPostsCache: {},
newReactionJson = {
"@context": "https://www.w3.org/ns/activitystreams",
'type': 'EmojiReact',
'actor': localActorUrl(http_prefix, nickname, fullDomain),
'actor': local_actor_url(http_prefix, nickname, fullDomain),
'object': objectUrl,
'content': emojiContent
}
@ -161,7 +161,7 @@ def reactionPost(recentPostsCache: {},
reactionDomain = getFullDomain(reactionDomain, reactionPort)
actorReaction = \
localActorUrl(http_prefix, reactionNickname, reactionDomain)
local_actor_url(http_prefix, reactionNickname, reactionDomain)
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
return _reaction(recentPostsCache,
@ -193,7 +193,7 @@ def sendReactionViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
newReactionJson = {
"@context": "https://www.w3.org/ns/activitystreams",
@ -279,7 +279,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
fromDomainFull = getFullDomain(fromDomain, fromPort)
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
newUndoReactionJson = {
"@context": "https://www.w3.org/ns/activitystreams",

View File

@ -37,7 +37,7 @@ from utils import acctDir
from utils import isfloat
from utils import getCategoryTypes
from utils import getSharesFilesList
from utils import localActorUrl
from utils import local_actor_url
from media import processMetaData
from media import convertImageToLowBandwidth
from filters import isFilteredGlobally
@ -287,7 +287,7 @@ def _indicateNewShareAvailable(base_dir: str, http_prefix: str,
nickname, domain, None):
continue
localActor = \
localActorUrl(http_prefix, accountNickname, domain_full)
local_actor_url(http_prefix, accountNickname, domain_full)
try:
with open(newShareFile, 'w+') as fp:
if sharesFileType == 'shares':
@ -327,7 +327,7 @@ def addShare(base_dir: str,
durationSec = _addShareDurationSec(duration, published)
domain_full = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
itemID = _getValidSharedItemID(actor, displayName)
dfcId = _getshareDfcId(base_dir, system_language,
itemType, itemCategory, translate,
@ -499,7 +499,7 @@ def getSharesFeedForPerson(base_dir: str,
sharesJson = loadJson(sharesFilename)
if sharesJson:
noOfShares = len(sharesJson.items())
idStr = localActorUrl(http_prefix, nickname, domain)
idStr = local_actor_url(http_prefix, nickname, domain)
shares = {
'@context': 'https://www.w3.org/ns/activitystreams',
'first': idStr + '/' + sharesFileType + '?page=1',
@ -513,7 +513,7 @@ def getSharesFeedForPerson(base_dir: str,
pageNumber = 1
nextPageNumber = int(pageNumber + 1)
idStr = localActorUrl(http_prefix, nickname, domain)
idStr = local_actor_url(http_prefix, nickname, domain)
shares = {
'@context': 'https://www.w3.org/ns/activitystreams',
'id': idStr + '/' + sharesFileType + '?page=' + str(pageNumber),
@ -546,7 +546,7 @@ def getSharesFeedForPerson(base_dir: str,
lastPage = 1
if nextPageNumber > lastPage:
shares['next'] = \
localActorUrl(http_prefix, nickname, domain) + \
local_actor_url(http_prefix, nickname, domain) + \
'/' + sharesFileType + '?page=' + str(lastPage)
return shares
@ -578,7 +578,7 @@ def sendShareViaServer(base_dir, 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'
@ -691,7 +691,7 @@ def sendUndoShareViaServer(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'
@ -798,7 +798,7 @@ def sendWantedViaServer(base_dir, 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'
@ -911,7 +911,7 @@ def sendUndoWantedViaServer(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'
@ -1011,7 +1011,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
'Accept': 'application/json'
}
domain_full = getFullDomain(domain, port)
url = localActorUrl(http_prefix, nickname, domain_full) + '/catalog'
url = local_actor_url(http_prefix, nickname, domain_full) + '/catalog'
if debug:
print('Shared items catalog request to: ' + url)
catalogJson = getJson(signing_priv_key_pem, session, url, headers, None,
@ -1172,7 +1172,7 @@ def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
dfcPtUrl = \
http_prefix + '://' + domain_full + \
'/ontologies/DFC_ProductGlossary.rdf#'
owner = localActorUrl(http_prefix, nickname, domain_full)
owner = local_actor_url(http_prefix, nickname, domain_full)
if sharesFileType == 'shares':
dfcInstanceId = owner + '/catalog'
else:
@ -1283,7 +1283,7 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
continue
nickname = acct.split('@')[0]
domain = acct.split('@')[1]
owner = localActorUrl(http_prefix, nickname, domain_full)
owner = local_actor_url(http_prefix, nickname, domain_full)
sharesFilename = \
acctDir(base_dir, nickname, domain) + '/' + \

View File

@ -20,7 +20,7 @@ from utils import loadJson
from utils import getOccupationSkills
from utils import setOccupationSkillsList
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from utils import hasActor
@ -187,7 +187,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
domain_full = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
toUrl = actor
ccUrl = actor + '/followers'

View File

@ -25,7 +25,7 @@ from utils import saveJson
from utils import isPGPEncrypted
from utils import hasObjectDict
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from content import htmlReplaceQuoteMarks
speakerRemoveChars = ('.\n', '. ', ',', ';', '?', '!')
@ -454,7 +454,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
img['name'] + '. '
isDirect = isDM(post_json_object)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
replyToYou = isReply(post_json_object, actor)
published = ''

View File

@ -15,7 +15,7 @@ from utils import getImageExtensions
from utils import copytree
from utils import acctDir
from utils import dangerousSVG
from utils import localActorUrl
from utils import local_actor_url
from shutil import copyfile
from shutil import make_archive
from shutil import unpack_archive
@ -788,7 +788,7 @@ def setNewsAvatar(base_dir: str, name: str,
if not os.path.isfile(newFilename):
return
avatarFilename = \
localActorUrl(http_prefix, domain_full, nickname) + '.png'
local_actor_url(http_prefix, domain_full, nickname) + '.png'
avatarFilename = avatarFilename.replace('/', '-')
filename = base_dir + '/cache/avatars/' + avatarFilename

View File

@ -28,7 +28,7 @@ INVALID_CHARACTERS = (
)
def localActorUrl(http_prefix: str, nickname: str, domain_full: str) -> str:
def local_actor_url(http_prefix: str, nickname: str, domain_full: str) -> str:
"""Returns the url for an actor on this instance
"""
return http_prefix + '://' + domain_full + '/users/' + nickname

View File

@ -20,7 +20,7 @@ from utils import weekDayOfMonthStart
from utils import getAltPath
from utils import removeDomainPort
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from utils import replaceUsersWithAt
from happening import getTodaysEvents
from happening import getCalendarEvents
@ -39,7 +39,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
"""Shows a screen asking to confirm the deletion of a calendar event
"""
nickname = getNicknameFromActor(path)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
domain, port = getDomainFromActor(actor)
messageId = actor + '/statuses/' + postId

View File

@ -13,7 +13,7 @@ from utils import getNicknameFromActor
from utils import isEditor
from utils import isArtist
from utils import removeDomainPort
from utils import localActorUrl
from utils import local_actor_url
from webapp_utils import sharesTimelineJson
from webapp_utils import htmlPostSeparator
from webapp_utils import getLeftImageFile
@ -41,7 +41,7 @@ def _getLeftColumnShares(base_dir: str,
"""get any shares and turn them into the left column links format
"""
pageNumber = 1
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
# NOTE: this could potentially be slow if the number of federated
# shared items is large
sharesJson, lastPage = \
@ -83,7 +83,7 @@ def _getLeftColumnWanted(base_dir: str,
"""get any wanted items and turn them into the left column links format
"""
pageNumber = 1
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
# NOTE: this could potentially be slow if the number of federated
# wanted items is large
sharesJson, lastPage = \

View File

@ -16,7 +16,7 @@ from utils import loadJson
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import getConfigParam
from utils import localActorUrl
from utils import local_actor_url
from posts import downloadFollowCollection
from posts import getPublicPostInfo
from posts import isModerator
@ -108,7 +108,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
searchHandle = searchNickname + '@' + searchDomain
searchActor = \
localActorUrl(http_prefix, searchNickname, searchDomain)
local_actor_url(http_prefix, searchNickname, searchDomain)
infoForm += \
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
translate['Account Information'] + ':</a> <a href="' + searchActor + \

View File

@ -51,7 +51,7 @@ from utils import removeIdEnding
from utils import getNicknameFromActor
from utils import getDomainFromActor
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from content import limitRepeatedWords
from content import replaceEmojiFromTags
from content import htmlReplaceQuoteMarks
@ -1849,7 +1849,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
post_json_object['object']['content']
domain_full = getFullDomain(domain, port)
personUrl = localActorUrl(http_prefix, nickname, domain_full)
personUrl = local_actor_url(http_prefix, nickname, domain_full)
actorJson = \
getPersonFromCache(base_dir, personUrl, person_cache, False)
languagesUnderstood = []

View File

@ -27,7 +27,7 @@ from utils import getConfigParam
from utils import getImageFormats
from utils import acctDir
from utils import getSupportedLanguages
from utils import localActorUrl
from utils import local_actor_url
from utils import getReplyIntervalHours
from languages import getActorLanguages
from skills import getSkills
@ -419,7 +419,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
otherAccountsHtml = \
' <p>' + translate['Other accounts'] + ': '
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
ctr = 0
if isinstance(alsoKnownAs, list):
for altActor in alsoKnownAs:
@ -755,7 +755,7 @@ def htmlProfile(signing_priv_key_pem: str,
nick = followerHandle.split('@')[0]
dom = followerHandle.split('@')[1]
followerActor = \
localActorUrl(http_prefix, nick, dom)
local_actor_url(http_prefix, nick, dom)
# is this a new domain?
# if so then append a new instance indicator

View File

@ -25,7 +25,7 @@ from utils import firstParagraphFromString
from utils import searchBoxPosts
from utils import getAltPath
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from skills import noOfActorSkills
from skills import getSkillsFromList
from categories import getHashtagCategory
@ -630,7 +630,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
# add the page title
domain_full = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
historySearchTitle = '🔍 ' + translate['Your Posts']
if boxName == 'bookmarks':
historySearchTitle = '🔍 ' + translate['Bookmarks']

View File

@ -18,7 +18,7 @@ from utils import isEditor
from utils import removeIdEnding
from utils import acctDir
from utils import isfloat
from utils import localActorUrl
from utils import local_actor_url
from follow import followerApprovalActive
from person import isPersonSnoozed
from markdown import markdownToHtml
@ -1054,12 +1054,12 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
base_dir, domain, nickname, maxSharesPerAccount,
shared_items_federated_domains, sharesFileType)
domain_full = getFullDomain(domain, port)
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
adminNickname = getConfigParam(base_dir, 'admin')
adminActor = ''
if adminNickname:
adminActor = \
localActorUrl(http_prefix, adminNickname, domain_full)
local_actor_url(http_prefix, adminNickname, domain_full)
timelineStr = ''
if pageNumber > 1:

View File

@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
import os
from shutil import copyfile
from utils import getConfigParam
from utils import localActorUrl
from utils import local_actor_url
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
from markdown import markdownToHtml
@ -45,7 +45,7 @@ def htmlTermsOfService(cssCache: {}, base_dir: str,
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
TOSForm += '<div class="container">' + TOSText + '</div>\n'
if adminNickname:
adminActor = localActorUrl(http_prefix, adminNickname, domain_full)
adminActor = local_actor_url(http_prefix, adminNickname, domain_full)
TOSForm += \
'<div class="container"><center>\n' + \
'<p class="administeredby">Administered by <a href="' + \

View File

@ -23,7 +23,7 @@ from utils import isfloat
from utils import getAudioExtensions
from utils import getVideoExtensions
from utils import getImageExtensions
from utils import localActorUrl
from utils import local_actor_url
from cache import storePersonInCache
from content import addHtmlTags
from content import replaceEmojiFromTags
@ -802,7 +802,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
"""html header which includes blog post markup
https://schema.org/BlogPosting
"""
authorUrl = localActorUrl(http_prefix, nickname, domain)
authorUrl = local_actor_url(http_prefix, nickname, domain)
aboutUrl = http_prefix + '://' + domain + '/about.html'
# license for content on the site may be different from
@ -1448,7 +1448,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
contactTitleStr = translate['Buy']
sharedItemsForm += '</p>\n'
contactActor = \
localActorUrl(http_prefix, contactNickname, domain_full)
local_actor_url(http_prefix, contactNickname, domain_full)
buttonStyleStr = 'button'
if category == 'accommodation':
contactTitleStr = translate['Request to stay']
@ -1545,7 +1545,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
if not sharesJson.get(itemID):
return None
sharedItem = sharesJson[itemID]
actor = localActorUrl(http_prefix, nickname, domain_full)
actor = local_actor_url(http_prefix, nickname, domain_full)
# filename of the banner shown at the top
bannerFile, bannerFilename = \

View File

@ -15,7 +15,7 @@ from utils import getConfigParam
from utils import getImageExtensions
from utils import getImageFormats
from utils import acctDir
from utils import localActorUrl
from utils import local_actor_url
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
from webapp_utils import editTextField
@ -76,7 +76,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
if os.path.isfile(avatarFilename):
break
avatarUrl = \
localActorUrl(http_prefix, nickname, domain_full) + '/avatar.' + ext
local_actor_url(http_prefix, nickname, domain_full) + '/avatar.' + ext
imageFormats = getImageFormats()
profileForm += '<div class="container">' + profileText + '</div>\n'

View File

@ -20,7 +20,7 @@ from utils import getProtocolPrefixes
from utils import removeDomainPort
from utils import getUserPaths
from utils import getGroupPaths
from utils import localActorUrl
from utils import local_actor_url
def _parseHandle(handle: str) -> (str, str, bool):
@ -139,7 +139,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
domain = getFullDomain(domain, port)
personName = nickname
personId = localActorUrl(http_prefix, personName, domain)
personId = local_actor_url(http_prefix, personName, domain)
subjectStr = "acct:" + personName + "@" + originalDomain
profilePageHref = http_prefix + "://" + domain + "/@" + nickname
if nickname == 'inbox' or nickname == originalDomain: