mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
a047d9785b
commit
963ed4aa1f
|
@ -18,7 +18,7 @@ from utils import domainPermitted
|
||||||
from utils import followPerson
|
from utils import followPerson
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def _create_accept_reject(base_dir: str, federation_list: [],
|
||||||
new_accept = {
|
new_accept = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': acceptType,
|
'type': acceptType,
|
||||||
'actor': localActorUrl(http_prefix, nickname, domain),
|
'actor': local_actor_url(http_prefix, nickname, domain),
|
||||||
'to': [toUrl],
|
'to': [toUrl],
|
||||||
'cc': [],
|
'cc': [],
|
||||||
'object': objectJson
|
'object': objectJson
|
||||||
|
|
12
announce.py
12
announce.py
|
@ -22,7 +22,7 @@ from utils import locatePost
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import undoAnnounceCollectionEntry
|
from utils import undoAnnounceCollectionEntry
|
||||||
from utils import updateAnnounceCollection
|
from utils import updateAnnounceCollection
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import replaceUsersWithAt
|
from utils import replaceUsersWithAt
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
|
@ -139,11 +139,11 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newAnnounceId = http_prefix + '://' + fullDomain + \
|
newAnnounceId = http_prefix + '://' + fullDomain + \
|
||||||
'/users/' + nickname + '/statuses/' + statusNumber
|
'/users/' + nickname + '/statuses/' + statusNumber
|
||||||
atomUriStr = localActorUrl(http_prefix, nickname, fullDomain) + \
|
atomUriStr = local_actor_url(http_prefix, nickname, fullDomain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
newAnnounce = {
|
newAnnounce = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'atomUri': atomUriStr,
|
'atomUri': atomUriStr,
|
||||||
'cc': [],
|
'cc': [],
|
||||||
'id': newAnnounceId + '/activity',
|
'id': newAnnounceId + '/activity',
|
||||||
|
@ -198,7 +198,7 @@ def announcePublic(session, base_dir: str, federation_list: [],
|
||||||
fromDomain = getFullDomain(domain, port)
|
fromDomain = getFullDomain(domain, port)
|
||||||
|
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
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,
|
return createAnnounce(session, base_dir, federation_list,
|
||||||
nickname, domain, port,
|
nickname, domain, port,
|
||||||
toUrl, ccUrl, http_prefix,
|
toUrl, ccUrl, http_prefix,
|
||||||
|
@ -225,7 +225,7 @@ def sendAnnounceViaServer(base_dir: str, session,
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
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'
|
ccUrl = actorStr + '/followers'
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
@ -317,7 +317,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
handle = replaceUsersWithAt(actor)
|
handle = replaceUsersWithAt(actor)
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import getDomainFromActor
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
|
|
||||||
toUrl = localActorUrl(http_prefix, nickname, domain_full)
|
toUrl = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
ccUrl = toUrl + '/followers'
|
ccUrl = toUrl + '/followers'
|
||||||
|
|
||||||
newAvailabilityJson = {
|
newAvailabilityJson = {
|
||||||
|
|
10
blocking.py
10
blocking.py
|
@ -31,7 +31,7 @@ from utils import evilIncarnate
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from conversation import muteConversation
|
from conversation import muteConversation
|
||||||
from conversation import unmuteConversation
|
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'])
|
alsoUpdatePostId = removeIdEnding(post_json_object['object'])
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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'):
|
if postJsonObj.get('conversation'):
|
||||||
muteConversation(base_dir, nickname, domain,
|
muteConversation(base_dir, nickname, domain,
|
||||||
|
@ -688,7 +688,7 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
if postJsonObj.get('ignores'):
|
if postJsonObj.get('ignores'):
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
totalItems = 0
|
totalItems = 0
|
||||||
if postJsonObj['ignores'].get('totalItems'):
|
if postJsonObj['ignores'].get('totalItems'):
|
||||||
totalItems = postJsonObj['ignores']['totalItems']
|
totalItems = postJsonObj['ignores']['totalItems']
|
||||||
|
@ -907,13 +907,13 @@ def setBrochMode(base_dir: str, domain_full: str, enabled: bool) -> None:
|
||||||
return
|
return
|
||||||
# generate instance allow list
|
# generate instance allow list
|
||||||
allowedDomains = [domain_full]
|
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 subdir, dirs, files in os.walk(base_dir + '/accounts'):
|
||||||
for acct in dirs:
|
for acct in dirs:
|
||||||
if not isAccountDir(acct):
|
if not isAccountDir(acct):
|
||||||
continue
|
continue
|
||||||
accountDir = os.path.join(base_dir + '/accounts', acct)
|
accountDir = os.path.join(base_dir + '/accounts', acct)
|
||||||
for followFileType in followFiles:
|
for followFileType in follow_files:
|
||||||
followingFilename = accountDir + '/' + followFileType
|
followingFilename = accountDir + '/' + followFileType
|
||||||
if not os.path.isfile(followingFilename):
|
if not os.path.isfile(followingFilename):
|
||||||
continue
|
continue
|
||||||
|
|
8
blog.py
8
blog.py
|
@ -17,7 +17,7 @@ from webapp_utils import htmlFooter
|
||||||
from webapp_utils import getPostAttachmentsAsHtml
|
from webapp_utils import getPostAttachmentsAsHtml
|
||||||
from webapp_utils import editTextArea
|
from webapp_utils import editTextArea
|
||||||
from webapp_media import addEmbeddedElements
|
from webapp_media import addEmbeddedElements
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import getActorLanguagesList
|
from utils import getActorLanguagesList
|
||||||
from utils import getBaseContentFromPost
|
from utils import getBaseContentFromPost
|
||||||
from utils import getContentFromPost
|
from utils import getContentFromPost
|
||||||
|
@ -265,7 +265,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
||||||
if attachmentStr:
|
if attachmentStr:
|
||||||
blogStr += '<br><center>' + attachmentStr + '</center>'
|
blogStr += '<br><center>' + attachmentStr + '</center>'
|
||||||
|
|
||||||
personUrl = localActorUrl(http_prefix, nickname, domain_full)
|
personUrl = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
actorJson = \
|
actorJson = \
|
||||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||||
languagesUnderstood = []
|
languagesUnderstood = []
|
||||||
|
@ -311,7 +311,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
||||||
|
|
||||||
if not linkedAuthor:
|
if not linkedAuthor:
|
||||||
blogStr += '<p class="about"><a class="about" href="' + \
|
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'] + \
|
'">' + translate['About the author'] + \
|
||||||
'</a></p>\n'
|
'</a></p>\n'
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ def pathContainsBlogLink(base_dir: str,
|
||||||
return None, None
|
return None, None
|
||||||
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
||||||
return None, None
|
return None, None
|
||||||
messageId = localActorUrl(http_prefix, nickname, domain_full) + \
|
messageId = local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + userEnding2[1]
|
'/statuses/' + userEnding2[1]
|
||||||
return locatePost(base_dir, nickname, domain, messageId), nickname
|
return locatePost(base_dir, nickname, domain, messageId), nickname
|
||||||
|
|
||||||
|
|
12
bookmarks.py
12
bookmarks.py
|
@ -25,7 +25,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import hasObjectDict
|
from utils import hasObjectDict
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
from posts import getPersonBox
|
from posts import getPersonBox
|
||||||
|
@ -270,7 +270,7 @@ def bookmark(recentPostsCache: {},
|
||||||
newBookmarkJson = {
|
newBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Bookmark',
|
'type': 'Bookmark',
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
if ccList:
|
if ccList:
|
||||||
|
@ -329,10 +329,10 @@ def undoBookmark(recentPostsCache: {},
|
||||||
newUndoBookmarkJson = {
|
newUndoBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Undo',
|
'type': 'Undo',
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'object': {
|
'object': {
|
||||||
'type': 'Bookmark',
|
'type': 'Bookmark',
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, fromPort)
|
domain_full = getFullDomain(domain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
|
||||||
newBookmarkJson = {
|
newBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
@ -475,7 +475,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, fromPort)
|
domain_full = getFullDomain(domain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
|
||||||
newBookmarkJson = {
|
newBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
46
daemon.py
46
daemon.py
|
@ -250,7 +250,7 @@ from utils import setReplyIntervalHours
|
||||||
from utils import canReplyTo
|
from utils import canReplyTo
|
||||||
from utils import isDM
|
from utils import isDM
|
||||||
from utils import replaceUsersWithAt
|
from utils import replaceUsersWithAt
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import validPassword
|
from utils import validPassword
|
||||||
from utils import removeLineEndings
|
from utils import removeLineEndings
|
||||||
|
@ -2937,7 +2937,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print(followerNickname + ' stops following ' +
|
print(followerNickname + ' stops following ' +
|
||||||
followingActor)
|
followingActor)
|
||||||
followActor = \
|
followActor = \
|
||||||
localActorUrl(http_prefix, followerNickname, domain_full)
|
local_actor_url(http_prefix, followerNickname, domain_full)
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
followId = followActor + '/statuses/' + str(statusNumber)
|
followId = followActor + '/statuses/' + str(statusNumber)
|
||||||
unfollowJson = {
|
unfollowJson = {
|
||||||
|
@ -3515,7 +3515,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
searchDomainFull = \
|
searchDomainFull = \
|
||||||
getFullDomain(searchDomain, searchPort)
|
getFullDomain(searchDomain, searchPort)
|
||||||
actor = \
|
actor = \
|
||||||
localActorUrl(http_prefix, searchNickname,
|
local_actor_url(http_prefix, searchNickname,
|
||||||
searchDomainFull)
|
searchDomainFull)
|
||||||
else:
|
else:
|
||||||
actor = searchStr
|
actor = searchStr
|
||||||
|
@ -3861,7 +3861,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
shareActor = shareActor.split('&')[0]
|
shareActor = shareActor.split('&')[0]
|
||||||
adminNickname = getConfigParam(base_dir, 'admin')
|
adminNickname = getConfigParam(base_dir, 'admin')
|
||||||
adminActor = \
|
adminActor = \
|
||||||
localActorUrl(http_prefix, adminNickname, domain_full)
|
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||||
actor = originPathStr
|
actor = originPathStr
|
||||||
actorNickname = getNicknameFromActor(actor)
|
actorNickname = getNicknameFromActor(actor)
|
||||||
if actor == shareActor or actor == adminActor or \
|
if actor == shareActor or actor == adminActor or \
|
||||||
|
@ -3928,7 +3928,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
shareActor = shareActor.split('&')[0]
|
shareActor = shareActor.split('&')[0]
|
||||||
adminNickname = getConfigParam(base_dir, 'admin')
|
adminNickname = getConfigParam(base_dir, 'admin')
|
||||||
adminActor = \
|
adminActor = \
|
||||||
localActorUrl(http_prefix, adminNickname, domain_full)
|
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||||
actor = originPathStr
|
actor = originPathStr
|
||||||
actorNickname = getNicknameFromActor(actor)
|
actorNickname = getNicknameFromActor(actor)
|
||||||
if actor == shareActor or actor == adminActor or \
|
if actor == shareActor or actor == adminActor or \
|
||||||
|
@ -7685,7 +7685,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self.server.actorRepeat = path.split('?actor=')[1]
|
self.server.actorRepeat = path.split('?actor=')[1]
|
||||||
announceToStr = \
|
announceToStr = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full) + \
|
local_actor_url(http_prefix, self.postToNickname, domain_full) + \
|
||||||
'/followers'
|
'/followers'
|
||||||
if not repeatPrivate:
|
if not repeatPrivate:
|
||||||
announceToStr = 'https://www.w3.org/ns/activitystreams#Public'
|
announceToStr = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
|
@ -8136,7 +8136,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
likeActor = \
|
likeActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
actorLiked = path.split('?actor=')[1]
|
actorLiked = path.split('?actor=')[1]
|
||||||
if '?' in actorLiked:
|
if '?' in actorLiked:
|
||||||
actorLiked = actorLiked.split('?')[0]
|
actorLiked = actorLiked.split('?')[0]
|
||||||
|
@ -8300,7 +8300,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
undoActor = \
|
undoActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
actorLiked = path.split('?actor=')[1]
|
actorLiked = path.split('?actor=')[1]
|
||||||
if '?' in actorLiked:
|
if '?' in actorLiked:
|
||||||
actorLiked = actorLiked.split('?')[0]
|
actorLiked = actorLiked.split('?')[0]
|
||||||
|
@ -8467,7 +8467,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
reactionActor = \
|
reactionActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
actorReaction = path.split('?actor=')[1]
|
actorReaction = path.split('?actor=')[1]
|
||||||
if '?' in actorReaction:
|
if '?' in actorReaction:
|
||||||
actorReaction = actorReaction.split('?')[0]
|
actorReaction = actorReaction.split('?')[0]
|
||||||
|
@ -8651,7 +8651,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
undoActor = \
|
undoActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
actorReaction = path.split('?actor=')[1]
|
actorReaction = path.split('?actor=')[1]
|
||||||
if '?' in actorReaction:
|
if '?' in actorReaction:
|
||||||
actorReaction = actorReaction.split('?')[0]
|
actorReaction = actorReaction.split('?')[0]
|
||||||
|
@ -8898,7 +8898,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
bookmarkActor = \
|
bookmarkActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
ccList = []
|
ccList = []
|
||||||
bookmark(self.server.recentPostsCache,
|
bookmark(self.server.recentPostsCache,
|
||||||
self.server.session,
|
self.server.session,
|
||||||
|
@ -9024,7 +9024,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
undoActor = \
|
undoActor = \
|
||||||
localActorUrl(http_prefix, self.postToNickname, domain_full)
|
local_actor_url(http_prefix, self.postToNickname, domain_full)
|
||||||
ccList = []
|
ccList = []
|
||||||
undoBookmark(self.server.recentPostsCache,
|
undoBookmark(self.server.recentPostsCache,
|
||||||
self.server.session,
|
self.server.session,
|
||||||
|
@ -9462,15 +9462,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'https://www.w3.org/ns/activitystreams'
|
'https://www.w3.org/ns/activitystreams'
|
||||||
|
|
||||||
firstStr = \
|
firstStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber + '/replies?page=true'
|
'/statuses/' + statusNumber + '/replies?page=true'
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
|
|
||||||
lastStr = \
|
lastStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber + '/replies?page=true'
|
'/statuses/' + statusNumber + '/replies?page=true'
|
||||||
|
|
||||||
repliesJson = {
|
repliesJson = {
|
||||||
|
@ -9552,11 +9552,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
contextStr = 'https://www.w3.org/ns/activitystreams'
|
contextStr = 'https://www.w3.org/ns/activitystreams'
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber + '?page=true'
|
'/statuses/' + statusNumber + '?page=true'
|
||||||
|
|
||||||
partOfStr = \
|
partOfStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
repliesJson = {
|
repliesJson = {
|
||||||
|
@ -13179,7 +13179,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
postId = path.split('/editnewspost=')[1]
|
postId = path.split('/editnewspost=')[1]
|
||||||
if '?' in postId:
|
if '?' in postId:
|
||||||
postId = postId.split('?')[0]
|
postId = postId.split('?')[0]
|
||||||
postUrl = localActorUrl(http_prefix, postActor, domain_full) + \
|
postUrl = local_actor_url(http_prefix, postActor, domain_full) + \
|
||||||
'/statuses/' + postId
|
'/statuses/' + postId
|
||||||
path = path.split('/editnewspost=')[0]
|
path = path.split('/editnewspost=')[0]
|
||||||
msg = htmlEditNewsPost(self.server.cssCache,
|
msg = htmlEditNewsPost(self.server.cssCache,
|
||||||
|
@ -13229,7 +13229,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# don't block self
|
# don't block self
|
||||||
return False
|
return False
|
||||||
blockActor = \
|
blockActor = \
|
||||||
localActorUrl(http_prefix, blockerNickname, blockerDomainFull)
|
local_actor_url(http_prefix, blockerNickname, blockerDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = blockActor + '/followers'
|
ccUrl = blockActor + '/followers'
|
||||||
|
|
||||||
|
@ -15686,7 +15686,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
nickname = getNicknameFromActor(self.path.split('?')[0])
|
nickname = getNicknameFromActor(self.path.split('?')[0])
|
||||||
if nickname == actor:
|
if nickname == actor:
|
||||||
postUrl = \
|
postUrl = \
|
||||||
localActorUrl(self.server.http_prefix, nickname,
|
local_actor_url(self.server.http_prefix, nickname,
|
||||||
self.server.domain_full) + \
|
self.server.domain_full) + \
|
||||||
'/statuses/' + messageId
|
'/statuses/' + messageId
|
||||||
msg = htmlEditBlog(self.server.media_instance,
|
msg = htmlEditBlog(self.server.media_instance,
|
||||||
|
@ -18028,7 +18028,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if callingDomain.endswith('.onion') and \
|
if callingDomain.endswith('.onion') and \
|
||||||
self.server.onion_domain:
|
self.server.onion_domain:
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
localActorUrl('http', nickname,
|
local_actor_url('http', nickname,
|
||||||
self.server.onion_domain) + \
|
self.server.onion_domain) + \
|
||||||
'/' + postRedirect + \
|
'/' + postRedirect + \
|
||||||
'?page=' + str(pageNumber)
|
'?page=' + str(pageNumber)
|
||||||
|
@ -18037,7 +18037,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
elif (callingDomain.endswith('.i2p') and
|
elif (callingDomain.endswith('.i2p') and
|
||||||
self.server.i2p_domain):
|
self.server.i2p_domain):
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
localActorUrl('http', nickname,
|
local_actor_url('http', nickname,
|
||||||
self.server.i2p_domain) + \
|
self.server.i2p_domain) + \
|
||||||
'/' + postRedirect + \
|
'/' + postRedirect + \
|
||||||
'?page=' + str(pageNumber)
|
'?page=' + str(pageNumber)
|
||||||
|
@ -18045,7 +18045,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
callingDomain)
|
callingDomain)
|
||||||
else:
|
else:
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
localActorUrl(self.server.http_prefix, nickname,
|
local_actor_url(self.server.http_prefix, nickname,
|
||||||
self.server.domain_full) + \
|
self.server.domain_full) + \
|
||||||
'/' + postRedirect + '?page=' + str(pageNumber)
|
'/' + postRedirect + '?page=' + str(pageNumber)
|
||||||
self._redirect_headers(actorPathStr, cookie,
|
self._redirect_headers(actorPathStr, cookie,
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import getDomainFromActor
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import deletePost
|
from utils import deletePost
|
||||||
from utils import removeModerationPostFromIndex
|
from utils import removeModerationPostFromIndex
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from session import postJson
|
from session import postJson
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from auth import createBasicAuthHeader
|
from auth import createBasicAuthHeader
|
||||||
|
@ -41,7 +41,7 @@ def sendDeleteViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ from utils import removeHtml
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import isPGPEncrypted
|
from utils import isPGPEncrypted
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from session import createSession
|
from session import createSession
|
||||||
from speaker import speakableText
|
from speaker import speakableText
|
||||||
from speaker import getSpeakerPitch
|
from speaker import getSpeakerPitch
|
||||||
|
@ -1409,7 +1409,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
system_language, espeak)
|
system_language, espeak)
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
yourActor = localActorUrl(http_prefix, nickname, domain_full)
|
yourActor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
actorJson = None
|
actorJson = None
|
||||||
|
|
||||||
notifyJson = {
|
notifyJson = {
|
||||||
|
@ -2010,8 +2010,9 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
||||||
blockDomain = blockHandle.split('@')[1]
|
blockDomain = blockHandle.split('@')[1]
|
||||||
blockNickname = blockHandle.split('@')[0]
|
blockNickname = blockHandle.split('@')[0]
|
||||||
blockActor = \
|
blockActor = \
|
||||||
localActorUrl(http_prefix,
|
local_actor_url(http_prefix,
|
||||||
blockNickname, blockDomain)
|
blockNickname,
|
||||||
|
blockDomain)
|
||||||
if currIndex > 0 and boxJson and not blockActor:
|
if currIndex > 0 and boxJson and not blockActor:
|
||||||
post_json_object = \
|
post_json_object = \
|
||||||
_desktopGetBoxPostObject(boxJson, currIndex)
|
_desktopGetBoxPostObject(boxJson, currIndex)
|
||||||
|
|
|
@ -34,7 +34,7 @@ import os
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
|
|
||||||
|
|
||||||
def E2EEremoveDevice(base_dir: str, nickname: str, domain: str,
|
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)
|
personDir = acctDir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(personDir):
|
if not os.path.isdir(personDir):
|
||||||
return {}
|
return {}
|
||||||
personId = localActorUrl(http_prefix, nickname, domain_full)
|
personId = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
if not os.path.isdir(personDir + '/devices'):
|
if not os.path.isdir(personDir + '/devices'):
|
||||||
os.mkdir(personDir + '/devices')
|
os.mkdir(personDir + '/devices')
|
||||||
deviceList = []
|
deviceList = []
|
||||||
|
|
32
follow.py
32
follow.py
|
@ -29,7 +29,7 @@ from utils import isAccountDir
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from acceptreject import createAccept
|
from acceptreject import createAccept
|
||||||
from acceptreject import createReject
|
from acceptreject import createReject
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
|
@ -70,7 +70,7 @@ def createInitialLastSeen(base_dir: str, http_prefix: str) -> None:
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
if nickname.startswith('!'):
|
if nickname.startswith('!'):
|
||||||
nickname = nickname[1:]
|
nickname = nickname[1:]
|
||||||
actor = localActorUrl(http_prefix, nickname, domain)
|
actor = local_actor_url(http_prefix, nickname, domain)
|
||||||
lastSeenFilename = \
|
lastSeenFilename = \
|
||||||
lastSeenDir + '/' + actor.replace('/', '#') + '.txt'
|
lastSeenDir + '/' + actor.replace('/', '#') + '.txt'
|
||||||
if not os.path.isfile(lastSeenFilename):
|
if not os.path.isfile(lastSeenFilename):
|
||||||
|
@ -468,10 +468,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||||
|
|
||||||
if headerOnly:
|
if headerOnly:
|
||||||
firstStr = \
|
firstStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + followFile + '?page=1'
|
'/' + followFile + '?page=1'
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + '/' + followFile
|
local_actor_url(http_prefix, nickname, domain) + '/' + followFile
|
||||||
totalStr = \
|
totalStr = \
|
||||||
_getNoOfFollows(base_dir, nickname, domain, authorized)
|
_getNoOfFollows(base_dir, nickname, domain, authorized)
|
||||||
following = {
|
following = {
|
||||||
|
@ -488,10 +488,10 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||||
|
|
||||||
nextPageNumber = int(pageNumber + 1)
|
nextPageNumber = int(pageNumber + 1)
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + followFile + '?page=' + str(pageNumber)
|
'/' + followFile + '?page=' + str(pageNumber)
|
||||||
partOfStr = \
|
partOfStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + '/' + followFile
|
local_actor_url(http_prefix, nickname, domain) + '/' + followFile
|
||||||
following = {
|
following = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': idStr,
|
'id': idStr,
|
||||||
|
@ -529,7 +529,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||||
dom = line2.split('@')[1]
|
dom = line2.split('@')[1]
|
||||||
if not nick.startswith('!'):
|
if not nick.startswith('!'):
|
||||||
# person actor
|
# person actor
|
||||||
url = localActorUrl(http_prefix, nick, dom)
|
url = local_actor_url(http_prefix, nick, dom)
|
||||||
else:
|
else:
|
||||||
# group actor
|
# group actor
|
||||||
url = http_prefix + '://' + dom + '/c/' + nick
|
url = http_prefix + '://' + dom + '/c/' + nick
|
||||||
|
@ -553,7 +553,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
if nextPageNumber > lastPage:
|
if nextPageNumber > lastPage:
|
||||||
following['next'] = \
|
following['next'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + followFile + '?page=' + str(lastPage)
|
'/' + followFile + '?page=' + str(lastPage)
|
||||||
return following
|
return following
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ def sendFollowRequest(session, base_dir: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
fullDomain = getFullDomain(domain, port)
|
fullDomain = getFullDomain(domain, port)
|
||||||
followActor = localActorUrl(http_prefix, nickname, fullDomain)
|
followActor = local_actor_url(http_prefix, nickname, fullDomain)
|
||||||
|
|
||||||
requestDomain = getFullDomain(followDomain, followPort)
|
requestDomain = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ def sendFollowRequestViaServer(base_dir: str, session,
|
||||||
|
|
||||||
followDomainFull = getFullDomain(followDomain, followPort)
|
followDomainFull = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
followActor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
followedId = \
|
followedId = \
|
||||||
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ def sendUnfollowRequestViaServer(base_dir: str, session,
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
followDomainFull = getFullDomain(followDomain, followPort)
|
followDomainFull = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
followActor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
followActor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
followedId = \
|
followedId = \
|
||||||
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
http_prefix + '://' + followDomainFull + '/@' + followNickname
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
@ -1138,7 +1138,7 @@ def getFollowingViaServer(base_dir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
@ -1179,7 +1179,7 @@ def getFollowersViaServer(base_dir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
@ -1221,7 +1221,7 @@ def getFollowRequestsViaServer(base_dir: str, session,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -1263,7 +1263,7 @@ def approveFollowRequestViaServer(base_dir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
@ -1304,7 +1304,7 @@ def denyFollowRequestViaServer(base_dir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import datetime
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getSHA256
|
from utils import getSHA256
|
||||||
from utils import getSHA512
|
from utils import getSHA512
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
|
|
||||||
|
|
||||||
def messageContentDigest(messageBodyJsonStr: str, digestAlgorithm: str) -> str:
|
def messageContentDigest(messageBodyJsonStr: str, digestAlgorithm: str) -> str:
|
||||||
|
@ -83,7 +83,7 @@ def signPostHeaders(dateStr: str, privateKeyPem: str,
|
||||||
if not dateStr:
|
if not dateStr:
|
||||||
dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
||||||
if nickname != domain and nickname.lower() != 'actor':
|
if nickname != domain and nickname.lower() != 'actor':
|
||||||
keyID = localActorUrl(http_prefix, nickname, domain)
|
keyID = local_actor_url(http_prefix, nickname, domain)
|
||||||
else:
|
else:
|
||||||
# instance actor
|
# instance actor
|
||||||
keyID = http_prefix + '://' + domain + '/actor'
|
keyID = http_prefix + '://' + domain + '/actor'
|
||||||
|
@ -168,7 +168,7 @@ def signPostHeadersNew(dateStr: str, privateKeyPem: str,
|
||||||
currTime = datetime.datetime.strptime(dateStr, timeFormat)
|
currTime = datetime.datetime.strptime(dateStr, timeFormat)
|
||||||
secondsSinceEpoch = \
|
secondsSinceEpoch = \
|
||||||
int((currTime - datetime.datetime(1970, 1, 1)).total_seconds())
|
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:
|
if not messageBodyJsonStr:
|
||||||
headers = {
|
headers = {
|
||||||
'@request-target': f'get {path}',
|
'@request-target': f'get {path}',
|
||||||
|
|
18
inbox.py
18
inbox.py
|
@ -59,7 +59,7 @@ from utils import saveJson
|
||||||
from utils import undoLikesCollectionEntry
|
from utils import undoLikesCollectionEntry
|
||||||
from utils import undoReactionCollectionEntry
|
from utils import undoReactionCollectionEntry
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
from categories import getHashtagCategories
|
from categories import getHashtagCategories
|
||||||
from categories import setHashtagCategory
|
from categories import setHashtagCategory
|
||||||
|
@ -186,7 +186,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
||||||
else:
|
else:
|
||||||
print('WARN: no modified date for ' + str(lastModified))
|
print('WARN: no modified date for ' + str(lastModified))
|
||||||
if saveSwarm:
|
if saveSwarm:
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
newSwarmStr = htmlHashTagSwarm(base_dir, actor, translate)
|
newSwarmStr = htmlHashTagSwarm(base_dir, actor, translate)
|
||||||
if newSwarmStr:
|
if newSwarmStr:
|
||||||
try:
|
try:
|
||||||
|
@ -544,7 +544,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
||||||
if actor:
|
if actor:
|
||||||
postId = actor + '/statuses/' + statusNumber
|
postId = actor + '/statuses/' + statusNumber
|
||||||
else:
|
else:
|
||||||
postId = localActorUrl(http_prefix, nickname, originalDomain) + \
|
postId = local_actor_url(http_prefix, nickname, originalDomain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
# NOTE: don't change post_json_object['id'] before signature check
|
# 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('!', '')
|
nickname = handle.split('@')[0].replace('!', '')
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
domain_full = getFullDomain(domain, port)
|
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']:
|
if groupActor not in post_json_object['to']:
|
||||||
return
|
return
|
||||||
cc = ''
|
cc = ''
|
||||||
|
@ -2904,7 +2904,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
if not os.path.isfile(followDMsFilename):
|
if not os.path.isfile(followDMsFilename):
|
||||||
# dm index will be updated
|
# dm index will be updated
|
||||||
updateIndexList.append('dm')
|
updateIndexList.append('dm')
|
||||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
actUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
_dmNotify(base_dir, handle, actUrl + '/dm')
|
_dmNotify(base_dir, handle, actUrl + '/dm')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -2975,7 +2975,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
# dm index will be updated
|
# dm index will be updated
|
||||||
updateIndexList.append('dm')
|
updateIndexList.append('dm')
|
||||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
actUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
_dmNotify(base_dir, handle, actUrl + '/dm')
|
_dmNotify(base_dir, handle, actUrl + '/dm')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -3108,7 +3108,7 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
||||||
default_reply_interval_hrs)
|
default_reply_interval_hrs)
|
||||||
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
||||||
replyIntervalHours):
|
replyIntervalHours):
|
||||||
actUrl = localActorUrl(http_prefix, nickname, domain)
|
actUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
_replyNotify(base_dir, handle, actUrl + '/tlreplies')
|
_replyNotify(base_dir, handle, actUrl + '/tlreplies')
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -3148,7 +3148,7 @@ def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
|
||||||
postId = removeIdEnding(jsonObj['id'])
|
postId = removeIdEnding(jsonObj['id'])
|
||||||
domFull = getFullDomain(domain, port)
|
domFull = getFullDomain(domain, port)
|
||||||
postLink = \
|
postLink = \
|
||||||
localActorUrl(http_prefix, nickname, domFull) + \
|
local_actor_url(http_prefix, nickname, domFull) + \
|
||||||
'?notifypost=' + postId.replace('/', '-')
|
'?notifypost=' + postId.replace('/', '-')
|
||||||
_notifyPostArrival(base_dir, handle, postLink)
|
_notifyPostArrival(base_dir, handle, postLink)
|
||||||
|
|
||||||
|
@ -3495,7 +3495,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# get the actor being replied to
|
# 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
|
# create a reply notification file if needed
|
||||||
isReplyToMutedPost = \
|
isReplyToMutedPost = \
|
||||||
|
|
|
@ -14,7 +14,7 @@ from utils import getActorLanguagesList
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import hasObjectDict
|
from utils import hasObjectDict
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from cache import getPersonFromCache
|
from cache import getPersonFromCache
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
||||||
return True
|
return True
|
||||||
if msgObject['contentMap'].get(system_language):
|
if msgObject['contentMap'].get(system_language):
|
||||||
return True
|
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)
|
actorJson = getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||||
if not actorJson:
|
if not actorJson:
|
||||||
print('WARN: unable to load actor to check languages ' + personUrl)
|
print('WARN: unable to load actor to check languages ' + personUrl)
|
||||||
|
|
10
like.py
10
like.py
|
@ -23,7 +23,7 @@ from utils import getDomainFromActor
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import undoLikesCollectionEntry
|
from utils import undoLikesCollectionEntry
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import removePostFromCache
|
from utils import removePostFromCache
|
||||||
|
@ -91,7 +91,7 @@ def _like(recentPostsCache: {},
|
||||||
newLikeJson = {
|
newLikeJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Like',
|
'type': 'Like',
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
if ccList:
|
if ccList:
|
||||||
|
@ -158,7 +158,7 @@ def likePost(recentPostsCache: {},
|
||||||
"""
|
"""
|
||||||
likeDomain = getFullDomain(likeDomain, likePort)
|
likeDomain = getFullDomain(likeDomain, likePort)
|
||||||
|
|
||||||
actorLiked = localActorUrl(http_prefix, likeNickname, likeDomain)
|
actorLiked = local_actor_url(http_prefix, likeNickname, likeDomain)
|
||||||
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
|
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
|
||||||
|
|
||||||
return _like(recentPostsCache,
|
return _like(recentPostsCache,
|
||||||
|
@ -183,7 +183,7 @@ def sendLikeViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newLikeJson = {
|
newLikeJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
@ -266,7 +266,7 @@ def sendUndoLikeViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newUndoLikeJson = {
|
newUndoLikeJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
|
@ -33,7 +33,7 @@ from utils import saveJson
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
from utils import clearFromPostCaches
|
from utils import clearFromPostCaches
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from inbox import storeHashTags
|
from inbox import storeHashTags
|
||||||
from session import createSession
|
from session import createSession
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber(dateStr)
|
statusNumber, published = getStatusNumber(dateStr)
|
||||||
newPostId = \
|
newPostId = \
|
||||||
localActorUrl(http_prefix, 'news', domain) + \
|
local_actor_url(http_prefix, 'news', domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
# file where the post is stored
|
# file where the post is stored
|
||||||
|
@ -649,7 +649,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||||
continue
|
continue
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, 'news', domain) + \
|
local_actor_url(http_prefix, 'news', domain) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
blog['news'] = True
|
blog['news'] = True
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ from utils import containsInvalidChars
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
from blocking import isBlockedHashtag
|
from blocking import isBlockedHashtag
|
||||||
from filters import isFiltered
|
from filters import isFiltered
|
||||||
|
@ -73,7 +73,7 @@ def rss2Header(http_prefix: str,
|
||||||
rssStr += \
|
rssStr += \
|
||||||
' <title>' + translate[title] + '</title>' + \
|
' <title>' + translate[title] + '</title>' + \
|
||||||
' <link>' + \
|
' <link>' + \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/rss.xml' + '</link>'
|
'/rss.xml' + '</link>'
|
||||||
return rssStr
|
return rssStr
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ from utils import isFeaturedWriter
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
from blocking import outboxBlock
|
from blocking import outboxBlock
|
||||||
|
@ -101,7 +101,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
||||||
print('DEBUG: c2s actor update id is not a string')
|
print('DEBUG: c2s actor update id is not a string')
|
||||||
return
|
return
|
||||||
domain_full = getFullDomain(domain, port)
|
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 len(message_json['to']) != 1:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s actor update - to does not contain one actor ' +
|
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:
|
if message_json['type'] in indexedActivities:
|
||||||
indexes = [outboxName, "inbox"]
|
indexes = [outboxName, "inbox"]
|
||||||
selfActor = \
|
selfActor = \
|
||||||
localActorUrl(http_prefix, postToNickname, domain_full)
|
local_actor_url(http_prefix, postToNickname, domain_full)
|
||||||
for boxNameIndex in indexes:
|
for boxNameIndex in indexes:
|
||||||
if not boxNameIndex:
|
if not boxNameIndex:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -58,7 +58,7 @@ from utils import isImageFile
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import getGroupPaths
|
from utils import getGroupPaths
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import dangerousSVG
|
from utils import dangerousSVG
|
||||||
from session import createSession
|
from session import createSession
|
||||||
from session import getJson
|
from session import getJson
|
||||||
|
@ -149,7 +149,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
|
||||||
if personJson:
|
if personJson:
|
||||||
personJson[iconFilenameBase]['mediaType'] = mediaType
|
personJson[iconFilenameBase]['mediaType'] = mediaType
|
||||||
personJson[iconFilenameBase]['url'] = \
|
personJson[iconFilenameBase]['url'] = \
|
||||||
localActorUrl(http_prefix, nickname, fullDomain) + \
|
local_actor_url(http_prefix, nickname, fullDomain) + \
|
||||||
'/' + iconFilename
|
'/' + iconFilename
|
||||||
saveJson(personJson, personFilename)
|
saveJson(personJson, personFilename)
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ def _createPersonBase(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
# Enable follower approval by default
|
# Enable follower approval by default
|
||||||
approveFollowers = manual_follower_approval
|
approveFollowers = manual_follower_approval
|
||||||
personName = nickname
|
personName = nickname
|
||||||
personId = localActorUrl(http_prefix, nickname, domain)
|
personId = local_actor_url(http_prefix, nickname, domain)
|
||||||
inboxStr = personId + '/inbox'
|
inboxStr = personId + '/inbox'
|
||||||
personUrl = http_prefix + '://' + domain + '/@' + personName
|
personUrl = http_prefix + '://' + domain + '/@' + personName
|
||||||
if nickname == 'inbox':
|
if nickname == 'inbox':
|
||||||
|
|
4
pgp.py
4
pgp.py
|
@ -15,7 +15,7 @@ from utils import containsPGPPublicKey
|
||||||
from utils import isPGPEncrypted
|
from utils import isPGPEncrypted
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import replaceUsersWithAt
|
from utils import replaceUsersWithAt
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from posts import getPersonBox
|
from posts import getPersonBox
|
||||||
|
@ -500,7 +500,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
||||||
if debug:
|
if debug:
|
||||||
print('Actor for ' + handle + ' obtained')
|
print('Actor for ' + handle + ' obtained')
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
handle = replaceUsersWithAt(actor)
|
handle = replaceUsersWithAt(actor)
|
||||||
|
|
||||||
# check that this looks like the correct actor
|
# check that this looks like the correct actor
|
||||||
|
|
76
posts.py
76
posts.py
|
@ -68,7 +68,7 @@ from utils import votesOnNewswireItem
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from media import attachMedia
|
from media import attachMedia
|
||||||
from media import replaceYouTube
|
from media import replaceYouTube
|
||||||
from media import replaceTwitter
|
from media import replaceTwitter
|
||||||
|
@ -359,7 +359,7 @@ def getPersonBox(signing_priv_key_pem: str, originDomain: str,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
# the final fallback is a mastodon style url
|
# 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:
|
if not personUrl:
|
||||||
return None, None, None, None, None, None, None, None
|
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:
|
if not postId:
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
postId = \
|
postId = \
|
||||||
localActorUrl(http_prefix, nickname, originalDomain) + \
|
local_actor_url(http_prefix, nickname, originalDomain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
post_json_object['id'] = postId + '/activity'
|
post_json_object['id'] = postId + '/activity'
|
||||||
if hasObjectDict(post_json_object):
|
if hasObjectDict(post_json_object):
|
||||||
|
@ -1076,14 +1076,14 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Creates a new server-to-server post
|
"""Creates a new server-to-server post
|
||||||
"""
|
"""
|
||||||
actorUrl = localActorUrl(http_prefix, nickname, domain)
|
actorUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
newPostUrl = \
|
newPostUrl = \
|
||||||
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
newPostAttributedTo = \
|
newPostAttributedTo = \
|
||||||
localActorUrl(http_prefix, nickname, domain)
|
local_actor_url(http_prefix, nickname, domain)
|
||||||
if not conversationId:
|
if not conversationId:
|
||||||
conversationId = newPostId
|
conversationId = newPostId
|
||||||
newPost = {
|
newPost = {
|
||||||
|
@ -1153,7 +1153,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
"""
|
"""
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
idStr = \
|
idStr = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
local_actor_url(http_prefix, nickname, domain_full) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
newPostUrl = \
|
newPostUrl = \
|
||||||
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
|
@ -1168,7 +1168,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
'inReplyTo': inReplyTo,
|
'inReplyTo': inReplyTo,
|
||||||
'published': published,
|
'published': published,
|
||||||
'url': newPostUrl,
|
'url': newPostUrl,
|
||||||
'attributedTo': localActorUrl(http_prefix, nickname, domain_full),
|
'attributedTo': local_actor_url(http_prefix, nickname, domain_full),
|
||||||
'to': toRecipients,
|
'to': toRecipients,
|
||||||
'cc': toCC,
|
'cc': toCC,
|
||||||
'sensitive': sensitive,
|
'sensitive': sensitive,
|
||||||
|
@ -1428,7 +1428,7 @@ def _createPostBase(base_dir: str,
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newPostId = \
|
newPostId = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
sensitive = False
|
sensitive = False
|
||||||
|
@ -1574,7 +1574,7 @@ def outboxMessageCreateWrap(http_prefix: str,
|
||||||
if message_json.get('published'):
|
if message_json.get('published'):
|
||||||
published = message_json['published']
|
published = message_json['published']
|
||||||
newPostId = \
|
newPostId = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
cc = []
|
cc = []
|
||||||
if message_json.get('cc'):
|
if message_json.get('cc'):
|
||||||
|
@ -1583,7 +1583,7 @@ def outboxMessageCreateWrap(http_prefix: str,
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'id': newPostId + '/activity',
|
'id': newPostId + '/activity',
|
||||||
'type': 'Create',
|
'type': 'Create',
|
||||||
'actor': localActorUrl(http_prefix, nickname, domain),
|
'actor': local_actor_url(http_prefix, nickname, domain),
|
||||||
'published': published,
|
'published': published,
|
||||||
'to': message_json['to'],
|
'to': message_json['to'],
|
||||||
'cc': cc,
|
'cc': cc,
|
||||||
|
@ -1593,7 +1593,7 @@ def outboxMessageCreateWrap(http_prefix: str,
|
||||||
newPost['object']['url'] = \
|
newPost['object']['url'] = \
|
||||||
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
newPost['object']['atomUri'] = \
|
newPost['object']['atomUri'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
|
@ -1623,7 +1623,7 @@ def _postIsAddressedToFollowers(base_dir: str,
|
||||||
ccList = post_json_object['cc']
|
ccList = post_json_object['cc']
|
||||||
|
|
||||||
followersUrl = \
|
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?
|
# does the followers url exist in 'to' or 'cc' lists?
|
||||||
addressedToFollowers = False
|
addressedToFollowers = False
|
||||||
|
@ -1667,7 +1667,7 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acctDir(base_dir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
pinnedPostJson = {}
|
pinnedPostJson = {}
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
if os.path.isfile(pinnedFilename):
|
if os.path.isfile(pinnedFilename):
|
||||||
pinnedContent = None
|
pinnedContent = None
|
||||||
with open(pinnedFilename, 'r') as pinFile:
|
with open(pinnedFilename, 'r') as pinFile:
|
||||||
|
@ -1712,7 +1712,7 @@ def jsonPinPost(base_dir: str, http_prefix: str,
|
||||||
if pinnedPostJson:
|
if pinnedPostJson:
|
||||||
itemsList = [pinnedPostJson]
|
itemsList = [pinnedPostJson]
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
postContext = getIndividualPostContext()
|
postContext = getIndividualPostContext()
|
||||||
return {
|
return {
|
||||||
'@context': postContext,
|
'@context': postContext,
|
||||||
|
@ -1783,7 +1783,7 @@ def createPublicPost(base_dir: str,
|
||||||
anonymousParticipationEnabled = None
|
anonymousParticipationEnabled = None
|
||||||
eventStatus = None
|
eventStatus = None
|
||||||
ticketUrl = 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,
|
return _createPostBase(base_dir, nickname, domain, port,
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
localActor + '/followers',
|
localActor + '/followers',
|
||||||
|
@ -1908,7 +1908,7 @@ def createQuestionPost(base_dir: str,
|
||||||
"""Question post with multiple choice options
|
"""Question post with multiple choice options
|
||||||
"""
|
"""
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
localActor = localActorUrl(http_prefix, nickname, domain_full)
|
localActor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
message_json = \
|
message_json = \
|
||||||
_createPostBase(base_dir, nickname, domain, port,
|
_createPostBase(base_dir, nickname, domain, port,
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'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.
|
"""Unlisted post. This has the #Public and followers links inverted.
|
||||||
"""
|
"""
|
||||||
domain_full = getFullDomain(domain, port)
|
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,
|
return _createPostBase(base_dir, nickname, domain, port,
|
||||||
localActor + '/followers',
|
localActor + '/followers',
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
|
@ -1993,7 +1993,7 @@ def createFollowersOnlyPost(base_dir: str,
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
domain_full = getFullDomain(domain, port)
|
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,
|
return _createPostBase(base_dir, nickname, domain, port,
|
||||||
localActor + '/followers',
|
localActor + '/followers',
|
||||||
None,
|
None,
|
||||||
|
@ -2040,7 +2040,8 @@ def getMentionedPeople(base_dir: str, http_prefix: str,
|
||||||
if not validNickname(mentionedDomain, mentionedNickname):
|
if not validNickname(mentionedDomain, mentionedNickname):
|
||||||
continue
|
continue
|
||||||
actor = \
|
actor = \
|
||||||
localActorUrl(http_prefix, mentionedNickname, handle.split('@')[1])
|
local_actor_url(http_prefix, mentionedNickname,
|
||||||
|
handle.split('@')[1])
|
||||||
mentions.append(actor)
|
mentions.append(actor)
|
||||||
return mentions
|
return mentions
|
||||||
|
|
||||||
|
@ -2135,7 +2136,7 @@ def createReportPost(base_dir: str,
|
||||||
if '@' in line:
|
if '@' in line:
|
||||||
nick = line.split('@')[0]
|
nick = line.split('@')[0]
|
||||||
moderatorActor = \
|
moderatorActor = \
|
||||||
localActorUrl(http_prefix, nick, domain_full)
|
local_actor_url(http_prefix, nick, domain_full)
|
||||||
if moderatorActor not in moderatorsList:
|
if moderatorActor not in moderatorsList:
|
||||||
moderatorsList.append(moderatorActor)
|
moderatorsList.append(moderatorActor)
|
||||||
continue
|
continue
|
||||||
|
@ -2147,14 +2148,15 @@ def createReportPost(base_dir: str,
|
||||||
else:
|
else:
|
||||||
if '/' not in line:
|
if '/' not in line:
|
||||||
moderatorActor = \
|
moderatorActor = \
|
||||||
localActorUrl(http_prefix, line, domain_full)
|
local_actor_url(http_prefix, line, domain_full)
|
||||||
if moderatorActor not in moderatorsList:
|
if moderatorActor not in moderatorsList:
|
||||||
moderatorsList.append(moderatorActor)
|
moderatorsList.append(moderatorActor)
|
||||||
if len(moderatorsList) == 0:
|
if len(moderatorsList) == 0:
|
||||||
# if there are no moderators then the admin becomes the moderator
|
# if there are no moderators then the admin becomes the moderator
|
||||||
adminNickname = getConfigParam(base_dir, 'admin')
|
adminNickname = getConfigParam(base_dir, 'admin')
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
localActor = localActorUrl(http_prefix, adminNickname, domain_full)
|
localActor = \
|
||||||
|
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||||
moderatorsList.append(localActor)
|
moderatorsList.append(localActor)
|
||||||
if not moderatorsList:
|
if not moderatorsList:
|
||||||
return None
|
return None
|
||||||
|
@ -2486,17 +2488,17 @@ def sendPostViaServer(signing_priv_key_pem: str, project_version: str,
|
||||||
client_to_server = True
|
client_to_server = True
|
||||||
if toDomain.lower().endswith('public'):
|
if toDomain.lower().endswith('public'):
|
||||||
toPersonId = 'https://www.w3.org/ns/activitystreams#Public'
|
toPersonId = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
cc = localActorUrl(http_prefix, fromNickname, fromDomainFull) + \
|
cc = local_actor_url(http_prefix, fromNickname, fromDomainFull) + \
|
||||||
'/followers'
|
'/followers'
|
||||||
else:
|
else:
|
||||||
if toDomain.lower().endswith('followers') or \
|
if toDomain.lower().endswith('followers') or \
|
||||||
toDomain.lower().endswith('followersonly'):
|
toDomain.lower().endswith('followersonly'):
|
||||||
toPersonId = \
|
toPersonId = \
|
||||||
localActorUrl(http_prefix, fromNickname, fromDomainFull) + \
|
local_actor_url(http_prefix, fromNickname, fromDomainFull) + \
|
||||||
'/followers'
|
'/followers'
|
||||||
else:
|
else:
|
||||||
toDomainFull = getFullDomain(toDomain, toPort)
|
toDomainFull = getFullDomain(toDomain, toPort)
|
||||||
toPersonId = localActorUrl(http_prefix, toNickname, toDomainFull)
|
toPersonId = local_actor_url(http_prefix, toNickname, toDomainFull)
|
||||||
|
|
||||||
post_json_object = \
|
post_json_object = \
|
||||||
_createPostBase(base_dir,
|
_createPostBase(base_dir,
|
||||||
|
@ -3400,7 +3402,7 @@ def createModeration(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
|
|
||||||
pageStr = '?page=' + str(pageNumber)
|
pageStr = '?page=' + str(pageNumber)
|
||||||
boxUrl = localActorUrl(http_prefix, nickname, domain) + '/' + boxname
|
boxUrl = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
|
||||||
boxHeader = {
|
boxHeader = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'first': boxUrl + '?page=true',
|
'first': boxUrl + '?page=true',
|
||||||
|
@ -3688,7 +3690,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
originalDomain = domain
|
originalDomain = domain
|
||||||
domain = getFullDomain(domain, port)
|
domain = getFullDomain(domain, port)
|
||||||
|
|
||||||
boxActor = localActorUrl(http_prefix, nickname, domain)
|
boxActor = local_actor_url(http_prefix, nickname, domain)
|
||||||
|
|
||||||
pageStr = '?page=true'
|
pageStr = '?page=true'
|
||||||
if pageNumber:
|
if pageNumber:
|
||||||
|
@ -3700,7 +3702,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
print('EX: _createBoxIndexed ' +
|
print('EX: _createBoxIndexed ' +
|
||||||
'unable to convert page number to string')
|
'unable to convert page number to string')
|
||||||
pass
|
pass
|
||||||
boxUrl = localActorUrl(http_prefix, nickname, domain) + '/' + boxname
|
boxUrl = local_actor_url(http_prefix, nickname, domain) + '/' + boxname
|
||||||
boxHeader = {
|
boxHeader = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'first': boxUrl + '?page=true',
|
'first': boxUrl + '?page=true',
|
||||||
|
@ -3828,7 +3830,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
if lastPage < 1:
|
if lastPage < 1:
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
boxHeader['last'] = \
|
boxHeader['last'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + boxname + '?page=' + str(lastPage)
|
'/' + boxname + '?page=' + str(lastPage)
|
||||||
|
|
||||||
if headerOnly:
|
if headerOnly:
|
||||||
|
@ -3837,12 +3839,12 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
if pageNumber > 1:
|
if pageNumber > 1:
|
||||||
prevPageStr = str(pageNumber - 1)
|
prevPageStr = str(pageNumber - 1)
|
||||||
boxHeader['prev'] = \
|
boxHeader['prev'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + boxname + '?page=' + prevPageStr
|
'/' + boxname + '?page=' + prevPageStr
|
||||||
|
|
||||||
nextPageStr = str(pageNumber + 1)
|
nextPageStr = str(pageNumber + 1)
|
||||||
boxHeader['next'] = \
|
boxHeader['next'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + boxname + '?page=' + nextPageStr
|
'/' + boxname + '?page=' + nextPageStr
|
||||||
return boxHeader
|
return boxHeader
|
||||||
|
|
||||||
|
@ -4772,7 +4774,7 @@ def sendBlockViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = blockActor + '/followers'
|
ccUrl = blockActor + '/followers'
|
||||||
|
|
||||||
|
@ -4856,7 +4858,7 @@ def sendMuteViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
handle = replaceUsersWithAt(actor)
|
handle = replaceUsersWithAt(actor)
|
||||||
|
|
||||||
newMuteJson = {
|
newMuteJson = {
|
||||||
|
@ -4936,7 +4938,7 @@ def sendUndoMuteViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
handle = replaceUsersWithAt(actor)
|
handle = replaceUsersWithAt(actor)
|
||||||
|
|
||||||
undoMuteJson = {
|
undoMuteJson = {
|
||||||
|
@ -5022,7 +5024,7 @@ def sendUndoBlockViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = blockActor + '/followers'
|
ccUrl = blockActor + '/followers'
|
||||||
|
|
||||||
|
@ -5138,7 +5140,7 @@ def c2sBoxJson(base_dir: str, session,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
10
reaction.py
10
reaction.py
|
@ -25,7 +25,7 @@ from utils import getDomainFromActor
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import undoReactionCollectionEntry
|
from utils import undoReactionCollectionEntry
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import removePostFromCache
|
from utils import removePostFromCache
|
||||||
|
@ -87,7 +87,7 @@ def _reaction(recentPostsCache: {},
|
||||||
newReactionJson = {
|
newReactionJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'EmojiReact',
|
'type': 'EmojiReact',
|
||||||
'actor': localActorUrl(http_prefix, nickname, fullDomain),
|
'actor': local_actor_url(http_prefix, nickname, fullDomain),
|
||||||
'object': objectUrl,
|
'object': objectUrl,
|
||||||
'content': emojiContent
|
'content': emojiContent
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ def reactionPost(recentPostsCache: {},
|
||||||
reactionDomain = getFullDomain(reactionDomain, reactionPort)
|
reactionDomain = getFullDomain(reactionDomain, reactionPort)
|
||||||
|
|
||||||
actorReaction = \
|
actorReaction = \
|
||||||
localActorUrl(http_prefix, reactionNickname, reactionDomain)
|
local_actor_url(http_prefix, reactionNickname, reactionDomain)
|
||||||
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
|
objectUrl = actorReaction + '/statuses/' + str(reactionStatusNumber)
|
||||||
|
|
||||||
return _reaction(recentPostsCache,
|
return _reaction(recentPostsCache,
|
||||||
|
@ -193,7 +193,7 @@ def sendReactionViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newReactionJson = {
|
newReactionJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
@ -279,7 +279,7 @@ def sendUndoReactionViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, fromNickname, fromDomainFull)
|
actor = local_actor_url(http_prefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newUndoReactionJson = {
|
newUndoReactionJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
26
shares.py
26
shares.py
|
@ -37,7 +37,7 @@ from utils import acctDir
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import getCategoryTypes
|
from utils import getCategoryTypes
|
||||||
from utils import getSharesFilesList
|
from utils import getSharesFilesList
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from media import processMetaData
|
from media import processMetaData
|
||||||
from media import convertImageToLowBandwidth
|
from media import convertImageToLowBandwidth
|
||||||
from filters import isFilteredGlobally
|
from filters import isFilteredGlobally
|
||||||
|
@ -287,7 +287,7 @@ def _indicateNewShareAvailable(base_dir: str, http_prefix: str,
|
||||||
nickname, domain, None):
|
nickname, domain, None):
|
||||||
continue
|
continue
|
||||||
localActor = \
|
localActor = \
|
||||||
localActorUrl(http_prefix, accountNickname, domain_full)
|
local_actor_url(http_prefix, accountNickname, domain_full)
|
||||||
try:
|
try:
|
||||||
with open(newShareFile, 'w+') as fp:
|
with open(newShareFile, 'w+') as fp:
|
||||||
if sharesFileType == 'shares':
|
if sharesFileType == 'shares':
|
||||||
|
@ -327,7 +327,7 @@ def addShare(base_dir: str,
|
||||||
durationSec = _addShareDurationSec(duration, published)
|
durationSec = _addShareDurationSec(duration, published)
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
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)
|
itemID = _getValidSharedItemID(actor, displayName)
|
||||||
dfcId = _getshareDfcId(base_dir, system_language,
|
dfcId = _getshareDfcId(base_dir, system_language,
|
||||||
itemType, itemCategory, translate,
|
itemType, itemCategory, translate,
|
||||||
|
@ -499,7 +499,7 @@ def getSharesFeedForPerson(base_dir: str,
|
||||||
sharesJson = loadJson(sharesFilename)
|
sharesJson = loadJson(sharesFilename)
|
||||||
if sharesJson:
|
if sharesJson:
|
||||||
noOfShares = len(sharesJson.items())
|
noOfShares = len(sharesJson.items())
|
||||||
idStr = localActorUrl(http_prefix, nickname, domain)
|
idStr = local_actor_url(http_prefix, nickname, domain)
|
||||||
shares = {
|
shares = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'first': idStr + '/' + sharesFileType + '?page=1',
|
'first': idStr + '/' + sharesFileType + '?page=1',
|
||||||
|
@ -513,7 +513,7 @@ def getSharesFeedForPerson(base_dir: str,
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
|
|
||||||
nextPageNumber = int(pageNumber + 1)
|
nextPageNumber = int(pageNumber + 1)
|
||||||
idStr = localActorUrl(http_prefix, nickname, domain)
|
idStr = local_actor_url(http_prefix, nickname, domain)
|
||||||
shares = {
|
shares = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': idStr + '/' + sharesFileType + '?page=' + str(pageNumber),
|
'id': idStr + '/' + sharesFileType + '?page=' + str(pageNumber),
|
||||||
|
@ -546,7 +546,7 @@ def getSharesFeedForPerson(base_dir: str,
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
if nextPageNumber > lastPage:
|
if nextPageNumber > lastPage:
|
||||||
shares['next'] = \
|
shares['next'] = \
|
||||||
localActorUrl(http_prefix, nickname, domain) + \
|
local_actor_url(http_prefix, nickname, domain) + \
|
||||||
'/' + sharesFileType + '?page=' + str(lastPage)
|
'/' + sharesFileType + '?page=' + str(lastPage)
|
||||||
return shares
|
return shares
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ def sendShareViaServer(base_dir, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ def sendUndoShareViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ def sendWantedViaServer(base_dir, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
@ -911,7 +911,7 @@ def sendUndoWantedViaServer(base_dir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
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'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
@ -1011,7 +1011,7 @@ def getSharedItemsCatalogViaServer(base_dir, session,
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
}
|
}
|
||||||
domain_full = getFullDomain(domain, port)
|
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:
|
if debug:
|
||||||
print('Shared items catalog request to: ' + url)
|
print('Shared items catalog request to: ' + url)
|
||||||
catalogJson = getJson(signing_priv_key_pem, session, url, headers, None,
|
catalogJson = getJson(signing_priv_key_pem, session, url, headers, None,
|
||||||
|
@ -1172,7 +1172,7 @@ def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
||||||
dfcPtUrl = \
|
dfcPtUrl = \
|
||||||
http_prefix + '://' + domain_full + \
|
http_prefix + '://' + domain_full + \
|
||||||
'/ontologies/DFC_ProductGlossary.rdf#'
|
'/ontologies/DFC_ProductGlossary.rdf#'
|
||||||
owner = localActorUrl(http_prefix, nickname, domain_full)
|
owner = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
if sharesFileType == 'shares':
|
if sharesFileType == 'shares':
|
||||||
dfcInstanceId = owner + '/catalog'
|
dfcInstanceId = owner + '/catalog'
|
||||||
else:
|
else:
|
||||||
|
@ -1283,7 +1283,7 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
||||||
continue
|
continue
|
||||||
nickname = acct.split('@')[0]
|
nickname = acct.split('@')[0]
|
||||||
domain = acct.split('@')[1]
|
domain = acct.split('@')[1]
|
||||||
owner = localActorUrl(http_prefix, nickname, domain_full)
|
owner = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + \
|
acctDir(base_dir, nickname, domain) + '/' + \
|
||||||
|
|
|
@ -20,7 +20,7 @@ from utils import loadJson
|
||||||
from utils import getOccupationSkills
|
from utils import getOccupationSkills
|
||||||
from utils import setOccupationSkillsList
|
from utils import setOccupationSkillsList
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
toUrl = actor
|
toUrl = actor
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ from utils import saveJson
|
||||||
from utils import isPGPEncrypted
|
from utils import isPGPEncrypted
|
||||||
from utils import hasObjectDict
|
from utils import hasObjectDict
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
|
|
||||||
speakerRemoveChars = ('.\n', '. ', ',', ';', '?', '!')
|
speakerRemoveChars = ('.\n', '. ', ',', ';', '?', '!')
|
||||||
|
@ -454,7 +454,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
||||||
img['name'] + '. '
|
img['name'] + '. '
|
||||||
|
|
||||||
isDirect = isDM(post_json_object)
|
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)
|
replyToYou = isReply(post_json_object, actor)
|
||||||
|
|
||||||
published = ''
|
published = ''
|
||||||
|
|
4
theme.py
4
theme.py
|
@ -15,7 +15,7 @@ from utils import getImageExtensions
|
||||||
from utils import copytree
|
from utils import copytree
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import dangerousSVG
|
from utils import dangerousSVG
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from shutil import make_archive
|
from shutil import make_archive
|
||||||
from shutil import unpack_archive
|
from shutil import unpack_archive
|
||||||
|
@ -788,7 +788,7 @@ def setNewsAvatar(base_dir: str, name: str,
|
||||||
if not os.path.isfile(newFilename):
|
if not os.path.isfile(newFilename):
|
||||||
return
|
return
|
||||||
avatarFilename = \
|
avatarFilename = \
|
||||||
localActorUrl(http_prefix, domain_full, nickname) + '.png'
|
local_actor_url(http_prefix, domain_full, nickname) + '.png'
|
||||||
avatarFilename = avatarFilename.replace('/', '-')
|
avatarFilename = avatarFilename.replace('/', '-')
|
||||||
filename = base_dir + '/cache/avatars/' + avatarFilename
|
filename = base_dir + '/cache/avatars/' + avatarFilename
|
||||||
|
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -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
|
"""Returns the url for an actor on this instance
|
||||||
"""
|
"""
|
||||||
return http_prefix + '://' + domain_full + '/users/' + nickname
|
return http_prefix + '://' + domain_full + '/users/' + nickname
|
||||||
|
|
|
@ -20,7 +20,7 @@ from utils import weekDayOfMonthStart
|
||||||
from utils import getAltPath
|
from utils import getAltPath
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import replaceUsersWithAt
|
from utils import replaceUsersWithAt
|
||||||
from happening import getTodaysEvents
|
from happening import getTodaysEvents
|
||||||
from happening import getCalendarEvents
|
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
|
"""Shows a screen asking to confirm the deletion of a calendar event
|
||||||
"""
|
"""
|
||||||
nickname = getNicknameFromActor(path)
|
nickname = getNicknameFromActor(path)
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = getDomainFromActor(actor)
|
||||||
messageId = actor + '/statuses/' + postId
|
messageId = actor + '/statuses/' + postId
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ from utils import getNicknameFromActor
|
||||||
from utils import isEditor
|
from utils import isEditor
|
||||||
from utils import isArtist
|
from utils import isArtist
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from webapp_utils import sharesTimelineJson
|
from webapp_utils import sharesTimelineJson
|
||||||
from webapp_utils import htmlPostSeparator
|
from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import getLeftImageFile
|
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
|
"""get any shares and turn them into the left column links format
|
||||||
"""
|
"""
|
||||||
pageNumber = 1
|
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
|
# NOTE: this could potentially be slow if the number of federated
|
||||||
# shared items is large
|
# shared items is large
|
||||||
sharesJson, lastPage = \
|
sharesJson, lastPage = \
|
||||||
|
@ -83,7 +83,7 @@ def _getLeftColumnWanted(base_dir: str,
|
||||||
"""get any wanted items and turn them into the left column links format
|
"""get any wanted items and turn them into the left column links format
|
||||||
"""
|
"""
|
||||||
pageNumber = 1
|
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
|
# NOTE: this could potentially be slow if the number of federated
|
||||||
# wanted items is large
|
# wanted items is large
|
||||||
sharesJson, lastPage = \
|
sharesJson, lastPage = \
|
||||||
|
|
|
@ -16,7 +16,7 @@ from utils import loadJson
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from posts import downloadFollowCollection
|
from posts import downloadFollowCollection
|
||||||
from posts import getPublicPostInfo
|
from posts import getPublicPostInfo
|
||||||
from posts import isModerator
|
from posts import isModerator
|
||||||
|
@ -108,7 +108,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
|
|
||||||
searchHandle = searchNickname + '@' + searchDomain
|
searchHandle = searchNickname + '@' + searchDomain
|
||||||
searchActor = \
|
searchActor = \
|
||||||
localActorUrl(http_prefix, searchNickname, searchDomain)
|
local_actor_url(http_prefix, searchNickname, searchDomain)
|
||||||
infoForm += \
|
infoForm += \
|
||||||
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
|
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
|
||||||
translate['Account Information'] + ':</a> <a href="' + searchActor + \
|
translate['Account Information'] + ':</a> <a href="' + searchActor + \
|
||||||
|
|
|
@ -51,7 +51,7 @@ from utils import removeIdEnding
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from content import limitRepeatedWords
|
from content import limitRepeatedWords
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
from content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
|
@ -1849,7 +1849,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
post_json_object['object']['content']
|
post_json_object['object']['content']
|
||||||
|
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
personUrl = localActorUrl(http_prefix, nickname, domain_full)
|
personUrl = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
actorJson = \
|
actorJson = \
|
||||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||||
languagesUnderstood = []
|
languagesUnderstood = []
|
||||||
|
|
|
@ -27,7 +27,7 @@ from utils import getConfigParam
|
||||||
from utils import getImageFormats
|
from utils import getImageFormats
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import getSupportedLanguages
|
from utils import getSupportedLanguages
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from utils import getReplyIntervalHours
|
from utils import getReplyIntervalHours
|
||||||
from languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from skills import getSkills
|
from skills import getSkills
|
||||||
|
@ -419,7 +419,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
||||||
otherAccountsHtml = \
|
otherAccountsHtml = \
|
||||||
' <p>' + translate['Other accounts'] + ': '
|
' <p>' + translate['Other accounts'] + ': '
|
||||||
|
|
||||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
ctr = 0
|
ctr = 0
|
||||||
if isinstance(alsoKnownAs, list):
|
if isinstance(alsoKnownAs, list):
|
||||||
for altActor in alsoKnownAs:
|
for altActor in alsoKnownAs:
|
||||||
|
@ -755,7 +755,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
nick = followerHandle.split('@')[0]
|
nick = followerHandle.split('@')[0]
|
||||||
dom = followerHandle.split('@')[1]
|
dom = followerHandle.split('@')[1]
|
||||||
followerActor = \
|
followerActor = \
|
||||||
localActorUrl(http_prefix, nick, dom)
|
local_actor_url(http_prefix, nick, dom)
|
||||||
|
|
||||||
# is this a new domain?
|
# is this a new domain?
|
||||||
# if so then append a new instance indicator
|
# if so then append a new instance indicator
|
||||||
|
|
|
@ -25,7 +25,7 @@ from utils import firstParagraphFromString
|
||||||
from utils import searchBoxPosts
|
from utils import searchBoxPosts
|
||||||
from utils import getAltPath
|
from utils import getAltPath
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from skills import noOfActorSkills
|
from skills import noOfActorSkills
|
||||||
from skills import getSkillsFromList
|
from skills import getSkillsFromList
|
||||||
from categories import getHashtagCategory
|
from categories import getHashtagCategory
|
||||||
|
@ -630,7 +630,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
|
||||||
|
|
||||||
# add the page title
|
# add the page title
|
||||||
domain_full = getFullDomain(domain, port)
|
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']
|
historySearchTitle = '🔍 ' + translate['Your Posts']
|
||||||
if boxName == 'bookmarks':
|
if boxName == 'bookmarks':
|
||||||
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
||||||
|
|
|
@ -18,7 +18,7 @@ from utils import isEditor
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from follow import followerApprovalActive
|
from follow import followerApprovalActive
|
||||||
from person import isPersonSnoozed
|
from person import isPersonSnoozed
|
||||||
from markdown import markdownToHtml
|
from markdown import markdownToHtml
|
||||||
|
@ -1054,12 +1054,12 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
||||||
base_dir, domain, nickname, maxSharesPerAccount,
|
base_dir, domain, nickname, maxSharesPerAccount,
|
||||||
shared_items_federated_domains, sharesFileType)
|
shared_items_federated_domains, sharesFileType)
|
||||||
domain_full = getFullDomain(domain, port)
|
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')
|
adminNickname = getConfigParam(base_dir, 'admin')
|
||||||
adminActor = ''
|
adminActor = ''
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
adminActor = \
|
adminActor = \
|
||||||
localActorUrl(http_prefix, adminNickname, domain_full)
|
local_actor_url(http_prefix, adminNickname, domain_full)
|
||||||
timelineStr = ''
|
timelineStr = ''
|
||||||
|
|
||||||
if pageNumber > 1:
|
if pageNumber > 1:
|
||||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
|
||||||
import os
|
import os
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from markdown import markdownToHtml
|
from markdown import markdownToHtml
|
||||||
|
@ -45,7 +45,7 @@ def htmlTermsOfService(cssCache: {}, base_dir: str,
|
||||||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
adminActor = localActorUrl(http_prefix, adminNickname, domain_full)
|
adminActor = local_actor_url(http_prefix, adminNickname, domain_full)
|
||||||
TOSForm += \
|
TOSForm += \
|
||||||
'<div class="container"><center>\n' + \
|
'<div class="container"><center>\n' + \
|
||||||
'<p class="administeredby">Administered by <a href="' + \
|
'<p class="administeredby">Administered by <a href="' + \
|
||||||
|
|
|
@ -23,7 +23,7 @@ from utils import isfloat
|
||||||
from utils import getAudioExtensions
|
from utils import getAudioExtensions
|
||||||
from utils import getVideoExtensions
|
from utils import getVideoExtensions
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from cache import storePersonInCache
|
from cache import storePersonInCache
|
||||||
from content import addHtmlTags
|
from content import addHtmlTags
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
|
@ -802,7 +802,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
|
||||||
"""html header which includes blog post markup
|
"""html header which includes blog post markup
|
||||||
https://schema.org/BlogPosting
|
https://schema.org/BlogPosting
|
||||||
"""
|
"""
|
||||||
authorUrl = localActorUrl(http_prefix, nickname, domain)
|
authorUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
aboutUrl = http_prefix + '://' + domain + '/about.html'
|
aboutUrl = http_prefix + '://' + domain + '/about.html'
|
||||||
|
|
||||||
# license for content on the site may be different from
|
# license for content on the site may be different from
|
||||||
|
@ -1448,7 +1448,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
||||||
contactTitleStr = translate['Buy']
|
contactTitleStr = translate['Buy']
|
||||||
sharedItemsForm += '</p>\n'
|
sharedItemsForm += '</p>\n'
|
||||||
contactActor = \
|
contactActor = \
|
||||||
localActorUrl(http_prefix, contactNickname, domain_full)
|
local_actor_url(http_prefix, contactNickname, domain_full)
|
||||||
buttonStyleStr = 'button'
|
buttonStyleStr = 'button'
|
||||||
if category == 'accommodation':
|
if category == 'accommodation':
|
||||||
contactTitleStr = translate['Request to stay']
|
contactTitleStr = translate['Request to stay']
|
||||||
|
@ -1545,7 +1545,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
||||||
if not sharesJson.get(itemID):
|
if not sharesJson.get(itemID):
|
||||||
return None
|
return None
|
||||||
sharedItem = sharesJson[itemID]
|
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
|
# filename of the banner shown at the top
|
||||||
bannerFile, bannerFilename = \
|
bannerFile, bannerFilename = \
|
||||||
|
|
|
@ -15,7 +15,7 @@ from utils import getConfigParam
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import getImageFormats
|
from utils import getImageFormats
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_utils import editTextField
|
from webapp_utils import editTextField
|
||||||
|
@ -76,7 +76,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
||||||
if os.path.isfile(avatarFilename):
|
if os.path.isfile(avatarFilename):
|
||||||
break
|
break
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
localActorUrl(http_prefix, nickname, domain_full) + '/avatar.' + ext
|
local_actor_url(http_prefix, nickname, domain_full) + '/avatar.' + ext
|
||||||
|
|
||||||
imageFormats = getImageFormats()
|
imageFormats = getImageFormats()
|
||||||
profileForm += '<div class="container">' + profileText + '</div>\n'
|
profileForm += '<div class="container">' + profileText + '</div>\n'
|
||||||
|
|
|
@ -20,7 +20,7 @@ from utils import getProtocolPrefixes
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import getGroupPaths
|
from utils import getGroupPaths
|
||||||
from utils import localActorUrl
|
from utils import local_actor_url
|
||||||
|
|
||||||
|
|
||||||
def _parseHandle(handle: str) -> (str, str, bool):
|
def _parseHandle(handle: str) -> (str, str, bool):
|
||||||
|
@ -139,7 +139,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
||||||
domain = getFullDomain(domain, port)
|
domain = getFullDomain(domain, port)
|
||||||
|
|
||||||
personName = nickname
|
personName = nickname
|
||||||
personId = localActorUrl(http_prefix, personName, domain)
|
personId = local_actor_url(http_prefix, personName, domain)
|
||||||
subjectStr = "acct:" + personName + "@" + originalDomain
|
subjectStr = "acct:" + personName + "@" + originalDomain
|
||||||
profilePageHref = http_prefix + "://" + domain + "/@" + nickname
|
profilePageHref = http_prefix + "://" + domain + "/@" + nickname
|
||||||
if nickname == 'inbox' or nickname == originalDomain:
|
if nickname == 'inbox' or nickname == originalDomain:
|
||||||
|
|
Loading…
Reference in New Issue