mirror of https://gitlab.com/bashrc2/epicyon
Tidying of actor urls
parent
39e6e06ca3
commit
87a7d2e154
|
|
@ -18,6 +18,7 @@ from utils import followPerson
|
||||||
from utils import hasObjectDict
|
from utils import hasObjectDict
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
|
from utils import localActorUrl
|
||||||
|
|
||||||
|
|
||||||
def _createAcceptReject(baseDir: str, federationList: [],
|
def _createAcceptReject(baseDir: str, federationList: [],
|
||||||
|
|
@ -41,7 +42,7 @@ def _createAcceptReject(baseDir: str, federationList: [],
|
||||||
newAccept = {
|
newAccept = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': acceptType,
|
'type': acceptType,
|
||||||
'actor': httpPrefix + '://' + domain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, domain),
|
||||||
'to': [toUrl],
|
'to': [toUrl],
|
||||||
'cc': [],
|
'cc': [],
|
||||||
'object': objectJson
|
'object': objectJson
|
||||||
|
|
|
||||||
18
announce.py
18
announce.py
|
|
@ -22,6 +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 posts import sendSignedJson
|
from posts import sendSignedJson
|
||||||
from posts import getPersonBox
|
from posts import getPersonBox
|
||||||
from session import postJson
|
from session import postJson
|
||||||
|
|
@ -136,11 +137,11 @@ def createAnnounce(session, baseDir: str, federationList: [],
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newAnnounceId = httpPrefix + '://' + fullDomain + \
|
newAnnounceId = httpPrefix + '://' + fullDomain + \
|
||||||
'/users/' + nickname + '/statuses/' + statusNumber
|
'/users/' + nickname + '/statuses/' + statusNumber
|
||||||
atomUriStr = httpPrefix + '://' + fullDomain + '/users/' + nickname + \
|
atomUriStr = localActorUrl(httpPrefix, nickname, fullDomain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
newAnnounce = {
|
newAnnounce = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||||
'atomUri': atomUriStr,
|
'atomUri': atomUriStr,
|
||||||
'cc': [],
|
'cc': [],
|
||||||
'id': newAnnounceId + '/activity',
|
'id': newAnnounceId + '/activity',
|
||||||
|
|
@ -193,8 +194,7 @@ def announcePublic(session, baseDir: str, federationList: [],
|
||||||
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 = httpPrefix + '://' + fromDomain + '/users/' + nickname + \
|
ccUrl = localActorUrl(httpPrefix, nickname, fromDomain) + '/followers'
|
||||||
'/followers'
|
|
||||||
return createAnnounce(session, baseDir, federationList,
|
return createAnnounce(session, baseDir, federationList,
|
||||||
nickname, domain, port,
|
nickname, domain, port,
|
||||||
toUrl, ccUrl, httpPrefix,
|
toUrl, ccUrl, httpPrefix,
|
||||||
|
|
@ -219,13 +219,11 @@ def sendAnnounceViaServer(baseDir: 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'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname + \
|
actorStr = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
'/followers'
|
ccUrl = actorStr + '/followers'
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newAnnounceId = httpPrefix + '://' + fromDomainFull + '/users/' + \
|
newAnnounceId = actorStr + '/statuses/' + statusNumber
|
||||||
fromNickname + '/statuses/' + statusNumber
|
|
||||||
actorStr = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
newAnnounceJson = {
|
newAnnounceJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'actor': actorStr,
|
'actor': actorStr,
|
||||||
|
|
@ -308,7 +306,7 @@ def sendUndoAnnounceViaServer(baseDir: str, session,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
handle = actor.replace('/users/', '/@')
|
handle = actor.replace('/users/', '/@')
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,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
|
||||||
|
|
||||||
|
|
||||||
def setAvailability(baseDir: str, nickname: str, domain: str,
|
def setAvailability(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
@ -90,13 +91,12 @@ def sendAvailabilityViaServer(baseDir: str, session,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
|
||||||
toUrl = httpPrefix + '://' + domainFull + '/users/' + nickname
|
toUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
ccUrl = httpPrefix + '://' + domainFull + '/users/' + nickname + \
|
ccUrl = toUrl + '/followers'
|
||||||
'/followers'
|
|
||||||
|
|
||||||
newAvailabilityJson = {
|
newAvailabilityJson = {
|
||||||
'type': 'Availability',
|
'type': 'Availability',
|
||||||
'actor': httpPrefix + '://' + domainFull + '/users/' + nickname,
|
'actor': toUrl,
|
||||||
'object': '"' + status + '"',
|
'object': '"' + status + '"',
|
||||||
'to': [toUrl],
|
'to': [toUrl],
|
||||||
'cc': [ccUrl]
|
'cc': [ccUrl]
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,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 conversation import muteConversation
|
from conversation import muteConversation
|
||||||
from conversation import unmuteConversation
|
from conversation import unmuteConversation
|
||||||
|
|
||||||
|
|
@ -469,7 +470,7 @@ def mutePost(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
if hasObjectDict(postJsonObject):
|
if hasObjectDict(postJsonObject):
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
if postJsonObject['object'].get('conversation'):
|
if postJsonObject['object'].get('conversation'):
|
||||||
muteConversation(baseDir, nickname, domain,
|
muteConversation(baseDir, nickname, domain,
|
||||||
|
|
@ -559,7 +560,7 @@ def unmutePost(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
if postJsonObject['object'].get('ignores'):
|
if postJsonObject['object'].get('ignores'):
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
totalItems = 0
|
totalItems = 0
|
||||||
if postJsonObject['object']['ignores'].get('totalItems'):
|
if postJsonObject['object']['ignores'].get('totalItems'):
|
||||||
totalItems = \
|
totalItems = \
|
||||||
|
|
|
||||||
12
blog.py
12
blog.py
|
|
@ -17,6 +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 getActorLanguagesList
|
from utils import getActorLanguagesList
|
||||||
from utils import getBaseContentFromPost
|
from utils import getBaseContentFromPost
|
||||||
from utils import getContentFromPost
|
from utils import getContentFromPost
|
||||||
|
|
@ -242,8 +243,7 @@ def _htmlBlogPostContent(authorized: bool,
|
||||||
if attachmentStr:
|
if attachmentStr:
|
||||||
blogStr += '<br><center>' + attachmentStr + '</center>'
|
blogStr += '<br><center>' + attachmentStr + '</center>'
|
||||||
|
|
||||||
personUrl = \
|
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
httpPrefix + '://' + domainFull + '/users/' + nickname
|
|
||||||
actorJson = \
|
actorJson = \
|
||||||
getPersonFromCache(baseDir, personUrl, personCache, False)
|
getPersonFromCache(baseDir, personUrl, personCache, False)
|
||||||
languagesUnderstood = []
|
languagesUnderstood = []
|
||||||
|
|
@ -288,8 +288,8 @@ def _htmlBlogPostContent(authorized: bool,
|
||||||
|
|
||||||
if not linkedAuthor:
|
if not linkedAuthor:
|
||||||
blogStr += '<p class="about"><a class="about" href="' + \
|
blogStr += '<p class="about"><a class="about" href="' + \
|
||||||
httpPrefix + '://' + domainFull + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/users/' + nickname + '">' + translate['About the author'] + \
|
'">' + translate['About the author'] + \
|
||||||
'</a></p>\n'
|
'</a></p>\n'
|
||||||
|
|
||||||
replies = _noOfBlogReplies(baseDir, httpPrefix, translate,
|
replies = _noOfBlogReplies(baseDir, httpPrefix, translate,
|
||||||
|
|
@ -902,8 +902,8 @@ def pathContainsBlogLink(baseDir: 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 = httpPrefix + '://' + domainFull + \
|
messageId = localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/users/' + nickname + '/statuses/' + userEnding2[1]
|
'/statuses/' + userEnding2[1]
|
||||||
return locatePost(baseDir, nickname, domain, messageId), nickname
|
return locatePost(baseDir, nickname, domain, messageId), nickname
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
11
bookmarks.py
11
bookmarks.py
|
|
@ -25,6 +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 posts import getPersonBox
|
from posts import getPersonBox
|
||||||
from session import postJson
|
from session import postJson
|
||||||
|
|
||||||
|
|
@ -242,7 +243,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': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
if ccList:
|
if ccList:
|
||||||
|
|
@ -301,10 +302,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': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||||
'object': {
|
'object': {
|
||||||
'type': 'Bookmark',
|
'type': 'Bookmark',
|
||||||
'actor': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +357,7 @@ def sendBookmarkViaServer(baseDir: str, session,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, fromPort)
|
domainFull = getFullDomain(domain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
newBookmarkJson = {
|
newBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -441,7 +442,7 @@ def sendUndoBookmarkViaServer(baseDir: str, session,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, fromPort)
|
domainFull = getFullDomain(domain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
newBookmarkJson = {
|
newBookmarkJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
|
||||||
64
daemon.py
64
daemon.py
|
|
@ -225,6 +225,7 @@ from shares import sharesCatalogCSVEndpoint
|
||||||
from categories import setHashtagCategory
|
from categories import setHashtagCategory
|
||||||
from languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from languages import setActorLanguages
|
from languages import setActorLanguages
|
||||||
|
from utils import localActorUrl
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import validPassword
|
from utils import validPassword
|
||||||
from utils import removeLineEndings
|
from utils import removeLineEndings
|
||||||
|
|
@ -2586,8 +2587,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print(followerNickname + ' stops following ' +
|
print(followerNickname + ' stops following ' +
|
||||||
followingActor)
|
followingActor)
|
||||||
followActor = \
|
followActor = \
|
||||||
httpPrefix + '://' + domainFull + \
|
localActorUrl(httpPrefix, followerNickname, domainFull)
|
||||||
'/users/' + followerNickname
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
followId = followActor + '/statuses/' + str(statusNumber)
|
followId = followActor + '/statuses/' + str(statusNumber)
|
||||||
unfollowJson = {
|
unfollowJson = {
|
||||||
|
|
@ -3091,10 +3091,11 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
searchNickname = getNicknameFromActor(searchStr)
|
searchNickname = getNicknameFromActor(searchStr)
|
||||||
searchDomain, searchPort = \
|
searchDomain, searchPort = \
|
||||||
getDomainFromActor(searchStr)
|
getDomainFromActor(searchStr)
|
||||||
|
searchDomainFull = \
|
||||||
|
getFullDomain(searchDomain, searchPort)
|
||||||
actor = \
|
actor = \
|
||||||
httpPrefix + '://' + \
|
localActorUrl(httpPrefix, searchNickname,
|
||||||
getFullDomain(searchDomain, searchPort) + \
|
searchDomainFull)
|
||||||
'/users/' + searchNickname
|
|
||||||
else:
|
else:
|
||||||
actor = searchStr
|
actor = searchStr
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
|
|
@ -6660,8 +6661,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
self.server.actorRepeat = path.split('?actor=')[1]
|
self.server.actorRepeat = path.split('?actor=')[1]
|
||||||
announceToStr = \
|
announceToStr = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + \
|
localActorUrl(httpPrefix, self.postToNickname, domainFull) + \
|
||||||
self.postToNickname + '/followers'
|
'/followers'
|
||||||
if not repeatPrivate:
|
if not repeatPrivate:
|
||||||
announceToStr = 'https://www.w3.org/ns/activitystreams#Public'
|
announceToStr = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
announceJson = \
|
announceJson = \
|
||||||
|
|
@ -7066,8 +7067,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
return
|
return
|
||||||
likeActor = \
|
likeActor = \
|
||||||
httpPrefix + '://' + \
|
localActorUrl(httpPrefix, self.postToNickname, domainFull)
|
||||||
domainFull + '/users/' + self.postToNickname
|
|
||||||
actorLiked = path.split('?actor=')[1]
|
actorLiked = path.split('?actor=')[1]
|
||||||
if '?' in actorLiked:
|
if '?' in actorLiked:
|
||||||
actorLiked = actorLiked.split('?')[0]
|
actorLiked = actorLiked.split('?')[0]
|
||||||
|
|
@ -7165,7 +7165,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
return
|
return
|
||||||
undoActor = \
|
undoActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + self.postToNickname
|
localActorUrl(httpPrefix, self.postToNickname, domainFull)
|
||||||
actorLiked = path.split('?actor=')[1]
|
actorLiked = path.split('?actor=')[1]
|
||||||
if '?' in actorLiked:
|
if '?' in actorLiked:
|
||||||
actorLiked = actorLiked.split('?')[0]
|
actorLiked = actorLiked.split('?')[0]
|
||||||
|
|
@ -7263,7 +7263,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
return
|
return
|
||||||
bookmarkActor = \
|
bookmarkActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + self.postToNickname
|
localActorUrl(httpPrefix, self.postToNickname, domainFull)
|
||||||
ccList = []
|
ccList = []
|
||||||
bookmark(self.server.recentPostsCache,
|
bookmark(self.server.recentPostsCache,
|
||||||
self.server.session,
|
self.server.session,
|
||||||
|
|
@ -7349,7 +7349,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
return
|
return
|
||||||
undoActor = \
|
undoActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + self.postToNickname
|
localActorUrl(httpPrefix, self.postToNickname, domainFull)
|
||||||
ccList = []
|
ccList = []
|
||||||
undoBookmark(self.server.recentPostsCache,
|
undoBookmark(self.server.recentPostsCache,
|
||||||
self.server.session,
|
self.server.session,
|
||||||
|
|
@ -7616,15 +7616,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'https://www.w3.org/ns/activitystreams'
|
'https://www.w3.org/ns/activitystreams'
|
||||||
|
|
||||||
firstStr = \
|
firstStr = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/statuses/' + statusNumber + '/replies?page=true'
|
'/statuses/' + statusNumber + '/replies?page=true'
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
|
|
||||||
lastStr = \
|
lastStr = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/statuses/' + statusNumber + '/replies?page=true'
|
'/statuses/' + statusNumber + '/replies?page=true'
|
||||||
|
|
||||||
repliesJson = {
|
repliesJson = {
|
||||||
|
|
@ -7701,13 +7701,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
contextStr = 'https://www.w3.org/ns/activitystreams'
|
contextStr = 'https://www.w3.org/ns/activitystreams'
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domainFull + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/users/' + nickname + '/statuses/' + \
|
'/statuses/' + statusNumber + '?page=true'
|
||||||
statusNumber + '?page=true'
|
|
||||||
|
|
||||||
partOfStr = \
|
partOfStr = \
|
||||||
httpPrefix + '://' + domainFull + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/users/' + nickname + '/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
repliesJson = {
|
repliesJson = {
|
||||||
'@context': contextStr,
|
'@context': contextStr,
|
||||||
|
|
@ -10879,8 +10878,8 @@ 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 = httpPrefix + '://' + domainFull + \
|
postUrl = localActorUrl(httpPrefix, postActor, domainFull) + \
|
||||||
'/users/' + postActor + '/statuses/' + postId
|
'/statuses/' + postId
|
||||||
path = path.split('/editnewspost=')[0]
|
path = path.split('/editnewspost=')[0]
|
||||||
msg = htmlEditNewsPost(self.server.cssCache,
|
msg = htmlEditNewsPost(self.server.cssCache,
|
||||||
translate, baseDir,
|
translate, baseDir,
|
||||||
|
|
@ -10930,8 +10929,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# don't block self
|
# don't block self
|
||||||
return False
|
return False
|
||||||
blockActor = \
|
blockActor = \
|
||||||
httpPrefix + '://' + blockerDomainFull + '/users/' + \
|
localActorUrl(httpPrefix, blockerNickname, blockerDomainFull)
|
||||||
blockerNickname
|
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = blockActor + '/followers'
|
ccUrl = blockActor + '/followers'
|
||||||
|
|
||||||
|
|
@ -13090,8 +13088,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
nickname = getNicknameFromActor(self.path.split('?')[0])
|
nickname = getNicknameFromActor(self.path.split('?')[0])
|
||||||
if nickname == actor:
|
if nickname == actor:
|
||||||
postUrl = \
|
postUrl = \
|
||||||
self.server.httpPrefix + '://' + \
|
localActorUrl(self.server.httpPrefix, nickname,
|
||||||
self.server.domainFull + '/users/' + nickname + \
|
self.server.domainFull) + \
|
||||||
'/statuses/' + messageId
|
'/statuses/' + messageId
|
||||||
msg = htmlEditBlog(self.server.mediaInstance,
|
msg = htmlEditBlog(self.server.mediaInstance,
|
||||||
self.server.translate,
|
self.server.translate,
|
||||||
|
|
@ -15243,23 +15241,25 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if callingDomain.endswith('.onion') and \
|
if callingDomain.endswith('.onion') and \
|
||||||
self.server.onionDomain:
|
self.server.onionDomain:
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
'http://' + self.server.onionDomain + \
|
localActorUrl('http', nickname,
|
||||||
'/users/' + nickname + '/' + postRedirect + \
|
self.server.onionDomain) + \
|
||||||
|
'/' + postRedirect + \
|
||||||
'?page=' + str(pageNumber)
|
'?page=' + str(pageNumber)
|
||||||
self._redirect_headers(actorPathStr, cookie,
|
self._redirect_headers(actorPathStr, cookie,
|
||||||
callingDomain)
|
callingDomain)
|
||||||
elif (callingDomain.endswith('.i2p') and
|
elif (callingDomain.endswith('.i2p') and
|
||||||
self.server.i2pDomain):
|
self.server.i2pDomain):
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
'http://' + self.server.i2pDomain + \
|
localActorUrl('http', nickname,
|
||||||
'/users/' + nickname + '/' + postRedirect + \
|
self.server.i2pDomain) + \
|
||||||
|
'/' + postRedirect + \
|
||||||
'?page=' + str(pageNumber)
|
'?page=' + str(pageNumber)
|
||||||
self._redirect_headers(actorPathStr, cookie,
|
self._redirect_headers(actorPathStr, cookie,
|
||||||
callingDomain)
|
callingDomain)
|
||||||
else:
|
else:
|
||||||
actorPathStr = \
|
actorPathStr = \
|
||||||
self.server.httpPrefix + '://' + \
|
localActorUrl(self.server.httpPrefix, nickname,
|
||||||
self.server.domainFull + '/users/' + nickname + \
|
self.server.domainFull) + \
|
||||||
'/' + postRedirect + '?page=' + str(pageNumber)
|
'/' + postRedirect + '?page=' + str(pageNumber)
|
||||||
self._redirect_headers(actorPathStr, cookie,
|
self._redirect_headers(actorPathStr, cookie,
|
||||||
callingDomain)
|
callingDomain)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,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 session import postJson
|
from session import postJson
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from auth import createBasicAuthHeader
|
from auth import createBasicAuthHeader
|
||||||
|
|
@ -38,8 +39,7 @@ def sendDeleteViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + \
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
'/users/' + fromNickname
|
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +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 session import createSession
|
from session import createSession
|
||||||
from speaker import speakableText
|
from speaker import speakableText
|
||||||
from speaker import getSpeakerPitch
|
from speaker import getSpeakerPitch
|
||||||
|
|
@ -1374,7 +1375,7 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
systemLanguage, espeak)
|
systemLanguage, espeak)
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
yourActor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
yourActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
actorJson = None
|
actorJson = None
|
||||||
|
|
||||||
notifyJson = {
|
notifyJson = {
|
||||||
|
|
@ -1949,8 +1950,8 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
blockDomain = blockHandle.split('@')[1]
|
blockDomain = blockHandle.split('@')[1]
|
||||||
blockNickname = blockHandle.split('@')[0]
|
blockNickname = blockHandle.split('@')[0]
|
||||||
blockActor = \
|
blockActor = \
|
||||||
httpPrefix + '://' + blockDomain + \
|
localActorUrl(httpPrefix,
|
||||||
'/users/' + blockNickname
|
blockNickname, blockDomain)
|
||||||
if currIndex > 0 and boxJson and not blockActor:
|
if currIndex > 0 and boxJson and not blockActor:
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
_desktopGetBoxPostObject(boxJson, currIndex)
|
_desktopGetBoxPostObject(boxJson, currIndex)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +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
|
||||||
|
|
||||||
|
|
||||||
def E2EEremoveDevice(baseDir: str, nickname: str, domain: str,
|
def E2EEremoveDevice(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
@ -142,7 +143,7 @@ def E2EEdevicesCollection(baseDir: str, nickname: str, domain: str,
|
||||||
personDir = acctDir(baseDir, nickname, domain)
|
personDir = acctDir(baseDir, nickname, domain)
|
||||||
if not os.path.isdir(personDir):
|
if not os.path.isdir(personDir):
|
||||||
return {}
|
return {}
|
||||||
personId = httpPrefix + '://' + domainFull + '/users/' + nickname
|
personId = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
if not os.path.isdir(personDir + '/devices'):
|
if not os.path.isdir(personDir + '/devices'):
|
||||||
os.mkdir(personDir + '/devices')
|
os.mkdir(personDir + '/devices')
|
||||||
deviceList = []
|
deviceList = []
|
||||||
|
|
|
||||||
|
|
@ -1166,7 +1166,6 @@ if args.message:
|
||||||
toDomain = 'public'
|
toDomain = 'public'
|
||||||
toPort = port
|
toPort = port
|
||||||
|
|
||||||
# ccUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/followers'
|
|
||||||
ccUrl = None
|
ccUrl = None
|
||||||
sendMessage = args.message
|
sendMessage = args.message
|
||||||
followersOnly = args.followersonly
|
followersOnly = args.followersonly
|
||||||
|
|
|
||||||
47
follow.py
47
follow.py
|
|
@ -30,6 +30,7 @@ from utils import getUserPaths
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import isGroupAccount
|
from utils import isGroupAccount
|
||||||
|
from utils import localActorUrl
|
||||||
from acceptreject import createAccept
|
from acceptreject import createAccept
|
||||||
from acceptreject import createReject
|
from acceptreject import createReject
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
|
|
@ -67,8 +68,7 @@ def createInitialLastSeen(baseDir: str, httpPrefix: str) -> None:
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
if nickname.startswith('!'):
|
if nickname.startswith('!'):
|
||||||
nickname = nickname[1:]
|
nickname = nickname[1:]
|
||||||
actor = \
|
actor = localActorUrl(httpPrefix, nickname, domain)
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname
|
|
||||||
lastSeenFilename = \
|
lastSeenFilename = \
|
||||||
lastSeenDir + '/' + actor.replace('/', '#') + '.txt'
|
lastSeenDir + '/' + actor.replace('/', '#') + '.txt'
|
||||||
if not os.path.isfile(lastSeenFilename):
|
if not os.path.isfile(lastSeenFilename):
|
||||||
|
|
@ -399,11 +399,10 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str,
|
||||||
|
|
||||||
if headerOnly:
|
if headerOnly:
|
||||||
firstStr = \
|
firstStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + followFile + '?page=1'
|
'/' + followFile + '?page=1'
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + '/' + followFile
|
||||||
nickname + '/' + followFile
|
|
||||||
totalStr = \
|
totalStr = \
|
||||||
_getNoOfFollows(baseDir, nickname, domain, authorized)
|
_getNoOfFollows(baseDir, nickname, domain, authorized)
|
||||||
following = {
|
following = {
|
||||||
|
|
@ -420,10 +419,10 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str,
|
||||||
|
|
||||||
nextPageNumber = int(pageNumber + 1)
|
nextPageNumber = int(pageNumber + 1)
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + followFile + '?page=' + str(pageNumber)
|
'/' + followFile + '?page=' + str(pageNumber)
|
||||||
partOfStr = \
|
partOfStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + '/' + followFile
|
localActorUrl(httpPrefix, nickname, domain) + '/' + followFile
|
||||||
following = {
|
following = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': idStr,
|
'id': idStr,
|
||||||
|
|
@ -457,7 +456,7 @@ def getFollowingFeed(baseDir: 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 = httpPrefix + '://' + dom + '/users/' + nick
|
url = localActorUrl(httpPrefix, nick, dom)
|
||||||
else:
|
else:
|
||||||
# group actor
|
# group actor
|
||||||
url = httpPrefix + '://' + dom + '/c/' + nick
|
url = httpPrefix + '://' + dom + '/c/' + nick
|
||||||
|
|
@ -481,8 +480,8 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str,
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
if nextPageNumber > lastPage:
|
if nextPageNumber > lastPage:
|
||||||
following['next'] = \
|
following['next'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + followFile + '?page=' + str(lastPage)
|
'/' + followFile + '?page=' + str(lastPage)
|
||||||
return following
|
return following
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -969,7 +968,7 @@ def sendFollowRequest(session, baseDir: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
fullDomain = getFullDomain(domain, port)
|
fullDomain = getFullDomain(domain, port)
|
||||||
followActor = httpPrefix + '://' + fullDomain + '/users/' + nickname
|
followActor = localActorUrl(httpPrefix, nickname, fullDomain)
|
||||||
|
|
||||||
requestDomain = getFullDomain(followDomain, followPort)
|
requestDomain = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
|
|
@ -1040,10 +1039,8 @@ def sendFollowRequestViaServer(baseDir: str, session,
|
||||||
|
|
||||||
followDomainFull = getFullDomain(followDomain, followPort)
|
followDomainFull = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
followActor = httpPrefix + '://' + \
|
followActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
fromDomainFull + '/users/' + fromNickname
|
followedId = localActorUrl(httpPrefix, followNickname, followDomainFull)
|
||||||
followedId = httpPrefix + '://' + \
|
|
||||||
followDomainFull + '/users/' + followNickname
|
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newFollowJson = {
|
newFollowJson = {
|
||||||
|
|
@ -1126,10 +1123,8 @@ def sendUnfollowRequestViaServer(baseDir: str, session,
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
followDomainFull = getFullDomain(followDomain, followPort)
|
followDomainFull = getFullDomain(followDomain, followPort)
|
||||||
|
|
||||||
followActor = httpPrefix + '://' + \
|
followActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
fromDomainFull + '/users/' + fromNickname
|
followedId = localActorUrl(httpPrefix, followNickname, followDomainFull)
|
||||||
followedId = httpPrefix + '://' + \
|
|
||||||
followDomainFull + '/users/' + followNickname
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
|
||||||
unfollowJson = {
|
unfollowJson = {
|
||||||
|
|
@ -1216,7 +1211,7 @@ def getFollowingViaServer(baseDir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
followActor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
@ -1257,7 +1252,7 @@ def getFollowersViaServer(baseDir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
followActor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
@ -1298,7 +1293,7 @@ def getFollowRequestsViaServer(baseDir: str, session,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
|
||||||
followActor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
followActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
|
@ -1339,7 +1334,7 @@ def approveFollowRequestViaServer(baseDir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
@ -1379,7 +1374,7 @@ def denyFollowRequestViaServer(baseDir: str, session,
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ from time import gmtime, strftime
|
||||||
import datetime
|
import datetime
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getSHA256
|
from utils import getSHA256
|
||||||
|
from utils import localActorUrl
|
||||||
|
|
||||||
|
|
||||||
def messageContentDigest(messageBodyJsonStr: str) -> str:
|
def messageContentDigest(messageBodyJsonStr: str) -> str:
|
||||||
|
|
@ -48,7 +49,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())
|
||||||
keyID = httpPrefix + '://' + domain + '/users/' + nickname + '#main-key'
|
keyID = localActorUrl(httpPrefix, nickname, domain) + '#main-key'
|
||||||
if not messageBodyJsonStr:
|
if not messageBodyJsonStr:
|
||||||
headers = {
|
headers = {
|
||||||
'(request-target)': f'post {path}',
|
'(request-target)': f'post {path}',
|
||||||
|
|
@ -125,7 +126,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 = httpPrefix + '://' + domain + '/users/' + nickname + '#main-key'
|
keyID = localActorUrl(httpPrefix, nickname, domain) + '#main-key'
|
||||||
if not messageBodyJsonStr:
|
if not messageBodyJsonStr:
|
||||||
headers = {
|
headers = {
|
||||||
'*request-target': f'post {path}',
|
'*request-target': f'post {path}',
|
||||||
|
|
|
||||||
30
inbox.py
30
inbox.py
|
|
@ -46,6 +46,7 @@ from utils import saveJson
|
||||||
from utils import updateLikesCollection
|
from utils import updateLikesCollection
|
||||||
from utils import undoLikesCollectionEntry
|
from utils import undoLikesCollectionEntry
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
|
from utils import localActorUrl
|
||||||
from categories import getHashtagCategories
|
from categories import getHashtagCategories
|
||||||
from categories import setHashtagCategory
|
from categories import setHashtagCategory
|
||||||
from httpsig import verifyPostHeaders
|
from httpsig import verifyPostHeaders
|
||||||
|
|
@ -401,8 +402,8 @@ def savePostToInboxQueue(baseDir: str, httpPrefix: str,
|
||||||
if actor:
|
if actor:
|
||||||
postId = actor + '/statuses/' + statusNumber
|
postId = actor + '/statuses/' + statusNumber
|
||||||
else:
|
else:
|
||||||
postId = httpPrefix + '://' + originalDomain + \
|
postId = localActorUrl(httpPrefix, nickname, originalDomain) + \
|
||||||
'/users/' + nickname + '/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
# NOTE: don't change postJsonObject['id'] before signature check
|
# NOTE: don't change postJsonObject['id'] before signature check
|
||||||
|
|
||||||
|
|
@ -1912,7 +1913,7 @@ def _sendToGroupMembers(session, baseDir: str, handle: str, port: int,
|
||||||
nickname = handle.split('@')[0].replace('!', '')
|
nickname = handle.split('@')[0].replace('!', '')
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
groupActor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
groupActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
if groupActor not in postJsonObject['to']:
|
if groupActor not in postJsonObject['to']:
|
||||||
return
|
return
|
||||||
cc = ''
|
cc = ''
|
||||||
|
|
@ -2148,8 +2149,8 @@ def _isValidDM(baseDir: 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')
|
||||||
_dmNotify(baseDir, handle,
|
actUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + '/dm')
|
_dmNotify(baseDir, handle, actUrl + '/dm')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# get the file containing following handles
|
# get the file containing following handles
|
||||||
|
|
@ -2216,8 +2217,8 @@ def _isValidDM(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
# dm index will be updated
|
# dm index will be updated
|
||||||
updateIndexList.append('dm')
|
updateIndexList.append('dm')
|
||||||
_dmNotify(baseDir, handle,
|
actUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + '/dm')
|
_dmNotify(baseDir, handle, actUrl + '/dm')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2465,7 +2466,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# get the actor being replied to
|
# get the actor being replied to
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
# create a reply notification file if needed
|
# create a reply notification file if needed
|
||||||
if not postIsDM and isReply(postJsonObject, actor):
|
if not postIsDM and isReply(postJsonObject, actor):
|
||||||
|
|
@ -2484,10 +2485,11 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
if isinstance(inReplyTo, str):
|
if isinstance(inReplyTo, str):
|
||||||
if not isMuted(baseDir, nickname, domain,
|
if not isMuted(baseDir, nickname, domain,
|
||||||
inReplyTo, conversationId):
|
inReplyTo, conversationId):
|
||||||
|
actUrl = \
|
||||||
|
localActorUrl(httpPrefix,
|
||||||
|
nickname, domain)
|
||||||
_replyNotify(baseDir, handle,
|
_replyNotify(baseDir, handle,
|
||||||
httpPrefix + '://' + domain +
|
actUrl + '/tlreplies')
|
||||||
'/users/' + nickname +
|
|
||||||
'/tlreplies')
|
|
||||||
else:
|
else:
|
||||||
isReplyToMutedPost = True
|
isReplyToMutedPost = True
|
||||||
|
|
||||||
|
|
@ -2523,10 +2525,10 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
if notifyWhenPersonPosts(baseDir, nickname, domain,
|
if notifyWhenPersonPosts(baseDir, nickname, domain,
|
||||||
fromNickname, fromDomainFull):
|
fromNickname, fromDomainFull):
|
||||||
postId = removeIdEnding(jsonObj['id'])
|
postId = removeIdEnding(jsonObj['id'])
|
||||||
|
domFull = getFullDomain(domain, port)
|
||||||
postLink = \
|
postLink = \
|
||||||
httpPrefix + '://' + \
|
localActorUrl(httpPrefix,
|
||||||
getFullDomain(domain, port) + \
|
nickname, domFull) + \
|
||||||
'/users/' + nickname + \
|
|
||||||
'?notifypost=' + postId.replace('/', '-')
|
'?notifypost=' + postId.replace('/', '-')
|
||||||
_notifyPostArrival(baseDir, handle, postLink)
|
_notifyPostArrival(baseDir, handle, postLink)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +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 cache import getPersonFromCache
|
from cache import getPersonFromCache
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,7 +105,7 @@ def understoodPostLanguage(baseDir: str, nickname: str, domain: str,
|
||||||
return True
|
return True
|
||||||
if msgObject['contentMap'].get(systemLanguage):
|
if msgObject['contentMap'].get(systemLanguage):
|
||||||
return True
|
return True
|
||||||
personUrl = httpPrefix + '://' + domainFull + '/users/' + nickname
|
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
actorJson = getPersonFromCache(baseDir, personUrl, personCache, False)
|
actorJson = getPersonFromCache(baseDir, personUrl, personCache, 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)
|
||||||
|
|
|
||||||
9
like.py
9
like.py
|
|
@ -19,6 +19,7 @@ from utils import locatePost
|
||||||
from utils import updateLikesCollection
|
from utils import updateLikesCollection
|
||||||
from utils import undoLikesCollectionEntry
|
from utils import undoLikesCollectionEntry
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
|
from utils import localActorUrl
|
||||||
from posts import sendSignedJson
|
from posts import sendSignedJson
|
||||||
from session import postJson
|
from session import postJson
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
|
|
@ -75,7 +76,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': httpPrefix + '://' + fullDomain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, fullDomain),
|
||||||
'object': objectUrl
|
'object': objectUrl
|
||||||
}
|
}
|
||||||
if ccList:
|
if ccList:
|
||||||
|
|
@ -139,7 +140,7 @@ def likePost(recentPostsCache: {},
|
||||||
"""
|
"""
|
||||||
likeDomain = getFullDomain(likeDomain, likePort)
|
likeDomain = getFullDomain(likeDomain, likePort)
|
||||||
|
|
||||||
actorLiked = httpPrefix + '://' + likeDomain + '/users/' + likeNickname
|
actorLiked = localActorUrl(httpPrefix, likeNickname, likeDomain)
|
||||||
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
|
objectUrl = actorLiked + '/statuses/' + str(likeStatusNumber)
|
||||||
|
|
||||||
return _like(recentPostsCache,
|
return _like(recentPostsCache,
|
||||||
|
|
@ -163,7 +164,7 @@ def sendLikeViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newLikeJson = {
|
newLikeJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -241,7 +242,7 @@ def sendUndoLikeViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
|
|
||||||
newUndoLikeJson = {
|
newUndoLikeJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
|
|
|
||||||
|
|
@ -33,6 +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 inbox import storeHashTags
|
from inbox import storeHashTags
|
||||||
from session import createSession
|
from session import createSession
|
||||||
|
|
||||||
|
|
@ -547,8 +548,8 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber(dateStr)
|
statusNumber, published = getStatusNumber(dateStr)
|
||||||
newPostId = \
|
newPostId = \
|
||||||
httpPrefix + '://' + domain + \
|
localActorUrl(httpPrefix, 'news', domain) + \
|
||||||
'/users/news/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
# file where the post is stored
|
# file where the post is stored
|
||||||
filename = basePath + '/' + newPostId.replace('/', '#') + '.json'
|
filename = basePath + '/' + newPostId.replace('/', '#') + '.json'
|
||||||
|
|
@ -613,7 +614,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
continue
|
continue
|
||||||
|
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/news' + \
|
localActorUrl(httpPrefix, 'news', domain) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
blog['news'] = True
|
blog['news'] = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,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 blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
from blocking import isBlockedHashtag
|
from blocking import isBlockedHashtag
|
||||||
from filters import isFiltered
|
from filters import isFiltered
|
||||||
|
|
@ -68,8 +69,9 @@ def rss2Header(httpPrefix: str,
|
||||||
else:
|
else:
|
||||||
rssStr += \
|
rssStr += \
|
||||||
' <title>' + translate[title] + '</title>' + \
|
' <title>' + translate[title] + '</title>' + \
|
||||||
' <link>' + httpPrefix + '://' + domainFull + \
|
' <link>' + \
|
||||||
'/users/' + nickname + '/rss.xml' + '</link>'
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
|
'/rss.xml' + '</link>'
|
||||||
return rssStr
|
return rssStr
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,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 blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
from blocking import outboxBlock
|
from blocking import outboxBlock
|
||||||
from blocking import outboxUndoBlock
|
from blocking import outboxUndoBlock
|
||||||
|
|
@ -100,8 +101,8 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s actor update id is not a string')
|
print('DEBUG: c2s actor update id is not a string')
|
||||||
return
|
return
|
||||||
actor = \
|
domainFull = getFullDomain(domain, port)
|
||||||
httpPrefix + '://' + getFullDomain(domain, port) + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
if len(messageJson['to']) != 1:
|
if len(messageJson['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 ' +
|
||||||
|
|
@ -393,7 +394,7 @@ def postMessageToOutbox(session, translate: {},
|
||||||
if messageJson['type'] in indexedActivities:
|
if messageJson['type'] in indexedActivities:
|
||||||
indexes = [outboxName, "inbox"]
|
indexes = [outboxName, "inbox"]
|
||||||
selfActor = \
|
selfActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + postToNickname
|
localActorUrl(httpPrefix, postToNickname, domainFull)
|
||||||
for boxNameIndex in indexes:
|
for boxNameIndex in indexes:
|
||||||
if not boxNameIndex:
|
if not boxNameIndex:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,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 session import createSession
|
from session import createSession
|
||||||
from session import getJson
|
from session import getJson
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
|
|
@ -138,8 +139,8 @@ def setProfileImage(baseDir: str, httpPrefix: str, nickname: str, domain: str,
|
||||||
if personJson:
|
if personJson:
|
||||||
personJson[iconFilenameBase]['mediaType'] = mediaType
|
personJson[iconFilenameBase]['mediaType'] = mediaType
|
||||||
personJson[iconFilenameBase]['url'] = \
|
personJson[iconFilenameBase]['url'] = \
|
||||||
httpPrefix + '://' + fullDomain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, fullDomain) + \
|
||||||
nickname + '/' + iconFilename
|
'/' + iconFilename
|
||||||
saveJson(personJson, personFilename)
|
saveJson(personJson, personFilename)
|
||||||
|
|
||||||
cmd = \
|
cmd = \
|
||||||
|
|
@ -251,7 +252,7 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
# Enable follower approval by default
|
# Enable follower approval by default
|
||||||
approveFollowers = manualFollowerApproval
|
approveFollowers = manualFollowerApproval
|
||||||
personName = nickname
|
personName = nickname
|
||||||
personId = httpPrefix + '://' + domain + '/users/' + nickname
|
personId = localActorUrl(httpPrefix, nickname, domain)
|
||||||
inboxStr = personId + '/inbox'
|
inboxStr = personId + '/inbox'
|
||||||
personUrl = httpPrefix + '://' + domain + '/@' + personName
|
personUrl = httpPrefix + '://' + domain + '/@' + personName
|
||||||
if nickname == 'inbox':
|
if nickname == 'inbox':
|
||||||
|
|
|
||||||
3
pgp.py
3
pgp.py
|
|
@ -15,6 +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 webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from posts import getPersonBox
|
from posts import getPersonBox
|
||||||
from auth import createBasicAuthHeader
|
from auth import createBasicAuthHeader
|
||||||
|
|
@ -489,7 +490,7 @@ def pgpPublicKeyUpload(baseDir: str, session,
|
||||||
if debug:
|
if debug:
|
||||||
print('Actor for ' + handle + ' obtained')
|
print('Actor for ' + handle + ' obtained')
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
handle = actor.replace('/users/', '/@')
|
handle = actor.replace('/users/', '/@')
|
||||||
|
|
||||||
# check that this looks like the correct actor
|
# check that this looks like the correct actor
|
||||||
|
|
|
||||||
111
posts.py
111
posts.py
|
|
@ -63,6 +63,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 media import attachMedia
|
from media import attachMedia
|
||||||
from media import replaceYouTube
|
from media import replaceYouTube
|
||||||
from content import limitRepeatedWords
|
from content import limitRepeatedWords
|
||||||
|
|
@ -292,7 +293,7 @@ def getPersonBox(baseDir: str, session, wfRequest: {},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
# the final fallback is a mastodon style url
|
# the final fallback is a mastodon style url
|
||||||
personUrl = httpPrefix + '://' + domain + '/users/' + nickname
|
personUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||||
if not personUrl:
|
if not personUrl:
|
||||||
return None, None, None, None, None, None, None
|
return None, None, None, None, None, None, None
|
||||||
|
|
||||||
|
|
@ -766,7 +767,7 @@ def savePostToBox(baseDir: str, httpPrefix: str, postId: str,
|
||||||
if not postId:
|
if not postId:
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
postId = \
|
postId = \
|
||||||
httpPrefix + '://' + originalDomain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, originalDomain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
postJsonObject['id'] = postId + '/activity'
|
postJsonObject['id'] = postId + '/activity'
|
||||||
if hasObjectDict(postJsonObject):
|
if hasObjectDict(postJsonObject):
|
||||||
|
|
@ -919,14 +920,14 @@ def _createPostS2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
conversationId: str, lowBandwidth: bool) -> {}:
|
conversationId: str, lowBandwidth: bool) -> {}:
|
||||||
"""Creates a new server-to-server post
|
"""Creates a new server-to-server post
|
||||||
"""
|
"""
|
||||||
actorUrl = httpPrefix + '://' + domain + '/users/' + nickname
|
actorUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
newPostUrl = \
|
newPostUrl = \
|
||||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
newPostAttributedTo = \
|
newPostAttributedTo = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname
|
localActorUrl(httpPrefix, nickname, domain)
|
||||||
if not conversationId:
|
if not conversationId:
|
||||||
conversationId = newPostId
|
conversationId = newPostId
|
||||||
newPost = {
|
newPost = {
|
||||||
|
|
@ -991,8 +992,9 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
conversationId: str, lowBandwidth: str) -> {}:
|
conversationId: str, lowBandwidth: str) -> {}:
|
||||||
"""Creates a new client-to-server post
|
"""Creates a new client-to-server post
|
||||||
"""
|
"""
|
||||||
|
domainFull = getFullDomain(domain, port)
|
||||||
idStr = \
|
idStr = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domainFull) + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
newPostUrl = \
|
newPostUrl = \
|
||||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
|
|
@ -1007,7 +1009,7 @@ def _createPostC2S(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
'inReplyTo': inReplyTo,
|
'inReplyTo': inReplyTo,
|
||||||
'published': published,
|
'published': published,
|
||||||
'url': newPostUrl,
|
'url': newPostUrl,
|
||||||
'attributedTo': httpPrefix + '://' + domain + '/users/' + nickname,
|
'attributedTo': localActorUrl(httpPrefix, nickname, domainFull),
|
||||||
'to': toRecipients,
|
'to': toRecipients,
|
||||||
'cc': toCC,
|
'cc': toCC,
|
||||||
'sensitive': sensitive,
|
'sensitive': sensitive,
|
||||||
|
|
@ -1205,8 +1207,8 @@ def _createPostBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
newPostId = \
|
newPostId = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
|
|
||||||
sensitive = False
|
sensitive = False
|
||||||
summary = None
|
summary = None
|
||||||
|
|
@ -1347,7 +1349,7 @@ def outboxMessageCreateWrap(httpPrefix: str,
|
||||||
if messageJson.get('published'):
|
if messageJson.get('published'):
|
||||||
published = messageJson['published']
|
published = messageJson['published']
|
||||||
newPostId = \
|
newPostId = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
cc = []
|
cc = []
|
||||||
if messageJson.get('cc'):
|
if messageJson.get('cc'):
|
||||||
|
|
@ -1356,7 +1358,7 @@ def outboxMessageCreateWrap(httpPrefix: 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': httpPrefix + '://' + domain + '/users/' + nickname,
|
'actor': localActorUrl(httpPrefix, nickname, domain),
|
||||||
'published': published,
|
'published': published,
|
||||||
'to': messageJson['to'],
|
'to': messageJson['to'],
|
||||||
'cc': cc,
|
'cc': cc,
|
||||||
|
|
@ -1366,7 +1368,7 @@ def outboxMessageCreateWrap(httpPrefix: str,
|
||||||
newPost['object']['url'] = \
|
newPost['object']['url'] = \
|
||||||
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
httpPrefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||||
newPost['object']['atomUri'] = \
|
newPost['object']['atomUri'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
'/statuses/' + statusNumber
|
'/statuses/' + statusNumber
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
|
|
@ -1395,8 +1397,8 @@ def _postIsAddressedToFollowers(baseDir: str,
|
||||||
if postJsonObject.get('cc'):
|
if postJsonObject.get('cc'):
|
||||||
ccList = postJsonObject['cc']
|
ccList = postJsonObject['cc']
|
||||||
|
|
||||||
followersUrl = httpPrefix + '://' + domainFull + '/users/' + \
|
followersUrl = \
|
||||||
nickname + '/followers'
|
localActorUrl(httpPrefix, nickname, domainFull) + '/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
|
||||||
|
|
@ -1434,7 +1436,7 @@ def getPinnedPostAsJson(baseDir: str, httpPrefix: str,
|
||||||
accountDir = acctDir(baseDir, nickname, domain)
|
accountDir = acctDir(baseDir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
pinnedPostJson = {}
|
pinnedPostJson = {}
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
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:
|
||||||
|
|
@ -1479,7 +1481,7 @@ def jsonPinPost(baseDir: str, httpPrefix: str,
|
||||||
if pinnedPostJson:
|
if pinnedPostJson:
|
||||||
itemsList = [pinnedPostJson]
|
itemsList = [pinnedPostJson]
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
return {
|
return {
|
||||||
'@context': [
|
'@context': [
|
||||||
'https://www.w3.org/ns/activitystreams',
|
'https://www.w3.org/ns/activitystreams',
|
||||||
|
|
@ -1559,10 +1561,10 @@ def createPublicPost(baseDir: str,
|
||||||
anonymousParticipationEnabled = None
|
anonymousParticipationEnabled = None
|
||||||
eventStatus = None
|
eventStatus = None
|
||||||
ticketUrl = None
|
ticketUrl = None
|
||||||
|
localActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
return _createPostBase(baseDir, nickname, domain, port,
|
return _createPostBase(baseDir, nickname, domain, port,
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
localActor + '/followers',
|
||||||
nickname + '/followers',
|
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
|
|
@ -1680,11 +1682,11 @@ def createQuestionPost(baseDir: str,
|
||||||
"""Question post with multiple choice options
|
"""Question post with multiple choice options
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
localActor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
messageJson = \
|
messageJson = \
|
||||||
_createPostBase(baseDir, nickname, domain, port,
|
_createPostBase(baseDir, nickname, domain, port,
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
localActor + '/followers',
|
||||||
nickname + '/followers',
|
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
|
|
@ -1729,9 +1731,9 @@ def createUnlistedPost(baseDir: str,
|
||||||
"""Unlisted post. This has the #Public and followers links inverted.
|
"""Unlisted post. This has the #Public and followers links inverted.
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
localActor = localActorUrl(httpPrefix, domainFull, nickname)
|
||||||
return _createPostBase(baseDir, nickname, domain, port,
|
return _createPostBase(baseDir, nickname, domain, port,
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
localActor + '/followers',
|
||||||
nickname + '/followers',
|
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
|
|
@ -1762,9 +1764,9 @@ def createFollowersOnlyPost(baseDir: str,
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
localActor = localActorUrl(httpPrefix, domainFull, nickname)
|
||||||
return _createPostBase(baseDir, nickname, domain, port,
|
return _createPostBase(baseDir, nickname, domain, port,
|
||||||
httpPrefix + '://' + domainFull + '/users/' +
|
localActor + '/followers',
|
||||||
nickname + '/followers',
|
|
||||||
None,
|
None,
|
||||||
httpPrefix, content, followersOnly, saveToFile,
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
clientToServer, commentsEnabled,
|
clientToServer, commentsEnabled,
|
||||||
|
|
@ -1808,8 +1810,7 @@ def getMentionedPeople(baseDir: str, httpPrefix: str,
|
||||||
if not validNickname(mentionedDomain, mentionedNickname):
|
if not validNickname(mentionedDomain, mentionedNickname):
|
||||||
continue
|
continue
|
||||||
actor = \
|
actor = \
|
||||||
httpPrefix + '://' + handle.split('@')[1] + \
|
localActorUrl(httpPrefix, mentionedNickname, handle.split('@')[1])
|
||||||
'/users/' + mentionedNickname
|
|
||||||
mentions.append(actor)
|
mentions.append(actor)
|
||||||
return mentions
|
return mentions
|
||||||
|
|
||||||
|
|
@ -1898,8 +1899,9 @@ def createReportPost(baseDir: str,
|
||||||
if line.startswith('@'):
|
if line.startswith('@'):
|
||||||
line = line[1:]
|
line = line[1:]
|
||||||
if '@' in line:
|
if '@' in line:
|
||||||
moderatorActor = httpPrefix + '://' + domainFull + \
|
nick = line.split('@')[0]
|
||||||
'/users/' + line.split('@')[0]
|
moderatorActor = \
|
||||||
|
localActorUrl(httpPrefix, nick, domainFull)
|
||||||
if moderatorActor not in moderatorsList:
|
if moderatorActor not in moderatorsList:
|
||||||
moderatorsList.append(moderatorActor)
|
moderatorsList.append(moderatorActor)
|
||||||
continue
|
continue
|
||||||
|
|
@ -1910,16 +1912,16 @@ def createReportPost(baseDir: str,
|
||||||
moderatorsList.append(line)
|
moderatorsList.append(line)
|
||||||
else:
|
else:
|
||||||
if '/' not in line:
|
if '/' not in line:
|
||||||
moderatorActor = httpPrefix + '://' + domainFull + \
|
moderatorActor = \
|
||||||
'/users/' + line
|
localActorUrl(httpPrefix, line, domainFull)
|
||||||
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(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
moderatorsList.append(httpPrefix + '://' + domainFull +
|
localActor = localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||||
'/users/' + adminNickname)
|
moderatorsList.append(localActor)
|
||||||
if not moderatorsList:
|
if not moderatorsList:
|
||||||
return None
|
return None
|
||||||
if debug:
|
if debug:
|
||||||
|
|
@ -2236,18 +2238,17 @@ def sendPostViaServer(projectVersion: str,
|
||||||
clientToServer = True
|
clientToServer = 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 = httpPrefix + '://' + fromDomainFull + '/users/' + \
|
cc = localActorUrl(httpPrefix, fromNickname, fromDomainFull) + \
|
||||||
fromNickname + '/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 = \
|
||||||
httpPrefix + '://' + \
|
localActorUrl(httpPrefix, fromNickname, fromDomainFull) + \
|
||||||
fromDomainFull + '/users/' + fromNickname + '/followers'
|
'/followers'
|
||||||
else:
|
else:
|
||||||
toDomainFull = getFullDomain(toDomain, toPort)
|
toDomainFull = getFullDomain(toDomain, toPort)
|
||||||
toPersonId = httpPrefix + '://' + toDomainFull + \
|
toPersonId = localActorUrl(httpPrefix, toNickname, toDomainFull)
|
||||||
'/users/' + toNickname
|
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
_createPostBase(baseDir,
|
_createPostBase(baseDir,
|
||||||
|
|
@ -3086,7 +3087,7 @@ def createModeration(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
|
|
||||||
pageStr = '?page=' + str(pageNumber)
|
pageStr = '?page=' + str(pageNumber)
|
||||||
boxUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/' + boxname
|
boxUrl = localActorUrl(httpPrefix, 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',
|
||||||
|
|
@ -3362,7 +3363,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
originalDomain = domain
|
originalDomain = domain
|
||||||
domain = getFullDomain(domain, port)
|
domain = getFullDomain(domain, port)
|
||||||
|
|
||||||
boxActor = httpPrefix + '://' + domain + '/users/' + nickname
|
boxActor = localActorUrl(httpPrefix, nickname, domain)
|
||||||
|
|
||||||
pageStr = '?page=true'
|
pageStr = '?page=true'
|
||||||
if pageNumber:
|
if pageNumber:
|
||||||
|
|
@ -3372,7 +3373,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
pageStr = '?page=' + str(pageNumber)
|
pageStr = '?page=' + str(pageNumber)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
boxUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/' + boxname
|
boxUrl = localActorUrl(httpPrefix, 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',
|
||||||
|
|
@ -3493,8 +3494,8 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
if lastPage < 1:
|
if lastPage < 1:
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
boxHeader['last'] = \
|
boxHeader['last'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + boxname + '?page=' + str(lastPage)
|
'/' + boxname + '?page=' + str(lastPage)
|
||||||
|
|
||||||
if headerOnly:
|
if headerOnly:
|
||||||
boxHeader['totalItems'] = len(postsInBox)
|
boxHeader['totalItems'] = len(postsInBox)
|
||||||
|
|
@ -3502,13 +3503,13 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
if pageNumber > 1:
|
if pageNumber > 1:
|
||||||
prevPageStr = str(pageNumber - 1)
|
prevPageStr = str(pageNumber - 1)
|
||||||
boxHeader['prev'] = \
|
boxHeader['prev'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + boxname + '?page=' + prevPageStr
|
'/' + boxname + '?page=' + prevPageStr
|
||||||
|
|
||||||
nextPageStr = str(pageNumber + 1)
|
nextPageStr = str(pageNumber + 1)
|
||||||
boxHeader['next'] = \
|
boxHeader['next'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
nickname + '/' + boxname + '?page=' + nextPageStr
|
'/' + boxname + '?page=' + nextPageStr
|
||||||
return boxHeader
|
return boxHeader
|
||||||
|
|
||||||
for postStr in postsInBox:
|
for postStr in postsInBox:
|
||||||
|
|
@ -4358,11 +4359,10 @@ def sendBlockViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
blockActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + '/users/' + \
|
ccUrl = blockActor + '/followers'
|
||||||
fromNickname + '/followers'
|
|
||||||
|
|
||||||
blockActor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
newBlockJson = {
|
newBlockJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Block',
|
'type': 'Block',
|
||||||
|
|
@ -4439,7 +4439,7 @@ def sendMuteViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
handle = actor.replace('/users/', '/@')
|
handle = actor.replace('/users/', '/@')
|
||||||
|
|
||||||
newMuteJson = {
|
newMuteJson = {
|
||||||
|
|
@ -4515,7 +4515,7 @@ def sendUndoMuteViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
handle = actor.replace('/users/', '/@')
|
handle = actor.replace('/users/', '/@')
|
||||||
|
|
||||||
undoMuteJson = {
|
undoMuteJson = {
|
||||||
|
|
@ -4597,11 +4597,10 @@ def sendUndoBlockViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
blockActor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + '/users/' + \
|
ccUrl = blockActor + '/followers'
|
||||||
fromNickname + '/followers'
|
|
||||||
|
|
||||||
blockActor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
newBlockJson = {
|
newBlockJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Undo',
|
'type': 'Undo',
|
||||||
|
|
@ -4705,7 +4704,7 @@ def c2sBoxJson(baseDir: str, session,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(nickname, password)
|
authHeader = createBasicAuthHeader(nickname, password)
|
||||||
|
|
||||||
|
|
|
||||||
42
shares.py
42
shares.py
|
|
@ -37,6 +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 media import processMetaData
|
from media import processMetaData
|
||||||
from media import convertImageToLowBandwidth
|
from media import convertImageToLowBandwidth
|
||||||
from filters import isFilteredGlobally
|
from filters import isFilteredGlobally
|
||||||
|
|
@ -274,14 +275,13 @@ def _indicateNewShareAvailable(baseDir: str, httpPrefix: str,
|
||||||
if isBlocked(baseDir, accountNickname, domain,
|
if isBlocked(baseDir, accountNickname, domain,
|
||||||
nickname, domain, None):
|
nickname, domain, None):
|
||||||
continue
|
continue
|
||||||
|
localActor = localActorUrl(httpPrefix, accountNickname, domainFull)
|
||||||
try:
|
try:
|
||||||
with open(newShareFile, 'w+') as fp:
|
with open(newShareFile, 'w+') as fp:
|
||||||
if sharesFileType == 'shares':
|
if sharesFileType == 'shares':
|
||||||
fp.write(httpPrefix + '://' + domainFull +
|
fp.write(localActor + '/tlshares')
|
||||||
'/users/' + accountNickname + '/tlshares')
|
|
||||||
else:
|
else:
|
||||||
fp.write(httpPrefix + '://' + domainFull +
|
fp.write(localActor + '/tlwanted')
|
||||||
'/users/' + accountNickname + '/tlwanted')
|
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
break
|
break
|
||||||
|
|
@ -313,7 +313,7 @@ def addShare(baseDir: str,
|
||||||
durationSec = _addShareDurationSec(duration, published)
|
durationSec = _addShareDurationSec(duration, published)
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
itemID = _getValidSharedItemID(actor, displayName)
|
itemID = _getValidSharedItemID(actor, displayName)
|
||||||
dfcId = _getshareDfcId(baseDir, systemLanguage,
|
dfcId = _getshareDfcId(baseDir, systemLanguage,
|
||||||
itemType, itemCategory, translate)
|
itemType, itemCategory, translate)
|
||||||
|
|
@ -474,7 +474,7 @@ def getSharesFeedForPerson(baseDir: str,
|
||||||
sharesJson = loadJson(sharesFilename)
|
sharesJson = loadJson(sharesFilename)
|
||||||
if sharesJson:
|
if sharesJson:
|
||||||
noOfShares = len(sharesJson.items())
|
noOfShares = len(sharesJson.items())
|
||||||
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
idStr = localActorUrl(httpPrefix, 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',
|
||||||
|
|
@ -488,7 +488,7 @@ def getSharesFeedForPerson(baseDir: str,
|
||||||
pageNumber = 1
|
pageNumber = 1
|
||||||
|
|
||||||
nextPageNumber = int(pageNumber + 1)
|
nextPageNumber = int(pageNumber + 1)
|
||||||
idStr = httpPrefix + '://' + domain + '/users/' + nickname
|
idStr = localActorUrl(httpPrefix, 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),
|
||||||
|
|
@ -521,7 +521,7 @@ def getSharesFeedForPerson(baseDir: str,
|
||||||
lastPage = 1
|
lastPage = 1
|
||||||
if nextPageNumber > lastPage:
|
if nextPageNumber > lastPage:
|
||||||
shares['next'] = \
|
shares['next'] = \
|
||||||
httpPrefix + '://' + domain + '/users/' + nickname + \
|
localActorUrl(httpPrefix, nickname, domain) + \
|
||||||
'/' + sharesFileType + '?page=' + str(lastPage)
|
'/' + sharesFileType + '?page=' + str(lastPage)
|
||||||
return shares
|
return shares
|
||||||
|
|
||||||
|
|
@ -552,11 +552,10 @@ def sendShareViaServer(baseDir, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + \
|
ccUrl = actor + '/followers'
|
||||||
'/users/' + fromNickname + '/followers'
|
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
newShareJson = {
|
newShareJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Add',
|
'type': 'Add',
|
||||||
|
|
@ -662,11 +661,10 @@ def sendUndoShareViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + \
|
ccUrl = actor + '/followers'
|
||||||
'/users/' + fromNickname + '/followers'
|
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
undoShareJson = {
|
undoShareJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Remove',
|
'type': 'Remove',
|
||||||
|
|
@ -766,11 +764,10 @@ def sendWantedViaServer(baseDir, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + \
|
ccUrl = actor + '/followers'
|
||||||
'/users/' + fromNickname + '/followers'
|
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
newShareJson = {
|
newShareJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Add',
|
'type': 'Add',
|
||||||
|
|
@ -876,11 +873,10 @@ def sendUndoWantedViaServer(baseDir: str, session,
|
||||||
|
|
||||||
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
fromDomainFull = getFullDomain(fromDomain, fromPort)
|
||||||
|
|
||||||
|
actor = localActorUrl(httpPrefix, fromNickname, fromDomainFull)
|
||||||
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
toUrl = 'https://www.w3.org/ns/activitystreams#Public'
|
||||||
ccUrl = httpPrefix + '://' + fromDomainFull + \
|
ccUrl = actor + '/followers'
|
||||||
'/users/' + fromNickname + '/followers'
|
|
||||||
|
|
||||||
actor = httpPrefix + '://' + fromDomainFull + '/users/' + fromNickname
|
|
||||||
undoShareJson = {
|
undoShareJson = {
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
'type': 'Remove',
|
'type': 'Remove',
|
||||||
|
|
@ -973,7 +969,7 @@ def getSharedItemsCatalogViaServer(baseDir, session,
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
}
|
}
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
url = httpPrefix + '://' + domainFull + '/users/' + nickname + '/catalog'
|
url = localActorUrl(httpPrefix, nickname, domainFull) + '/catalog'
|
||||||
if debug:
|
if debug:
|
||||||
print('Shared items catalog request to: ' + url)
|
print('Shared items catalog request to: ' + url)
|
||||||
catalogJson = getJson(session, url, headers, None, debug,
|
catalogJson = getJson(session, url, headers, None, debug,
|
||||||
|
|
@ -1139,7 +1135,7 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
||||||
"http://static.datafoodconsortium.org/ontologies/DFC_FullModel.owl#"
|
"http://static.datafoodconsortium.org/ontologies/DFC_FullModel.owl#"
|
||||||
dfcPtUrl = \
|
dfcPtUrl = \
|
||||||
"http://static.datafoodconsortium.org/data/productTypes.rdf#"
|
"http://static.datafoodconsortium.org/data/productTypes.rdf#"
|
||||||
owner = httpPrefix + '://' + domainFull + '/users/' + nickname
|
owner = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
if sharesFileType == 'shares':
|
if sharesFileType == 'shares':
|
||||||
dfcInstanceId = owner + '/catalog'
|
dfcInstanceId = owner + '/catalog'
|
||||||
else:
|
else:
|
||||||
|
|
@ -1248,7 +1244,7 @@ def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
|
||||||
continue
|
continue
|
||||||
nickname = acct.split('@')[0]
|
nickname = acct.split('@')[0]
|
||||||
domain = acct.split('@')[1]
|
domain = acct.split('@')[1]
|
||||||
owner = httpPrefix + '://' + domainFull + '/users/' + nickname
|
owner = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(baseDir, nickname, domain) + '/' + \
|
acctDir(baseDir, nickname, domain) + '/' + \
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,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
|
||||||
|
|
||||||
|
|
||||||
def setSkillsFromDict(actorJson: {}, skillsDict: {}) -> []:
|
def setSkillsFromDict(actorJson: {}, skillsDict: {}) -> []:
|
||||||
|
|
@ -185,7 +186,7 @@ def sendSkillViaServer(baseDir: str, session, nickname: str, password: str,
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
toUrl = actor
|
toUrl = actor
|
||||||
ccUrl = actor + '/followers'
|
ccUrl = actor + '/followers'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,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 content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
|
|
||||||
speakerRemoveChars = ('.\n', '. ', ',', ';', '?', '!')
|
speakerRemoveChars = ('.\n', '. ', ',', ';', '?', '!')
|
||||||
|
|
@ -452,7 +453,7 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
img['name'] + '. '
|
img['name'] + '. '
|
||||||
|
|
||||||
isDirect = isDM(postJsonObject)
|
isDirect = isDM(postJsonObject)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
replyToYou = isReply(postJsonObject, actor)
|
replyToYou = isReply(postJsonObject, actor)
|
||||||
|
|
||||||
published = ''
|
published = ''
|
||||||
|
|
|
||||||
6
utils.py
6
utils.py
|
|
@ -28,6 +28,12 @@ invalidCharacters = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def localActorUrl(httpPrefix: str, nickname: str, domainFull: str) -> str:
|
||||||
|
"""Returns the url for an actor on this instance
|
||||||
|
"""
|
||||||
|
return httpPrefix + '://' + domainFull + '/users/' + nickname
|
||||||
|
|
||||||
|
|
||||||
def getActorLanguagesList(actorJson: {}) -> []:
|
def getActorLanguagesList(actorJson: {}) -> []:
|
||||||
"""Returns a list containing languages used by the given actor
|
"""Returns a list containing languages used by the given actor
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,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 happening import getTodaysEvents
|
from happening import getTodaysEvents
|
||||||
from happening import getCalendarEvents
|
from happening import getCalendarEvents
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
|
|
@ -37,7 +38,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, baseDir: 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 = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = getDomainFromActor(actor)
|
||||||
messageId = actor + '/statuses/' + postId
|
messageId = actor + '/statuses/' + postId
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ from utils import getConfigParam
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import isEditor
|
from utils import isEditor
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
|
from utils import localActorUrl
|
||||||
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
|
||||||
|
|
@ -37,7 +38,7 @@ def _getLeftColumnShares(baseDir: 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 = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
# 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 = \
|
||||||
|
|
@ -75,7 +76,7 @@ def _getLeftColumnWanted(baseDir: 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 = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
# 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 = \
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,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 posts import downloadFollowCollection
|
from posts import downloadFollowCollection
|
||||||
from posts import getPublicPostInfo
|
from posts import getPublicPostInfo
|
||||||
from posts import isModerator
|
from posts import isModerator
|
||||||
|
|
@ -94,7 +95,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
||||||
|
|
||||||
searchHandle = searchNickname + '@' + searchDomain
|
searchHandle = searchNickname + '@' + searchDomain
|
||||||
searchActor = \
|
searchActor = \
|
||||||
httpPrefix + '://' + searchDomain + '/users/' + searchNickname
|
localActorUrl(httpPrefix, 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 + \
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,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 content import limitRepeatedWords
|
from content import limitRepeatedWords
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
from content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
|
|
@ -1547,8 +1548,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
postJsonObject['object']['content']
|
postJsonObject['object']['content']
|
||||||
|
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
personUrl = \
|
personUrl = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
httpPrefix + '://' + domainFull + '/users/' + nickname
|
|
||||||
actorJson = \
|
actorJson = \
|
||||||
getPersonFromCache(baseDir, personUrl, personCache, False)
|
getPersonFromCache(baseDir, personUrl, personCache, False)
|
||||||
languagesUnderstood = []
|
languagesUnderstood = []
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,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 languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from skills import getSkills
|
from skills import getSkills
|
||||||
from theme import getThemesList
|
from theme import getThemesList
|
||||||
|
|
@ -345,7 +346,7 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
|
||||||
otherAccountsHtml = \
|
otherAccountsHtml = \
|
||||||
' <p>' + translate['Other accounts'] + ': '
|
' <p>' + translate['Other accounts'] + ': '
|
||||||
|
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
ctr = 0
|
ctr = 0
|
||||||
if isinstance(alsoKnownAs, list):
|
if isinstance(alsoKnownAs, list):
|
||||||
for altActor in alsoKnownAs:
|
for altActor in alsoKnownAs:
|
||||||
|
|
@ -654,10 +655,10 @@ def htmlProfile(rssIconAtTop: bool,
|
||||||
if '://' in followerHandle:
|
if '://' in followerHandle:
|
||||||
followerActor = followerHandle
|
followerActor = followerHandle
|
||||||
else:
|
else:
|
||||||
|
nick = followerHandle.split('@')[0]
|
||||||
|
dom = followerHandle.split('@')[1]
|
||||||
followerActor = \
|
followerActor = \
|
||||||
httpPrefix + '://' + \
|
localActorUrl(httpPrefix, nick, dom)
|
||||||
followerHandle.split('@')[1] + \
|
|
||||||
'/users/' + followerHandle.split('@')[0]
|
|
||||||
basePath = '/users/' + nickname
|
basePath = '/users/' + nickname
|
||||||
followApprovalsSection += '<div class="container">'
|
followApprovalsSection += '<div class="container">'
|
||||||
followApprovalsSection += \
|
followApprovalsSection += \
|
||||||
|
|
|
||||||
|
|
@ -25,6 +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 skills import noOfActorSkills
|
from skills import noOfActorSkills
|
||||||
from skills import getSkillsFromList
|
from skills import getSkillsFromList
|
||||||
from categories import getHashtagCategory
|
from categories import getHashtagCategory
|
||||||
|
|
@ -597,7 +598,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
|
||||||
|
|
||||||
# add the page title
|
# add the page title
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
historySearchTitle = '🔍 ' + translate['Your Posts']
|
historySearchTitle = '🔍 ' + translate['Your Posts']
|
||||||
if boxName == 'bookmarks':
|
if boxName == 'bookmarks':
|
||||||
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,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 follow import followerApprovalActive
|
from follow import followerApprovalActive
|
||||||
from person import isPersonSnoozed
|
from person import isPersonSnoozed
|
||||||
from markdown import markdownToHtml
|
from markdown import markdownToHtml
|
||||||
|
|
@ -996,12 +997,12 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
||||||
baseDir, domain, nickname, maxSharesPerAccount,
|
baseDir, domain, nickname, maxSharesPerAccount,
|
||||||
sharedItemsFederatedDomains, sharesFileType)
|
sharedItemsFederatedDomains, sharesFileType)
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
adminActor = ''
|
adminActor = ''
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
adminActor = \
|
adminActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + adminNickname
|
localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||||
timelineStr = ''
|
timelineStr = ''
|
||||||
|
|
||||||
if pageNumber > 1:
|
if pageNumber > 1:
|
||||||
|
|
|
||||||
|
|
@ -10,6 +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 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
|
||||||
|
|
@ -44,8 +45,7 @@ def htmlTermsOfService(cssCache: {}, baseDir: str,
|
||||||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||||
if adminNickname:
|
if adminNickname:
|
||||||
adminActor = httpPrefix + '://' + domainFull + \
|
adminActor = localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||||
'/users/' + adminNickname
|
|
||||||
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="' + \
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,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 cache import storePersonInCache
|
from cache import storePersonInCache
|
||||||
from content import addHtmlTags
|
from content import addHtmlTags
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
|
|
@ -692,7 +693,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
|
||||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
|
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
|
||||||
systemLanguage)
|
systemLanguage)
|
||||||
|
|
||||||
authorUrl = httpPrefix + '://' + domain + '/users/' + nickname
|
authorUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||||
aboutUrl = httpPrefix + '://' + domain + '/about.html'
|
aboutUrl = httpPrefix + '://' + domain + '/about.html'
|
||||||
|
|
||||||
# license for content on the site may be different from
|
# license for content on the site may be different from
|
||||||
|
|
@ -1310,7 +1311,7 @@ def htmlSearchResultShare(baseDir: str, sharedItem: {}, translate: {},
|
||||||
' ' + sharedItem['itemCurrency']
|
' ' + sharedItem['itemCurrency']
|
||||||
sharedItemsForm += '</p>\n'
|
sharedItemsForm += '</p>\n'
|
||||||
contactActor = \
|
contactActor = \
|
||||||
httpPrefix + '://' + domainFull + '/users/' + contactNickname
|
localActorUrl(httpPrefix, contactNickname, domainFull)
|
||||||
sharedItemsForm += \
|
sharedItemsForm += \
|
||||||
'<p>' + \
|
'<p>' + \
|
||||||
'<a href="' + actor + '?replydm=sharedesc:' + \
|
'<a href="' + actor + '?replydm=sharedesc:' + \
|
||||||
|
|
@ -1401,7 +1402,7 @@ def htmlShowShare(baseDir: 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 = httpPrefix + '://' + domainFull + '/users/' + nickname
|
actor = localActorUrl(httpPrefix, nickname, domainFull)
|
||||||
|
|
||||||
# filename of the banner shown at the top
|
# filename of the banner shown at the top
|
||||||
bannerFile, bannerFilename = \
|
bannerFile, bannerFilename = \
|
||||||
|
|
|
||||||
|
|
@ -15,6 +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 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
|
||||||
|
|
@ -75,8 +76,7 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str,
|
||||||
if os.path.isfile(avatarFilename):
|
if os.path.isfile(avatarFilename):
|
||||||
break
|
break
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
httpPrefix + '://' + domainFull + \
|
localActorUrl(httpPrefix, nickname, domainFull) + '/avatar.' + ext
|
||||||
'/users/' + nickname + '/avatar.' + ext
|
|
||||||
|
|
||||||
imageFormats = getImageFormats()
|
imageFormats = getImageFormats()
|
||||||
profileForm += '<div class="container">' + profileText + '</div>\n'
|
profileForm += '<div class="container">' + profileText + '</div>\n'
|
||||||
|
|
|
||||||
|
|
@ -20,6 +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
|
||||||
|
|
||||||
|
|
||||||
def _parseHandle(handle: str) -> (str, str, bool):
|
def _parseHandle(handle: str) -> (str, str, bool):
|
||||||
|
|
@ -145,7 +146,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
||||||
domain = getFullDomain(domain, port)
|
domain = getFullDomain(domain, port)
|
||||||
|
|
||||||
personName = nickname
|
personName = nickname
|
||||||
personId = httpPrefix + "://" + domain + "/users/" + personName
|
personId = localActorUrl(httpPrefix, personName, domain)
|
||||||
if not groupAccount:
|
if not groupAccount:
|
||||||
subjectStr = "acct:" + personName + "@" + originalDomain
|
subjectStr = "acct:" + personName + "@" + originalDomain
|
||||||
else:
|
else:
|
||||||
|
|
@ -158,7 +159,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
||||||
profilePageHref = httpPrefix + '://' + domain + \
|
profilePageHref = httpPrefix + '://' + domain + \
|
||||||
'/about/more?instance_actor=true'
|
'/about/more?instance_actor=true'
|
||||||
|
|
||||||
actor = httpPrefix + "://" + domain + "/users/" + nickname
|
actor = localActorUrl(httpPrefix, nickname, domain)
|
||||||
account = {
|
account = {
|
||||||
"aliases": [
|
"aliases": [
|
||||||
httpPrefix + "://" + domain + "/@" + personName,
|
httpPrefix + "://" + domain + "/@" + personName,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue