mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
db8465709e
commit
6abe5d83fe
10
announce.py
10
announce.py
|
@ -104,13 +104,13 @@ def outboxAnnounce(recentPostsCache: {},
|
|||
|
||||
|
||||
def announcedByPerson(isAnnounced: bool, postActor: str,
|
||||
nickname: str, domainFull: str) -> bool:
|
||||
nickname: str, domain_full: str) -> bool:
|
||||
"""Returns True if the given post is announced by the given person
|
||||
"""
|
||||
if not postActor:
|
||||
return False
|
||||
if isAnnounced and \
|
||||
postActor.endswith(domainFull + '/users/' + nickname):
|
||||
postActor.endswith(domain_full + '/users/' + nickname):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -315,9 +315,9 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
print('WARN: No session for sendUndoAnnounceViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
handle = replaceUsersWithAt(actor)
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
@ -374,7 +374,7 @@ def sendUndoAnnounceViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
postResult = postJson(http_prefix, domain_full,
|
||||
session, unAnnounceJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
|
|
@ -90,9 +90,9 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
print('WARN: No session for sendAvailabilityViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
toUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
toUrl = localActorUrl(http_prefix, nickname, domain_full)
|
||||
ccUrl = toUrl + '/followers'
|
||||
|
||||
newAvailabilityJson = {
|
||||
|
@ -103,7 +103,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domain_full + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
|
@ -148,7 +148,7 @@ def sendAvailabilityViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
postResult = postJson(http_prefix, domain_full,
|
||||
session, newAvailabilityJson, [],
|
||||
inboxUrl, headers, 30, True)
|
||||
if not postResult:
|
||||
|
|
22
blocking.py
22
blocking.py
|
@ -543,8 +543,8 @@ def mutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if hasObjectString(post_json_object, debug):
|
||||
alsoUpdatePostId = removeIdEnding(post_json_object['object'])
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
if postJsonObj.get('conversation'):
|
||||
muteConversation(base_dir, nickname, domain,
|
||||
|
@ -687,8 +687,8 @@ def unmutePost(base_dir: str, nickname: str, domain: str, port: int,
|
|||
postJsonObj['conversation'])
|
||||
|
||||
if postJsonObj.get('ignores'):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
totalItems = 0
|
||||
if postJsonObj['ignores'].get('totalItems'):
|
||||
totalItems = postJsonObj['ignores']['totalItems']
|
||||
|
@ -778,8 +778,8 @@ def outboxMute(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not hasActor(message_json, debug):
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if not message_json['actor'].endswith(domainFull + '/users/' + nickname):
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if not message_json['actor'].endswith(domain_full + '/users/' + nickname):
|
||||
return
|
||||
if not message_json['type'] == 'Ignore':
|
||||
return
|
||||
|
@ -827,8 +827,8 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
|
|||
return
|
||||
if not hasActor(message_json, debug):
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if not message_json['actor'].endswith(domainFull + '/users/' + nickname):
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if not message_json['actor'].endswith(domain_full + '/users/' + nickname):
|
||||
return
|
||||
if not message_json['type'] == 'Undo':
|
||||
return
|
||||
|
@ -880,7 +880,7 @@ def broch_modeIsActive(base_dir: str) -> bool:
|
|||
return os.path.isfile(allowFilename)
|
||||
|
||||
|
||||
def setBrochMode(base_dir: str, domainFull: str, enabled: bool) -> None:
|
||||
def setBrochMode(base_dir: str, domain_full: str, enabled: bool) -> None:
|
||||
"""Broch mode can be used to lock down the instance during
|
||||
a period of time when it is temporarily under attack.
|
||||
For example, where an adversary is constantly spinning up new
|
||||
|
@ -906,7 +906,7 @@ def setBrochMode(base_dir: str, domainFull: str, enabled: bool) -> None:
|
|||
print('Broch mode already activated ' + lastModified)
|
||||
return
|
||||
# generate instance allow list
|
||||
allowedDomains = [domainFull]
|
||||
allowedDomains = [domain_full]
|
||||
followFiles = ('following.txt', 'followers.txt')
|
||||
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
|
||||
for acct in dirs:
|
||||
|
@ -935,7 +935,7 @@ def setBrochMode(base_dir: str, domainFull: str, enabled: bool) -> None:
|
|||
# write the allow file
|
||||
try:
|
||||
with open(allowFilename, 'w+') as allowFile:
|
||||
allowFile.write(domainFull + '\n')
|
||||
allowFile.write(domain_full + '\n')
|
||||
for d in allowedDomains:
|
||||
allowFile.write(d + '\n')
|
||||
print('Broch mode enabled')
|
||||
|
|
66
blog.py
66
blog.py
|
@ -40,7 +40,7 @@ from cache import getPersonFromCache
|
|||
|
||||
|
||||
def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
postId: str, depth=0) -> int:
|
||||
"""Returns the number of replies on the post
|
||||
This is recursive, so can handle replies to replies
|
||||
|
@ -85,7 +85,7 @@ def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
|||
replyPostId = replyPostId.replace('.replies', '')
|
||||
replies += \
|
||||
1 + _noOfBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
replyPostId, depth+1)
|
||||
else:
|
||||
# remove post which no longer exists
|
||||
|
@ -110,7 +110,7 @@ def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
|||
|
||||
|
||||
def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
postId: str, depth=0) -> str:
|
||||
"""Returns a string containing html blog posts
|
||||
"""
|
||||
|
@ -170,7 +170,7 @@ def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
|||
except OSError:
|
||||
print('EX: unable to read blog replies ' + postFilename)
|
||||
rply = _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
replyPostId, depth+1)
|
||||
if rply not in repliesStr:
|
||||
repliesStr += rply
|
||||
|
@ -187,7 +187,7 @@ def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
|||
|
||||
def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
peertube_instances: [],
|
||||
|
@ -236,7 +236,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
if handle:
|
||||
if handle.startswith(nickname + '@' + domain):
|
||||
blogStr += ' <a href="' + http_prefix + '://' + \
|
||||
domainFull + \
|
||||
domain_full + \
|
||||
'/users/' + nickname + '">' + handle + '</a>'
|
||||
linkedAuthor = True
|
||||
else:
|
||||
|
@ -265,7 +265,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
if attachmentStr:
|
||||
blogStr += '<br><center>' + attachmentStr + '</center>'
|
||||
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domain_full)
|
||||
actorJson = \
|
||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||
languagesUnderstood = []
|
||||
|
@ -311,12 +311,12 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
|
||||
if not linkedAuthor:
|
||||
blogStr += '<p class="about"><a class="about" href="' + \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
||||
'">' + translate['About the author'] + \
|
||||
'</a></p>\n'
|
||||
|
||||
replies = _noOfBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object['object']['id'])
|
||||
|
||||
# separator between blogs should be centered
|
||||
|
@ -335,11 +335,11 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
blogStr += blogSeparator + '<h1>' + translate['Replies'] + '</h1>\n'
|
||||
if not titleStr:
|
||||
blogStr += _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object['object']['id'])
|
||||
else:
|
||||
blogRepliesStr = _getBlogReplies(base_dir, http_prefix, translate,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object['object']['id'])
|
||||
blogStr += blogRepliesStr.replace('>' + titleStr + '<', '')
|
||||
|
||||
|
@ -348,7 +348,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
|
|||
|
||||
def _htmlBlogPostRSS2(authorized: bool,
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
system_language: str) -> str:
|
||||
|
@ -382,7 +382,7 @@ def _htmlBlogPostRSS2(authorized: bool,
|
|||
|
||||
def _htmlBlogPostRSS3(authorized: bool,
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
handle: str, restrictToDomain: bool,
|
||||
system_language: str) -> str:
|
||||
|
@ -442,7 +442,7 @@ def _getSnippetFromBlogContent(post_json_object: {},
|
|||
|
||||
def htmlBlogPost(session, authorized: bool,
|
||||
base_dir: str, http_prefix: str, translate: {},
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
peertube_instances: [],
|
||||
system_language: str, person_cache: {},
|
||||
|
@ -466,7 +466,7 @@ def htmlBlogPost(session, authorized: bool,
|
|||
url = post_json_object['object']['url']
|
||||
snippet = _getSnippetFromBlogContent(post_json_object, system_language)
|
||||
blogStr = htmlHeaderWithBlogMarkup(cssFilename, instanceTitle,
|
||||
http_prefix, domainFull, nickname,
|
||||
http_prefix, domain_full, nickname,
|
||||
system_language, published, modified,
|
||||
title, snippet, translate, url,
|
||||
content_license_url)
|
||||
|
@ -475,7 +475,7 @@ def htmlBlogPost(session, authorized: bool,
|
|||
blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, post_json_object,
|
||||
domain_full, post_json_object,
|
||||
None, False,
|
||||
peertube_instances, system_language,
|
||||
person_cache)
|
||||
|
@ -484,14 +484,14 @@ def htmlBlogPost(session, authorized: bool,
|
|||
blogStr += '<p class="rssfeed">'
|
||||
|
||||
blogStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + '/rss.xml">'
|
||||
domain_full + '/blog/' + nickname + '/rss.xml">'
|
||||
blogStr += '<img style="width:3%;min-width:50px" ' + \
|
||||
'loading="lazy" alt="RSS 2.0" ' + \
|
||||
'title="RSS 2.0" src="/' + \
|
||||
'icons/logorss.png" /></a>'
|
||||
|
||||
# blogStr += '<a href="' + http_prefix + '://' + \
|
||||
# domainFull + '/blog/' + nickname + '/rss.txt">'
|
||||
# domain_full + '/blog/' + nickname + '/rss.txt">'
|
||||
# blogStr += '<img style="width:3%;min-width:50px" ' + \
|
||||
# 'loading="lazy" alt="RSS 3.0" ' + \
|
||||
# 'title="RSS 3.0" src="/' + \
|
||||
|
@ -536,7 +536,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
if not timelineJson:
|
||||
return blogStr + htmlFooter()
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# show previous and next buttons
|
||||
if pageNumber is not None:
|
||||
|
@ -544,7 +544,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
if pageNumber > 1:
|
||||
# show previous button
|
||||
navigateStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + \
|
||||
domain_full + '/blog/' + \
|
||||
nickname + '?page=' + str(pageNumber-1) + '">' + \
|
||||
'<img loading="lazy" alt="<" title="<" ' + \
|
||||
'src="/icons' + \
|
||||
|
@ -552,7 +552,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
if len(timelineJson['orderedItems']) >= noOfItems:
|
||||
# show next button
|
||||
navigateStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + \
|
||||
domain_full + '/blog/' + nickname + \
|
||||
'?page=' + str(pageNumber + 1) + '">' + \
|
||||
'<img loading="lazy" alt=">" title=">" ' + \
|
||||
'src="/icons' + \
|
||||
|
@ -567,7 +567,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
domain_full, item,
|
||||
None, True,
|
||||
peertube_instances,
|
||||
system_language,
|
||||
|
@ -580,13 +580,13 @@ def htmlBlogPage(authorized: bool, session,
|
|||
blogStr += '<p class="rssfeed">'
|
||||
|
||||
blogStr += '<a href="' + http_prefix + '://' + \
|
||||
domainFull + '/blog/' + nickname + '/rss.xml">'
|
||||
domain_full + '/blog/' + nickname + '/rss.xml">'
|
||||
blogStr += '<img loading="lazy" alt="RSS 2.0" ' + \
|
||||
'title="RSS 2.0" src="/' + \
|
||||
'icons/logorss.png" /></a>'
|
||||
|
||||
# blogStr += '<a href="' + http_prefix + '://' + \
|
||||
# domainFull + '/blog/' + nickname + '/rss.txt">'
|
||||
# domain_full + '/blog/' + nickname + '/rss.txt">'
|
||||
# blogStr += '<img loading="lazy" alt="RSS 3.0" ' + \
|
||||
# 'title="RSS 3.0" src="/' + \
|
||||
# 'icons/rss3.png" /></a>'
|
||||
|
@ -606,11 +606,11 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
'\n' in nickname or '\r' in nickname:
|
||||
return None
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
blogRSS2 = ''
|
||||
if includeHeader:
|
||||
blogRSS2 = rss2Header(http_prefix, nickname, domainFull,
|
||||
blogRSS2 = rss2Header(http_prefix, nickname, domain_full,
|
||||
'Blog', translate)
|
||||
|
||||
blogsIndex = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||
|
@ -641,7 +641,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
|||
_htmlBlogPostRSS2(authorized, base_dir,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
domain_full, item,
|
||||
None, True, system_language)
|
||||
|
||||
if includeHeader:
|
||||
|
@ -661,7 +661,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
|
|||
'\n' in nickname or '\r' in nickname:
|
||||
return None
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
blogRSS3 = ''
|
||||
|
||||
|
@ -687,7 +687,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
|
|||
_htmlBlogPostRSS3(authorized, base_dir,
|
||||
http_prefix, translate,
|
||||
nickname, domain,
|
||||
domainFull, item,
|
||||
domain_full, item,
|
||||
None, True,
|
||||
system_language)
|
||||
|
||||
|
@ -751,7 +751,7 @@ def htmlBlogView(authorized: bool,
|
|||
noOfItems, 1, peertube_instances,
|
||||
system_language, person_cache, debug)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
|
||||
for acct in dirs:
|
||||
|
@ -762,7 +762,7 @@ def htmlBlogView(authorized: bool,
|
|||
if os.path.isfile(blogsIndex):
|
||||
blogStr += '<p class="blogaccount">'
|
||||
blogStr += '<a href="' + \
|
||||
http_prefix + '://' + domainFull + '/blog/' + \
|
||||
http_prefix + '://' + domain_full + '/blog/' + \
|
||||
acct.split('@')[0] + '">' + acct + '</a>'
|
||||
blogStr += '</p>'
|
||||
break
|
||||
|
@ -917,7 +917,7 @@ def htmlEditBlog(media_instance: bool, translate: {},
|
|||
|
||||
def pathContainsBlogLink(base_dir: str,
|
||||
http_prefix: str, domain: str,
|
||||
domainFull: str, path: str) -> (str, str):
|
||||
domain_full: str, path: str) -> (str, str):
|
||||
"""If the path contains a blog entry then return its filename
|
||||
"""
|
||||
if '/users/' not in path:
|
||||
|
@ -940,7 +940,7 @@ def pathContainsBlogLink(base_dir: str,
|
|||
return None, None
|
||||
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
||||
return None, None
|
||||
messageId = localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
messageId = localActorUrl(http_prefix, nickname, domain_full) + \
|
||||
'/statuses/' + userEnding2[1]
|
||||
return locatePost(base_dir, nickname, domain, messageId), nickname
|
||||
|
||||
|
|
24
bookmarks.py
24
bookmarks.py
|
@ -383,9 +383,9 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
print('WARN: No session for sendBookmarkViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, fromPort)
|
||||
domain_full = getFullDomain(domain, fromPort)
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -400,7 +400,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
"target": actor + "/tlbookmarks"
|
||||
}
|
||||
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domain_full + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
|
@ -446,7 +446,7 @@ def sendBookmarkViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
postResult = postJson(http_prefix, domain_full,
|
||||
session, newBookmarkJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -473,9 +473,9 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
print('WARN: No session for sendUndoBookmarkViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, fromPort)
|
||||
domain_full = getFullDomain(domain, fromPort)
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
newBookmarkJson = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -490,7 +490,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
"target": actor + "/tlbookmarks"
|
||||
}
|
||||
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domain_full + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session, handle, http_prefix,
|
||||
|
@ -536,7 +536,7 @@ def sendUndoBookmarkViaServer(base_dir: str, session,
|
|||
'Content-type': 'application/json',
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult = postJson(http_prefix, domainFull,
|
||||
postResult = postJson(http_prefix, domain_full,
|
||||
session, newBookmarkJson, [], inboxUrl,
|
||||
headers, 3, True)
|
||||
if not postResult:
|
||||
|
@ -572,8 +572,8 @@ def outboxBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: bookmark Add target is not string')
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if not message_json['target'].endswith('://' + domainFull +
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if not message_json['target'].endswith('://' + domain_full +
|
||||
'/users/' + nickname +
|
||||
'/tlbookmarks'):
|
||||
if debug:
|
||||
|
@ -628,8 +628,8 @@ def outboxUndoBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: unbookmark Remove target is not string')
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if not message_json['target'].endswith('://' + domainFull +
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if not message_json['target'].endswith('://' + domain_full +
|
||||
'/users/' + nickname +
|
||||
'/tlbookmarks'):
|
||||
if debug:
|
||||
|
|
6
cache.py
6
cache.py
|
@ -33,7 +33,7 @@ def _removePersonFromCache(base_dir: str, personUrl: str,
|
|||
|
||||
|
||||
def checkForChangedActor(session, base_dir: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
personUrl: str, avatarUrl: str, person_cache: {},
|
||||
timeoutSec: int):
|
||||
"""Checks if the avatar url exists and if not then
|
||||
|
@ -43,9 +43,9 @@ def checkForChangedActor(session, base_dir: str,
|
|||
"""
|
||||
if not session or not avatarUrl:
|
||||
return
|
||||
if domainFull in avatarUrl:
|
||||
if domain_full in avatarUrl:
|
||||
return
|
||||
if urlExists(session, avatarUrl, timeoutSec, http_prefix, domainFull):
|
||||
if urlExists(session, avatarUrl, timeoutSec, http_prefix, domain_full):
|
||||
return
|
||||
_removePersonFromCache(base_dir, personUrl, person_cache)
|
||||
|
||||
|
|
|
@ -670,7 +670,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
system_language: str,
|
||||
screenreader: str, espeak,
|
||||
translate: {}, yourActor: str,
|
||||
domainFull: str, person_cache: {},
|
||||
domain_full: str, person_cache: {},
|
||||
signing_priv_key_pem: str,
|
||||
blockedCache: {}) -> {}:
|
||||
"""Reads a post from the given timeline
|
||||
|
@ -711,7 +711,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
|
|||
allow_local_network_access,
|
||||
recentPostsCache, False,
|
||||
system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
if post_json_object2:
|
||||
|
@ -1408,8 +1408,8 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
_sayCommand(sayStr, sayStr, screenreader,
|
||||
system_language, espeak)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
yourActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
yourActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
actorJson = None
|
||||
|
||||
notifyJson = {
|
||||
|
@ -1643,7 +1643,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
pageNumber, postIndex, boxJson,
|
||||
system_language, screenreader,
|
||||
espeak, translate, yourActor,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
print('')
|
||||
|
@ -2415,7 +2415,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
allow_local_network_access,
|
||||
recentPostsCache, False,
|
||||
system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
if post_json_object2:
|
||||
|
|
|
@ -140,13 +140,13 @@ def E2EEaddDevice(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def E2EEdevicesCollection(base_dir: str, nickname: str, domain: str,
|
||||
domainFull: str, http_prefix: str) -> {}:
|
||||
domain_full: str, http_prefix: str) -> {}:
|
||||
"""Returns a list of registered devices
|
||||
"""
|
||||
personDir = acctDir(base_dir, nickname, domain)
|
||||
if not os.path.isdir(personDir):
|
||||
return {}
|
||||
personId = localActorUrl(http_prefix, nickname, domainFull)
|
||||
personId = localActorUrl(http_prefix, nickname, domain_full)
|
||||
if not os.path.isdir(personDir + '/devices'):
|
||||
os.mkdir(personDir + '/devices')
|
||||
deviceList = []
|
||||
|
|
14
epicyon.py
14
epicyon.py
|
@ -2980,19 +2980,19 @@ if args.testdata:
|
|||
testEventDate, testEventTime, testLocation,
|
||||
testIsArticle, args.language, conversationId,
|
||||
low_bandwidth, args.content_license_url)
|
||||
domainFull = domain + ':' + str(port)
|
||||
domain_full = domain + ':' + str(port)
|
||||
clearFollows(base_dir, nickname, domain)
|
||||
followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
|
||||
followPerson(base_dir, nickname, domain, 'maxboardroom', domain_full,
|
||||
federation_list, False, False)
|
||||
followPerson(base_dir, nickname, domain, 'ultrapancake', domainFull,
|
||||
followPerson(base_dir, nickname, domain, 'ultrapancake', domain_full,
|
||||
federation_list, False, False)
|
||||
followPerson(base_dir, nickname, domain, 'sausagedog', domainFull,
|
||||
followPerson(base_dir, nickname, domain, 'sausagedog', domain_full,
|
||||
federation_list, False, False)
|
||||
followPerson(base_dir, nickname, domain, 'drokk', domainFull,
|
||||
followPerson(base_dir, nickname, domain, 'drokk', domain_full,
|
||||
federation_list, False, False)
|
||||
followerOfPerson(base_dir, nickname, domain, 'drokk', domainFull,
|
||||
followerOfPerson(base_dir, nickname, domain, 'drokk', domain_full,
|
||||
federation_list, False, False)
|
||||
followerOfPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
|
||||
followerOfPerson(base_dir, nickname, domain, 'maxboardroom', domain_full,
|
||||
federation_list, False, False)
|
||||
setConfigParam(base_dir, 'admin', nickname)
|
||||
|
||||
|
|
4
feeds.py
4
feeds.py
|
@ -8,13 +8,13 @@ __status__ = "Production"
|
|||
__module_group__ = "RSS Feeds"
|
||||
|
||||
|
||||
def rss2TagHeader(hashtag: str, http_prefix: str, domainFull: str) -> str:
|
||||
def rss2TagHeader(hashtag: str, http_prefix: str, domain_full: str) -> str:
|
||||
return \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + \
|
||||
"<rss version=\"2.0\">" + \
|
||||
'<channel>' + \
|
||||
' <title>#' + hashtag + '</title>' + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
' <link>' + http_prefix + '://' + domain_full + \
|
||||
'/tags/rss2/' + hashtag + '</link>'
|
||||
|
||||
|
||||
|
|
24
follow.py
24
follow.py
|
@ -632,7 +632,7 @@ def storeFollowRequest(base_dir: str,
|
|||
if not os.path.isdir(accountsDir):
|
||||
return False
|
||||
|
||||
domainFull = getFullDomain(domain, fromPort)
|
||||
domain_full = getFullDomain(domain, fromPort)
|
||||
approveHandle = getFullDomain(nickname + '@' + domain, fromPort)
|
||||
|
||||
if group_account:
|
||||
|
@ -654,7 +654,7 @@ def storeFollowRequest(base_dir: str,
|
|||
else:
|
||||
usersPaths = getUserPaths()
|
||||
for possibleUsersPath in usersPaths:
|
||||
url = '://' + domainFull + possibleUsersPath + nickname
|
||||
url = '://' + domain_full + possibleUsersPath + nickname
|
||||
if url in followersStr:
|
||||
alreadyFollowing = True
|
||||
break
|
||||
|
@ -1137,8 +1137,8 @@ def getFollowingViaServer(base_dir: str, session,
|
|||
print('WARN: No session for getFollowingViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1178,8 +1178,8 @@ def getFollowersViaServer(base_dir: str, session,
|
|||
print('WARN: No session for getFollowersViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
followActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1219,9 +1219,9 @@ def getFollowRequestsViaServer(base_dir: str, session,
|
|||
print('WARN: No session for getFollowRequestsViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
followActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
followActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
headers = {
|
||||
|
@ -1262,8 +1262,8 @@ def approveFollowRequestViaServer(base_dir: str, session,
|
|||
print('WARN: No session for approveFollowRequestViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
@ -1303,8 +1303,8 @@ def denyFollowRequestViaServer(base_dir: str, session,
|
|||
print('WARN: No session for denyFollowRequestViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
|
64
inbox.py
64
inbox.py
|
@ -155,7 +155,7 @@ def _storeLastPostId(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
translate: {}) -> bool:
|
||||
"""Updates the hashtag swarm stored as a file
|
||||
"""
|
||||
|
@ -186,7 +186,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
|||
else:
|
||||
print('WARN: no modified date for ' + str(lastModified))
|
||||
if saveSwarm:
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
newSwarmStr = htmlHashTagSwarm(base_dir, actor, translate)
|
||||
if newSwarmStr:
|
||||
try:
|
||||
|
@ -200,7 +200,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def storeHashTags(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
post_json_object: {}, translate: {}) -> None:
|
||||
"""Extracts hashtags from an incoming post and updates the
|
||||
relevant tags files.
|
||||
|
@ -275,7 +275,7 @@ def storeHashTags(base_dir: str, nickname: str, domain: str,
|
|||
# ready for later display
|
||||
if hashtagsCtr > 0:
|
||||
_updateCachedHashtagSwarm(base_dir, nickname, domain,
|
||||
http_prefix, domainFull, translate)
|
||||
http_prefix, domain_full, translate)
|
||||
|
||||
|
||||
def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
|
||||
|
@ -834,7 +834,7 @@ def _personReceiveUpdate(base_dir: str,
|
|||
if debug:
|
||||
print('Receiving actor update for ' + personJson['url'] +
|
||||
' ' + str(personJson))
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
updateDomainFull = getFullDomain(updateDomain, updatePort)
|
||||
usersPaths = getUserPaths()
|
||||
usersStrFound = False
|
||||
|
@ -849,7 +849,7 @@ def _personReceiveUpdate(base_dir: str,
|
|||
print('id: ' + personJson['id'])
|
||||
print('DEBUG: Actor does not match id')
|
||||
return False
|
||||
if updateDomainFull == domainFull:
|
||||
if updateDomainFull == domain_full:
|
||||
if debug:
|
||||
print('DEBUG: You can only receive actor updates ' +
|
||||
'for domains other than your own')
|
||||
|
@ -1536,9 +1536,9 @@ def _receiveBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: inbox bookmark Add target is not string')
|
||||
return False
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
nickname = handle.split('@')[0]
|
||||
if not message_json['actor'].endswith(domainFull + '/users/' + nickname):
|
||||
if not message_json['actor'].endswith(domain_full + '/users/' + nickname):
|
||||
if debug:
|
||||
print('DEBUG: inbox bookmark Add unexpected actor')
|
||||
return False
|
||||
|
@ -1648,9 +1648,9 @@ def _receiveUndoBookmark(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: inbox Remove bookmark target is not string')
|
||||
return False
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
nickname = handle.split('@')[0]
|
||||
if not message_json['actor'].endswith(domainFull + '/users/' + nickname):
|
||||
if not message_json['actor'].endswith(domain_full + '/users/' + nickname):
|
||||
if debug:
|
||||
print('DEBUG: inbox undo bookmark Remove unexpected actor')
|
||||
return False
|
||||
|
@ -1741,8 +1741,8 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
print('DEBUG: Delete activity arrived')
|
||||
if not hasObjectString(message_json, debug):
|
||||
return False
|
||||
domainFull = getFullDomain(domain, port)
|
||||
deletePrefix = http_prefix + '://' + domainFull + '/'
|
||||
domain_full = getFullDomain(domain, port)
|
||||
deletePrefix = http_prefix + '://' + domain_full + '/'
|
||||
if (not allow_deletion and
|
||||
(not message_json['object'].startswith(deletePrefix) or
|
||||
not message_json['actor'].startswith(deletePrefix))):
|
||||
|
@ -1788,7 +1788,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
|||
print('DEBUG: post deleted - ' + postFilename)
|
||||
|
||||
# also delete any local blogs saved to the news actor
|
||||
if handleNickname != 'news' and handleDomain == domainFull:
|
||||
if handleNickname != 'news' and handleDomain == domain_full:
|
||||
postFilename = locatePost(base_dir, 'news',
|
||||
handleDomain, messageId)
|
||||
if postFilename:
|
||||
|
@ -1899,7 +1899,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: Downloading announce post ' + message_json['actor'] +
|
||||
' -> ' + message_json['object'])
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# Generate html. This also downloads the announced post.
|
||||
pageNumber = 1
|
||||
|
@ -1947,7 +1947,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
allow_local_network_access,
|
||||
recentPostsCache, debug,
|
||||
system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
if not post_json_object:
|
||||
|
@ -1969,7 +1969,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
print('DEBUG: Announce post downloaded for ' +
|
||||
message_json['actor'] + ' -> ' + message_json['object'])
|
||||
storeHashTags(base_dir, nickname, domain,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
post_json_object, translate)
|
||||
# Try to obtain the actor for this person
|
||||
# so that their avatar can be shown
|
||||
|
@ -1990,9 +1990,9 @@ def _receiveAnnounce(recentPostsCache: {},
|
|||
|
||||
if isRecentPost(post_json_object, 3):
|
||||
if not os.path.isfile(postFilename + '.tts'):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object, person_cache,
|
||||
translate, lookupActor,
|
||||
theme_name)
|
||||
|
@ -2197,7 +2197,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
message_json: {}, max_mentions: int, max_emoji: int,
|
||||
allow_local_network_access: bool, debug: bool,
|
||||
system_language: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
person_cache: {}) -> bool:
|
||||
"""Is the content of a received post valid?
|
||||
Check for bad html
|
||||
|
@ -2273,7 +2273,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
|||
# check that the post is in a language suitable for this account
|
||||
if not understoodPostLanguage(base_dir, nickname, domain,
|
||||
message_json, system_language,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
person_cache):
|
||||
return False
|
||||
# check for filtered content
|
||||
|
@ -2650,8 +2650,8 @@ def _sendToGroupMembers(session, base_dir: str, handle: str, port: int,
|
|||
return
|
||||
nickname = handle.split('@')[0].replace('!', '')
|
||||
domain = handle.split('@')[1]
|
||||
domainFull = getFullDomain(domain, port)
|
||||
groupActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
groupActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
if groupActor not in post_json_object['to']:
|
||||
return
|
||||
cc = ''
|
||||
|
@ -3422,12 +3422,12 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
|
||||
nickname = handle.split('@')[0]
|
||||
jsonObj = None
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if _validPostContent(base_dir, nickname, domain,
|
||||
post_json_object, max_mentions, max_emoji,
|
||||
allow_local_network_access, debug,
|
||||
system_language, http_prefix,
|
||||
domainFull, person_cache):
|
||||
domain_full, person_cache):
|
||||
# is the sending actor valid?
|
||||
if not validSendingActor(session, base_dir, nickname, domain,
|
||||
person_cache, post_json_object,
|
||||
|
@ -3495,7 +3495,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
return False
|
||||
|
||||
# get the actor being replied to
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
# create a reply notification file if needed
|
||||
isReplyToMutedPost = \
|
||||
|
@ -3512,7 +3512,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
recentPostsCache, debug, system_language,
|
||||
domainFull, person_cache, signing_priv_key_pem):
|
||||
domain_full, person_cache, signing_priv_key_pem):
|
||||
# media index will be updated
|
||||
updateIndexList.append('tlmedia')
|
||||
if isBlogPost(post_json_object):
|
||||
|
@ -3550,9 +3550,9 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
else:
|
||||
if boxname == 'inbox':
|
||||
if isRecentPost(post_json_object, 3):
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object, person_cache,
|
||||
translate, None, theme_name)
|
||||
if not unit_test:
|
||||
|
@ -3610,7 +3610,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
_inboxUpdateCalendar(base_dir, handle, post_json_object)
|
||||
|
||||
storeHashTags(base_dir, handleName, domain,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
post_json_object, translate)
|
||||
|
||||
# send the post out to group members
|
||||
|
@ -3874,7 +3874,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
return False
|
||||
domain, tempPort = getDomainFromActor(message_json['actor'])
|
||||
fromPort = port
|
||||
domainFull = getFullDomain(domain, tempPort)
|
||||
domain_full = getFullDomain(domain, tempPort)
|
||||
if tempPort:
|
||||
fromPort = tempPort
|
||||
if not domainPermitted(domain, federation_list):
|
||||
|
@ -3929,14 +3929,14 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
|
||||
if isFollowerOfPerson(base_dir,
|
||||
nicknameToFollow, domainToFollowFull,
|
||||
nickname, domainFull):
|
||||
nickname, domain_full):
|
||||
if debug:
|
||||
print('DEBUG: ' + nickname + '@' + domain +
|
||||
' is already a follower of ' +
|
||||
nicknameToFollow + '@' + domainToFollow)
|
||||
return True
|
||||
|
||||
approveHandle = nickname + '@' + domainFull
|
||||
approveHandle = nickname + '@' + domain_full
|
||||
|
||||
# is the actor sending the request valid?
|
||||
if not validSendingActor(session, base_dir,
|
||||
|
|
|
@ -91,7 +91,7 @@ def setActorLanguages(base_dir: str, actorJson: {}, languagesStr: str) -> None:
|
|||
|
||||
def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
||||
message_json: {}, system_language: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
person_cache: {}) -> bool:
|
||||
"""Returns true if the post is written in a language
|
||||
understood by this account
|
||||
|
@ -105,7 +105,7 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
if msgObject['contentMap'].get(system_language):
|
||||
return True
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domain_full)
|
||||
actorJson = getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||
if not actorJson:
|
||||
print('WARN: unable to load actor to check languages ' + personUrl)
|
||||
|
|
|
@ -86,7 +86,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
authorized: bool,
|
||||
http_prefix: str,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
domain_full: str,
|
||||
onion_domain: str, i2p_domain: str,
|
||||
translate: {},
|
||||
registration: bool,
|
||||
|
@ -209,10 +209,10 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
instanceTitle = getConfigParam(base_dir, 'instanceTitle')
|
||||
|
||||
if callingDomain.endswith('.onion') and onion_domain:
|
||||
domainFull = onion_domain
|
||||
domain_full = onion_domain
|
||||
http_prefix = 'http'
|
||||
elif (callingDomain.endswith('.i2p') and i2p_domain):
|
||||
domainFull = i2p_domain
|
||||
domain_full = i2p_domain
|
||||
http_prefix = 'http'
|
||||
|
||||
if broch_mode:
|
||||
|
@ -227,7 +227,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
base_dir,
|
||||
adminNickname,
|
||||
domain,
|
||||
domainFull,
|
||||
domain_full,
|
||||
registration,
|
||||
system_language,
|
||||
project_version)
|
||||
|
@ -238,7 +238,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
|
|||
# On a large instance you are somewhat lost in the crowd, but on
|
||||
# small instances a full list of peers would convey a lot of
|
||||
# information about the interests of a small number of accounts
|
||||
sendJson = ['mastodon.social', domainFull]
|
||||
sendJson = ['mastodon.social', domain_full]
|
||||
sendJsonStr = 'masto API peers metadata sent ' + uaStr
|
||||
elif path.startswith('/api/v1/instance/activity'):
|
||||
sendJson = []
|
||||
|
|
12
metadata.py
12
metadata.py
|
@ -86,7 +86,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
instanceDescriptionShort: str,
|
||||
instanceDescription: str,
|
||||
http_prefix: str, base_dir: str,
|
||||
adminNickname: str, domain: str, domainFull: str,
|
||||
adminNickname: str, domain: str, domain_full: str,
|
||||
registration: bool, system_language: str,
|
||||
version: str) -> {}:
|
||||
""" /api/v1/instance endpoint
|
||||
|
@ -128,7 +128,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
isBot = True
|
||||
|
||||
url = \
|
||||
http_prefix + '://' + domainFull + '/@' + \
|
||||
http_prefix + '://' + domain_full + '/@' + \
|
||||
adminActor['preferredUsername']
|
||||
|
||||
if showAccounts:
|
||||
|
@ -170,9 +170,9 @@ def metaDataInstance(showAccounts: bool,
|
|||
'status_count': localPosts,
|
||||
'user_count': activeAccounts
|
||||
},
|
||||
'thumbnail': http_prefix + '://' + domainFull + '/login.png',
|
||||
'thumbnail': http_prefix + '://' + domain_full + '/login.png',
|
||||
'title': instanceTitle,
|
||||
'uri': domainFull,
|
||||
'uri': domain_full,
|
||||
'urls': {},
|
||||
'version': version,
|
||||
'rules': rulesList,
|
||||
|
@ -208,13 +208,13 @@ def metaDataInstance(showAccounts: bool,
|
|||
|
||||
|
||||
def metadataCustomEmoji(base_dir: str,
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domain_full: str) -> {}:
|
||||
"""Returns the custom emoji
|
||||
Endpoint /api/v1/custom_emojis
|
||||
See https://docs.joinmastodon.org/methods/instance/custom_emojis
|
||||
"""
|
||||
result = []
|
||||
emojisUrl = http_prefix + '://' + domainFull + '/emoji'
|
||||
emojisUrl = http_prefix + '://' + domain_full + '/emoji'
|
||||
for subdir, dirs, files in os.walk(base_dir + '/emoji'):
|
||||
for f in files:
|
||||
if len(f) < 3:
|
||||
|
|
|
@ -285,7 +285,7 @@ def hashtagRuleTree(operators: [],
|
|||
return tree
|
||||
|
||||
|
||||
def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
|
||||
def _hashtagAdd(base_dir: str, http_prefix: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
actionStr: str, hashtags: [], system_language: str,
|
||||
translate: {}) -> None:
|
||||
|
@ -301,7 +301,7 @@ def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
|
|||
if not validHashTag(htId):
|
||||
return
|
||||
|
||||
hashtagUrl = http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
hashtagUrl = http_prefix + "://" + domain_full + "/tags/" + htId
|
||||
newTag = {
|
||||
'href': hashtagUrl,
|
||||
'name': addHashtag,
|
||||
|
@ -333,15 +333,15 @@ def _hashtagAdd(base_dir: str, http_prefix: str, domainFull: str,
|
|||
else:
|
||||
content += hashtagHtml
|
||||
post_json_object['object']['content'] = content
|
||||
domain = domainFull
|
||||
domain = domain_full
|
||||
if ':' in domain:
|
||||
domain = domain.split(':')[0]
|
||||
storeHashTags(base_dir, 'news', domain,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
post_json_object, translate)
|
||||
|
||||
|
||||
def _hashtagRemove(http_prefix: str, domainFull: str, post_json_object: {},
|
||||
def _hashtagRemove(http_prefix: str, domain_full: str, post_json_object: {},
|
||||
actionStr: str, hashtags: [], system_language: str) -> None:
|
||||
"""Removes a hashtag via a hashtag rule
|
||||
"""
|
||||
|
@ -352,7 +352,7 @@ def _hashtagRemove(http_prefix: str, domainFull: str, post_json_object: {},
|
|||
if rmHashtag in hashtags:
|
||||
hashtags.remove(rmHashtag)
|
||||
htId = rmHashtag.replace('#', '')
|
||||
hashtagUrl = http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
hashtagUrl = http_prefix + "://" + domain_full + "/tags/" + htId
|
||||
# remove tag html from the post content
|
||||
hashtagHtml = \
|
||||
"<a href=\"" + hashtagUrl + "\" class=\"addedHashtag\" " + \
|
||||
|
@ -394,7 +394,7 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
|
|||
with open(rulesFilename, 'r') as f:
|
||||
rules = f.readlines()
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# get the full text content of the post
|
||||
content = ''
|
||||
|
@ -425,12 +425,12 @@ def _newswireHashtagProcessing(session, base_dir: str, post_json_object: {},
|
|||
|
||||
if actionStr.startswith('add '):
|
||||
# add a hashtag
|
||||
_hashtagAdd(base_dir, http_prefix, domainFull,
|
||||
_hashtagAdd(base_dir, http_prefix, domain_full,
|
||||
post_json_object, actionStr, hashtags, system_language,
|
||||
translate)
|
||||
elif actionStr.startswith('remove '):
|
||||
# remove a hashtag
|
||||
_hashtagRemove(http_prefix, domainFull, post_json_object,
|
||||
_hashtagRemove(http_prefix, domain_full, post_json_object,
|
||||
actionStr, hashtags, system_language)
|
||||
elif actionStr.startswith('block') or actionStr.startswith('drop'):
|
||||
# Block this item
|
||||
|
@ -671,7 +671,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
|||
blog['object']['content'] = rssDescription
|
||||
blog['object']['contentMap'][system_language] = rssDescription
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
hashtags = item[6]
|
||||
|
||||
|
@ -696,7 +696,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
|||
for tagName in hashtags:
|
||||
htId = tagName.replace('#', '')
|
||||
hashtagUrl = \
|
||||
http_prefix + "://" + domainFull + "/tags/" + htId
|
||||
http_prefix + "://" + domain_full + "/tags/" + htId
|
||||
newTag = {
|
||||
'href': hashtagUrl,
|
||||
'name': tagName,
|
||||
|
@ -726,7 +726,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
|||
newswire[originalDateStr][6].append(tag)
|
||||
|
||||
storeHashTags(base_dir, 'news', domain,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
blog, translate)
|
||||
|
||||
clearFromPostCaches(base_dir, recentPostsCache, postId)
|
||||
|
|
18
newswire.py
18
newswire.py
|
@ -50,7 +50,7 @@ def _removeCDATA(text: str) -> str:
|
|||
|
||||
|
||||
def rss2Header(http_prefix: str,
|
||||
nickname: str, domainFull: str,
|
||||
nickname: str, domain_full: str,
|
||||
title: str, translate: {}) -> str:
|
||||
"""Header for an RSS 2.0 feed
|
||||
"""
|
||||
|
@ -62,18 +62,18 @@ def rss2Header(http_prefix: str,
|
|||
if title.startswith('News'):
|
||||
rssStr += \
|
||||
' <title>Newswire</title>' + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
' <link>' + http_prefix + '://' + domain_full + \
|
||||
'/newswire.xml' + '</link>'
|
||||
elif title.startswith('Site'):
|
||||
rssStr += \
|
||||
' <title>' + domainFull + '</title>' + \
|
||||
' <link>' + http_prefix + '://' + domainFull + \
|
||||
' <title>' + domain_full + '</title>' + \
|
||||
' <link>' + http_prefix + '://' + domain_full + \
|
||||
'/blog/rss.xml' + '</link>'
|
||||
else:
|
||||
rssStr += \
|
||||
' <title>' + translate[title] + '</title>' + \
|
||||
' <link>' + \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
||||
'/rss.xml' + '</link>'
|
||||
return rssStr
|
||||
|
||||
|
@ -920,13 +920,13 @@ def getRSS(base_dir: str, domain: str, session, url: str,
|
|||
|
||||
|
||||
def getRSSfromDict(base_dir: str, newswire: {},
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
title: str, translate: {}) -> str:
|
||||
"""Returns an rss feed from the current newswire dict.
|
||||
This allows other instances to subscribe to the same newswire
|
||||
"""
|
||||
rssStr = rss2Header(http_prefix,
|
||||
None, domainFull,
|
||||
None, domain_full,
|
||||
'Newswire', translate)
|
||||
if not newswire:
|
||||
return ''
|
||||
|
@ -950,8 +950,8 @@ def getRSSfromDict(base_dir: str, newswire: {},
|
|||
rssStr += ' <description>' + description + '</description>\n'
|
||||
url = fields[1]
|
||||
if '://' not in url:
|
||||
if domainFull not in url:
|
||||
url = http_prefix + '://' + domainFull + url
|
||||
if domain_full not in url:
|
||||
url = http_prefix + '://' + domain_full + url
|
||||
rssStr += ' <link>' + url + '</link>\n'
|
||||
|
||||
rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT")
|
||||
|
|
14
outbox.py
14
outbox.py
|
@ -100,8 +100,8 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
|||
if debug:
|
||||
print('DEBUG: c2s actor update id is not a string')
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
if len(message_json['to']) != 1:
|
||||
if debug:
|
||||
print('DEBUG: c2s actor update - to does not contain one actor ' +
|
||||
|
@ -180,7 +180,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
|||
def postMessageToOutbox(session, translate: {},
|
||||
message_json: {}, postToNickname: str,
|
||||
server, base_dir: str, http_prefix: str,
|
||||
domain: str, domainFull: str,
|
||||
domain: str, domain_full: str,
|
||||
onion_domain: str, i2p_domain: str, port: int,
|
||||
recentPostsCache: {}, followers_threads: [],
|
||||
federation_list: [], send_threads: [],
|
||||
|
@ -335,7 +335,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
os.rename(uploadMediaFilename, mediaFilename)
|
||||
# change the url of the attachment
|
||||
attach['url'] = \
|
||||
http_prefix + '://' + domainFull + '/' + mediaPath
|
||||
http_prefix + '://' + domain_full + '/' + mediaPath
|
||||
attach['url'] = \
|
||||
attach['url'].replace('/media/',
|
||||
'/system/' +
|
||||
|
@ -374,7 +374,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
savePostToBox(base_dir,
|
||||
http_prefix,
|
||||
postId,
|
||||
postToNickname, domainFull,
|
||||
postToNickname, domain_full,
|
||||
message_json, outboxName)
|
||||
if not savedFilename:
|
||||
print('WARN: post not saved to outbox ' + outboxName)
|
||||
|
@ -413,7 +413,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
if message_json['type'] in indexedActivities:
|
||||
indexes = [outboxName, "inbox"]
|
||||
selfActor = \
|
||||
localActorUrl(http_prefix, postToNickname, domainFull)
|
||||
localActorUrl(http_prefix, postToNickname, domain_full)
|
||||
for boxNameIndex in indexes:
|
||||
if not boxNameIndex:
|
||||
continue
|
||||
|
@ -428,7 +428,7 @@ def postMessageToOutbox(session, translate: {},
|
|||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
recentPostsCache, debug, system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem):
|
||||
inboxUpdateIndex('tlmedia', base_dir,
|
||||
postToNickname + '@' + domain,
|
||||
|
|
10
person.py
10
person.py
|
@ -1114,13 +1114,13 @@ def canRemovePost(base_dir: str, nickname: str,
|
|||
if '/statuses/' not in postId:
|
||||
return False
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# is the post by the admin?
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
if not adminNickname:
|
||||
return False
|
||||
if domainFull + '/users/' + adminNickname + '/' in postId:
|
||||
if domain_full + '/users/' + adminNickname + '/' in postId:
|
||||
return False
|
||||
|
||||
# is the post by a moderator?
|
||||
|
@ -1129,7 +1129,7 @@ def canRemovePost(base_dir: str, nickname: str,
|
|||
with open(moderatorsFile, 'r') as f:
|
||||
lines = f.readlines()
|
||||
for moderator in lines:
|
||||
if domainFull + '/users/' + moderator.strip('\n') + '/' in postId:
|
||||
if domain_full + '/users/' + moderator.strip('\n') + '/' in postId:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -1140,8 +1140,8 @@ def _removeTagsForNickname(base_dir: str, nickname: str,
|
|||
"""
|
||||
if not os.path.isdir(base_dir + '/tags'):
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
matchStr = domainFull + '/users/' + nickname + '/'
|
||||
domain_full = getFullDomain(domain, port)
|
||||
matchStr = domain_full + '/users/' + nickname + '/'
|
||||
directory = os.fsencode(base_dir + '/tags/')
|
||||
for f in os.scandir(directory):
|
||||
f = f.name
|
||||
|
|
12
pgp.py
12
pgp.py
|
@ -480,17 +480,17 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
PGPpubKey = test
|
||||
PGPpubKeyId = None
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if debug:
|
||||
print('PGP test domain: ' + domainFull)
|
||||
print('PGP test domain: ' + domain_full)
|
||||
|
||||
handle = nickname + '@' + domainFull
|
||||
handle = nickname + '@' + domain_full
|
||||
|
||||
if debug:
|
||||
print('Getting actor for ' + handle)
|
||||
|
||||
actorJson, asHeader = \
|
||||
getActorJson(domainFull, handle, False, False, debug, True,
|
||||
getActorJson(domain_full, handle, False, False, debug, True,
|
||||
signing_priv_key_pem, session)
|
||||
if not actorJson:
|
||||
if debug:
|
||||
|
@ -500,7 +500,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
if debug:
|
||||
print('Actor for ' + handle + ' obtained')
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
handle = replaceUsersWithAt(actor)
|
||||
|
||||
# check that this looks like the correct actor
|
||||
|
@ -601,7 +601,7 @@ def pgpPublicKeyUpload(base_dir: str, session,
|
|||
tries = 0
|
||||
while tries < 4:
|
||||
postResult = \
|
||||
postJson(http_prefix, domainFull,
|
||||
postJson(http_prefix, domain_full,
|
||||
session, actorUpdate, [], inboxUrl,
|
||||
headers, 5, quiet)
|
||||
if postResult:
|
||||
|
|
96
posts.py
96
posts.py
|
@ -1151,9 +1151,9 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
|||
content_license_url: str) -> {}:
|
||||
"""Creates a new client-to-server post
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
idStr = \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + \
|
||||
localActorUrl(http_prefix, nickname, domain_full) + \
|
||||
'/statuses/' + statusNumber + '/replies'
|
||||
newPostUrl = \
|
||||
http_prefix + '://' + domain + '/@' + nickname + '/' + statusNumber
|
||||
|
@ -1168,7 +1168,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
|||
'inReplyTo': inReplyTo,
|
||||
'published': published,
|
||||
'url': newPostUrl,
|
||||
'attributedTo': localActorUrl(http_prefix, nickname, domainFull),
|
||||
'attributedTo': localActorUrl(http_prefix, nickname, domain_full),
|
||||
'to': toRecipients,
|
||||
'cc': toCC,
|
||||
'sensitive': sensitive,
|
||||
|
@ -1604,7 +1604,7 @@ def _postIsAddressedToFollowers(base_dir: str,
|
|||
post_json_object: {}) -> bool:
|
||||
"""Returns true if the given post is addressed to followers of the nickname
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
if not post_json_object.get('object'):
|
||||
return False
|
||||
|
@ -1623,7 +1623,7 @@ def _postIsAddressedToFollowers(base_dir: str,
|
|||
ccList = post_json_object['cc']
|
||||
|
||||
followersUrl = \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + '/followers'
|
||||
localActorUrl(http_prefix, nickname, domain_full) + '/followers'
|
||||
|
||||
# does the followers url exist in 'to' or 'cc' lists?
|
||||
addressedToFollowers = False
|
||||
|
@ -1661,13 +1661,13 @@ def undoPinnedPost(base_dir: str, nickname: str, domain: str) -> None:
|
|||
|
||||
def getPinnedPostAsJson(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, system_language: str) -> {}:
|
||||
domain_full: str, system_language: str) -> {}:
|
||||
"""Returns the pinned profile post as json
|
||||
"""
|
||||
accountDir = acctDir(base_dir, nickname, domain)
|
||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||
pinnedPostJson = {}
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
if os.path.isfile(pinnedFilename):
|
||||
pinnedContent = None
|
||||
with open(pinnedFilename, 'r') as pinFile:
|
||||
|
@ -1701,18 +1701,18 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
|
|||
|
||||
def jsonPinPost(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, system_language: str) -> {}:
|
||||
domain_full: str, system_language: str) -> {}:
|
||||
"""Returns a pinned post as json
|
||||
"""
|
||||
pinnedPostJson = \
|
||||
getPinnedPostAsJson(base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
domainFull, system_language)
|
||||
domain_full, system_language)
|
||||
itemsList = []
|
||||
if pinnedPostJson:
|
||||
itemsList = [pinnedPostJson]
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
postContext = getIndividualPostContext()
|
||||
return {
|
||||
'@context': postContext,
|
||||
|
@ -1771,7 +1771,7 @@ def createPublicPost(base_dir: str,
|
|||
content_license_url: str) -> {}:
|
||||
"""Public post
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
isModerationReport = False
|
||||
eventUUID = None
|
||||
category = None
|
||||
|
@ -1783,7 +1783,7 @@ def createPublicPost(base_dir: str,
|
|||
anonymousParticipationEnabled = None
|
||||
eventStatus = None
|
||||
ticketUrl = None
|
||||
localActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
localActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
return _createPostBase(base_dir, nickname, domain, port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
localActor + '/followers',
|
||||
|
@ -1907,8 +1907,8 @@ def createQuestionPost(base_dir: str,
|
|||
content_license_url: str) -> {}:
|
||||
"""Question post with multiple choice options
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
message_json = \
|
||||
_createPostBase(base_dir, nickname, domain, port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
|
@ -1957,8 +1957,8 @@ def createUnlistedPost(base_dir: str,
|
|||
content_license_url: str) -> {}:
|
||||
"""Unlisted post. This has the #Public and followers links inverted.
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
return _createPostBase(base_dir, nickname, domain, port,
|
||||
localActor + '/followers',
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
|
@ -1992,8 +1992,8 @@ def createFollowersOnlyPost(base_dir: str,
|
|||
content_license_url: str) -> {}:
|
||||
"""Followers only post
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
localActor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
return _createPostBase(base_dir, nickname, domain, port,
|
||||
localActor + '/followers',
|
||||
None,
|
||||
|
@ -2109,7 +2109,7 @@ def createReportPost(base_dir: str,
|
|||
content_license_url: str) -> {}:
|
||||
"""Send a report to moderators
|
||||
"""
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# add a title to distinguish moderation reports from other posts
|
||||
reportTitle = 'Moderation Report'
|
||||
|
@ -2135,26 +2135,26 @@ def createReportPost(base_dir: str,
|
|||
if '@' in line:
|
||||
nick = line.split('@')[0]
|
||||
moderatorActor = \
|
||||
localActorUrl(http_prefix, nick, domainFull)
|
||||
localActorUrl(http_prefix, nick, domain_full)
|
||||
if moderatorActor not in moderatorsList:
|
||||
moderatorsList.append(moderatorActor)
|
||||
continue
|
||||
if line.startswith('http') or line.startswith('hyper'):
|
||||
# must be a local address - no remote moderators
|
||||
if '://' + domainFull + '/' in line:
|
||||
if '://' + domain_full + '/' in line:
|
||||
if line not in moderatorsList:
|
||||
moderatorsList.append(line)
|
||||
else:
|
||||
if '/' not in line:
|
||||
moderatorActor = \
|
||||
localActorUrl(http_prefix, line, domainFull)
|
||||
localActorUrl(http_prefix, line, domain_full)
|
||||
if moderatorActor not in moderatorsList:
|
||||
moderatorsList.append(moderatorActor)
|
||||
if len(moderatorsList) == 0:
|
||||
# if there are no moderators then the admin becomes the moderator
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
if adminNickname:
|
||||
localActor = localActorUrl(http_prefix, adminNickname, domainFull)
|
||||
localActor = localActorUrl(http_prefix, adminNickname, domain_full)
|
||||
moderatorsList.append(localActor)
|
||||
if not moderatorsList:
|
||||
return None
|
||||
|
@ -2378,15 +2378,15 @@ def sendPost(signing_priv_key_pem: str, project_version: str,
|
|||
# federation list then send the token for this domain
|
||||
# so that it can request a catalog
|
||||
if toDomain in shared_items_federated_domains:
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if sharedItemFederationTokens.get(domainFull):
|
||||
signatureHeaderJson['Origin'] = domainFull
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if sharedItemFederationTokens.get(domain_full):
|
||||
signatureHeaderJson['Origin'] = domain_full
|
||||
signatureHeaderJson['SharesCatalog'] = \
|
||||
sharedItemFederationTokens[domainFull]
|
||||
sharedItemFederationTokens[domain_full]
|
||||
if debug:
|
||||
print('SharesCatalog added to header')
|
||||
elif debug:
|
||||
print(domainFull + ' not in sharedItemFederationTokens')
|
||||
print(domain_full + ' not in sharedItemFederationTokens')
|
||||
elif debug:
|
||||
print(toDomain + ' not in shared_items_federated_domains ' +
|
||||
str(shared_items_federated_domains))
|
||||
|
@ -2958,18 +2958,18 @@ def _sendToNamedAddresses(session, base_dir: str,
|
|||
continue
|
||||
# Don't send profile/actor updates to yourself
|
||||
if isProfileUpdate:
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
toDomainFull = getFullDomain(toDomain, toPort)
|
||||
if nickname == toNickname and \
|
||||
domainFull == toDomainFull:
|
||||
domain_full == toDomainFull:
|
||||
if debug:
|
||||
print('Not sending profile update to self. ' +
|
||||
nickname + '@' + domainFull)
|
||||
nickname + '@' + domain_full)
|
||||
continue
|
||||
if debug:
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
toDomainFull = getFullDomain(toDomain, toPort)
|
||||
print('DEBUG: Post sending s2s: ' + nickname + '@' + domainFull +
|
||||
print('DEBUG: Post sending s2s: ' + nickname + '@' + domain_full +
|
||||
' to ' + toNickname + '@' + toDomainFull)
|
||||
|
||||
# if we have an alt onion domain and we are sending to
|
||||
|
@ -3142,9 +3142,9 @@ def sendToFollowers(session, base_dir: str,
|
|||
# so that it can request a catalog
|
||||
sharedItemsToken = None
|
||||
if followerDomain in shared_items_federated_domains:
|
||||
domainFull = getFullDomain(domain, port)
|
||||
if sharedItemFederationTokens.get(domainFull):
|
||||
sharedItemsToken = sharedItemFederationTokens[domainFull]
|
||||
domain_full = getFullDomain(domain, port)
|
||||
if sharedItemFederationTokens.get(domain_full):
|
||||
sharedItemsToken = sharedItemFederationTokens[domain_full]
|
||||
|
||||
# check that the follower's domain is active
|
||||
followerDomainUrl = http_prefix + '://' + followerDomain
|
||||
|
@ -3462,7 +3462,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
|
|||
allow_local_network_access: bool,
|
||||
recentPostsCache: {}, debug: bool,
|
||||
system_language: str,
|
||||
domainFull: str, person_cache: {},
|
||||
domain_full: str, person_cache: {},
|
||||
signing_priv_key_pem: str) -> bool:
|
||||
"""Returns true if the given post has attached image media
|
||||
"""
|
||||
|
@ -3477,7 +3477,7 @@ def isImageMedia(session, base_dir: str, http_prefix: str,
|
|||
allow_local_network_access,
|
||||
recentPostsCache, debug,
|
||||
system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
if postJsonAnnounce:
|
||||
|
@ -4086,8 +4086,8 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
|
|||
if nickname.startswith('!'):
|
||||
nickname = nickname[1:]
|
||||
group_account = True
|
||||
domainFull = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domainFull + "/@" + nickname
|
||||
domain_full = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, http_prefix, cached_webfingers,
|
||||
|
@ -4144,8 +4144,8 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
|
|||
cached_webfingers = {}
|
||||
federation_list = []
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domainFull + "/@" + nickname
|
||||
domain_full = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, http_prefix, cached_webfingers,
|
||||
domain, project_version, debug, False,
|
||||
|
@ -4240,8 +4240,8 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
|
|||
cached_webfingers = {}
|
||||
federation_list = []
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domainFull + "/@" + nickname
|
||||
domain_full = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, http_prefix, cached_webfingers,
|
||||
domain, project_version, debug, False,
|
||||
|
@ -4515,7 +4515,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
|||
allow_local_network_access: bool,
|
||||
recentPostsCache: {}, debug: bool,
|
||||
system_language: str,
|
||||
domainFull: str, person_cache: {},
|
||||
domain_full: str, person_cache: {},
|
||||
signing_priv_key_pem: str,
|
||||
blockedCache: {}) -> {}:
|
||||
"""Download the post referenced by an announce
|
||||
|
@ -4664,7 +4664,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
|||
return None
|
||||
if not understoodPostLanguage(base_dir, nickname, domain,
|
||||
announcedJson, system_language,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
person_cache):
|
||||
return None
|
||||
# Check the content of the announce
|
||||
|
@ -5137,8 +5137,8 @@ def c2sBoxJson(base_dir: str, session,
|
|||
print('WARN: No session for c2sBoxJson')
|
||||
return None
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
authHeader = createBasicAuthHeader(nickname, password)
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
|
|||
httpd, base_dir,
|
||||
httpd.http_prefix,
|
||||
httpd.domain,
|
||||
httpd.domainFull,
|
||||
httpd.domain_full,
|
||||
httpd.onion_domain,
|
||||
httpd.i2p_domain,
|
||||
httpd.port,
|
||||
|
|
20
session.py
20
session.py
|
@ -86,7 +86,7 @@ def urlExists(session, url: str, timeoutSec: int = 3,
|
|||
return False
|
||||
|
||||
|
||||
def _getJsonRequest(session, url: str, domainFull: str, sessionHeaders: {},
|
||||
def _getJsonRequest(session, url: str, domain_full: str, sessionHeaders: {},
|
||||
sessionParams: {}, timeoutSec: int,
|
||||
signing_priv_key_pem: str, quiet: bool, debug: bool,
|
||||
returnJson: bool) -> {}:
|
||||
|
@ -136,12 +136,12 @@ def _getJsonRequest(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
return None
|
||||
|
||||
|
||||
def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
||||
def _getJsonSigned(session, url: str, domain_full: str, sessionHeaders: {},
|
||||
sessionParams: {}, timeoutSec: int,
|
||||
signing_priv_key_pem: str, quiet: bool, debug: bool) -> {}:
|
||||
"""Authorized fetch - a signed version of GET
|
||||
"""
|
||||
if not domainFull:
|
||||
if not domain_full:
|
||||
if debug:
|
||||
print('No sending domain for signed GET')
|
||||
return None
|
||||
|
@ -153,11 +153,11 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
if '/' in toDomainFull:
|
||||
toDomainFull = toDomainFull.split('/')[0]
|
||||
|
||||
if ':' in domainFull:
|
||||
domain = domainFull.split(':')[0]
|
||||
port = domainFull.split(':')[1]
|
||||
if ':' in domain_full:
|
||||
domain = domain_full.split(':')[0]
|
||||
port = domain_full.split(':')[1]
|
||||
else:
|
||||
domain = domainFull
|
||||
domain = domain_full
|
||||
if http_prefix == 'https':
|
||||
port = 443
|
||||
else:
|
||||
|
@ -205,7 +205,7 @@ def _getJsonSigned(session, url: str, domainFull: str, sessionHeaders: {},
|
|||
returnJson = True
|
||||
if 'json' not in contentType:
|
||||
returnJson = False
|
||||
return _getJsonRequest(session, url, domainFull, sessionHeaders,
|
||||
return _getJsonRequest(session, url, domain_full, sessionHeaders,
|
||||
sessionParams, timeoutSec, None, quiet,
|
||||
debug, returnJson)
|
||||
|
||||
|
@ -290,7 +290,7 @@ def downloadHtml(signing_priv_key_pem: str,
|
|||
None, quiet, debug, False)
|
||||
|
||||
|
||||
def postJson(http_prefix: str, domainFull: str,
|
||||
def postJson(http_prefix: str, domain_full: str,
|
||||
session, post_json_object: {}, federation_list: [],
|
||||
inboxUrl: str, headers: {}, timeoutSec: int = 60,
|
||||
quiet: bool = False) -> str:
|
||||
|
@ -305,7 +305,7 @@ def postJson(http_prefix: str, domainFull: str,
|
|||
sessionHeaders = headers
|
||||
sessionHeaders['User-Agent'] = 'Epicyon/' + __version__
|
||||
sessionHeaders['User-Agent'] += \
|
||||
'; +' + http_prefix + '://' + domainFull + '/'
|
||||
'; +' + http_prefix + '://' + domain_full + '/'
|
||||
|
||||
try:
|
||||
postResult = \
|
||||
|
|
90
shares.py
90
shares.py
|
@ -48,7 +48,7 @@ from blocking import isBlocked
|
|||
|
||||
def _loadDfcIds(base_dir: str, system_language: str,
|
||||
productType: str,
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domain_full: str) -> {}:
|
||||
"""Loads the product types ontology
|
||||
This is used to add an id to shared items
|
||||
"""
|
||||
|
@ -95,7 +95,7 @@ def _loadDfcIds(base_dir: str, system_language: str,
|
|||
if label['@language'] == system_language:
|
||||
itemId = \
|
||||
item['@id'].replace('http://static.datafoodconsortium.org',
|
||||
http_prefix + '://' + domainFull)
|
||||
http_prefix + '://' + domain_full)
|
||||
dfcIds[label['@value'].lower()] = itemId
|
||||
break
|
||||
return dfcIds
|
||||
|
@ -120,7 +120,7 @@ def _getValidSharedItemID(actor: str, displayName: str) -> str:
|
|||
|
||||
def removeSharedItem(base_dir: str, nickname: str, domain: str,
|
||||
itemID: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
sharesFileType: str) -> None:
|
||||
"""Removes a share for a person
|
||||
"""
|
||||
|
@ -202,7 +202,7 @@ def _dfcProductTypeFromCategory(base_dir: str,
|
|||
def _getshareDfcId(base_dir: str, system_language: str,
|
||||
itemType: str, itemCategory: str,
|
||||
translate: {},
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
dfcIds: {} = None) -> str:
|
||||
"""Attempts to obtain a DFC Id for the shared item,
|
||||
based upon productTypes ontology.
|
||||
|
@ -218,7 +218,7 @@ def _getshareDfcId(base_dir: str, system_language: str,
|
|||
return 'epicyon#' + itemType
|
||||
if not dfcIds:
|
||||
dfcIds = _loadDfcIds(base_dir, system_language, matchedProductType,
|
||||
http_prefix, domainFull)
|
||||
http_prefix, domain_full)
|
||||
if not dfcIds:
|
||||
return ''
|
||||
itemTypeLower = itemType.lower()
|
||||
|
@ -266,7 +266,7 @@ def _getshareTypeFromDfcId(dfcUri: str, dfcIds: {}) -> str:
|
|||
|
||||
def _indicateNewShareAvailable(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, sharesFileType: str) -> None:
|
||||
domain_full: str, sharesFileType: str) -> None:
|
||||
"""Indicate to each account that a new share is available
|
||||
"""
|
||||
for subdir, dirs, files in os.walk(base_dir + '/accounts'):
|
||||
|
@ -287,7 +287,7 @@ def _indicateNewShareAvailable(base_dir: str, http_prefix: str,
|
|||
nickname, domain, None):
|
||||
continue
|
||||
localActor = \
|
||||
localActorUrl(http_prefix, accountNickname, domainFull)
|
||||
localActorUrl(http_prefix, accountNickname, domain_full)
|
||||
try:
|
||||
with open(newShareFile, 'w+') as fp:
|
||||
if sharesFileType == 'shares':
|
||||
|
@ -326,12 +326,12 @@ def addShare(base_dir: str,
|
|||
published = int(time.time())
|
||||
durationSec = _addShareDurationSec(duration, published)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
itemID = _getValidSharedItemID(actor, displayName)
|
||||
dfcId = _getshareDfcId(base_dir, system_language,
|
||||
itemType, itemCategory, translate,
|
||||
http_prefix, domainFull)
|
||||
http_prefix, domain_full)
|
||||
|
||||
# has an image for this share been uploaded?
|
||||
imageUrl = None
|
||||
|
@ -345,7 +345,7 @@ def addShare(base_dir: str,
|
|||
imageFilename = sharesImageFilename + '.' + ext
|
||||
moveImage = True
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# copy or move the image for the shared item to its destination
|
||||
if imageFilename:
|
||||
|
@ -371,7 +371,7 @@ def addShare(base_dir: str,
|
|||
print('EX: addShare unable to delete ' +
|
||||
str(imageFilename))
|
||||
imageUrl = \
|
||||
http_prefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domain_full + \
|
||||
'/sharefiles/' + nickname + '/' + itemID + '.' + ext
|
||||
|
||||
sharesJson[itemID] = {
|
||||
|
@ -392,7 +392,7 @@ def addShare(base_dir: str,
|
|||
saveJson(sharesJson, sharesFilename)
|
||||
|
||||
_indicateNewShareAvailable(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
sharesFileType)
|
||||
|
||||
|
||||
|
@ -1010,8 +1010,8 @@ def getSharedItemsCatalogViaServer(base_dir, session,
|
|||
'Authorization': authHeader,
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
domainFull = getFullDomain(domain, port)
|
||||
url = localActorUrl(http_prefix, nickname, domainFull) + '/catalog'
|
||||
domain_full = getFullDomain(domain, port)
|
||||
url = localActorUrl(http_prefix, nickname, domain_full) + '/catalog'
|
||||
if debug:
|
||||
print('Shared items catalog request to: ' + url)
|
||||
catalogJson = getJson(signing_priv_key_pem, session, url, headers, None,
|
||||
|
@ -1118,10 +1118,10 @@ def outboxUndoShareUpload(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: displayName missing from Offer')
|
||||
return
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
removeSharedItem(base_dir, nickname, domain,
|
||||
message_json['object']['displayName'],
|
||||
http_prefix, domainFull, 'shares')
|
||||
http_prefix, domain_full, 'shares')
|
||||
if debug:
|
||||
print('DEBUG: shared item removed via c2s')
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ def _sharesCatalogParams(path: str) -> (bool, float, float, str):
|
|||
|
||||
def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
domain_full: str,
|
||||
path: str, debug: bool,
|
||||
sharesFileType: str) -> {}:
|
||||
"""Returns the endpoint for the shares catalog of a particular account
|
||||
|
@ -1168,11 +1168,11 @@ def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
|||
"""
|
||||
today, minPrice, maxPrice, matchPattern = _sharesCatalogParams(path)
|
||||
dfcUrl = \
|
||||
http_prefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
http_prefix + '://' + domain_full + '/ontologies/DFC_FullModel.owl#'
|
||||
dfcPtUrl = \
|
||||
http_prefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domain_full + \
|
||||
'/ontologies/DFC_ProductGlossary.rdf#'
|
||||
owner = localActorUrl(http_prefix, nickname, domainFull)
|
||||
owner = localActorUrl(http_prefix, nickname, domain_full)
|
||||
if sharesFileType == 'shares':
|
||||
dfcInstanceId = owner + '/catalog'
|
||||
else:
|
||||
|
@ -1250,7 +1250,7 @@ def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
|||
|
||||
|
||||
def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
||||
domainFull: str,
|
||||
domain_full: str,
|
||||
path: str, sharesFileType: str) -> {}:
|
||||
"""Returns the endpoint for the shares catalog for the instance
|
||||
See https://github.com/datafoodconsortium/ontology
|
||||
|
@ -1258,11 +1258,11 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
|||
"""
|
||||
today, minPrice, maxPrice, matchPattern = _sharesCatalogParams(path)
|
||||
dfcUrl = \
|
||||
http_prefix + '://' + domainFull + '/ontologies/DFC_FullModel.owl#'
|
||||
http_prefix + '://' + domain_full + '/ontologies/DFC_FullModel.owl#'
|
||||
dfcPtUrl = \
|
||||
http_prefix + '://' + domainFull + \
|
||||
http_prefix + '://' + domain_full + \
|
||||
'/ontologies/DFC_ProductGlossary.rdf#'
|
||||
dfcInstanceId = http_prefix + '://' + domainFull + '/catalog'
|
||||
dfcInstanceId = http_prefix + '://' + domain_full + '/catalog'
|
||||
endpoint = {
|
||||
"@context": {
|
||||
"DFC": dfcUrl,
|
||||
|
@ -1283,7 +1283,7 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
|||
continue
|
||||
nickname = acct.split('@')[0]
|
||||
domain = acct.split('@')[1]
|
||||
owner = localActorUrl(http_prefix, nickname, domainFull)
|
||||
owner = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
sharesFilename = \
|
||||
acctDir(base_dir, nickname, domain) + '/' + \
|
||||
|
@ -1339,12 +1339,12 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
|||
|
||||
|
||||
def sharesCatalogCSVEndpoint(base_dir: str, http_prefix: str,
|
||||
domainFull: str,
|
||||
domain_full: str,
|
||||
path: str, sharesFileType: str) -> str:
|
||||
"""Returns a CSV version of the shares catalog
|
||||
"""
|
||||
catalogJson = \
|
||||
sharesCatalogEndpoint(base_dir, http_prefix, domainFull, path,
|
||||
sharesCatalogEndpoint(base_dir, http_prefix, domain_full, path,
|
||||
sharesFileType)
|
||||
if not catalogJson:
|
||||
return ''
|
||||
|
@ -1386,9 +1386,9 @@ def generateSharedItemFederationTokens(shared_items_federated_domains: [],
|
|||
tokensJson = {}
|
||||
|
||||
tokensAdded = False
|
||||
for domainFull in shared_items_federated_domains:
|
||||
if not tokensJson.get(domainFull):
|
||||
tokensJson[domainFull] = ''
|
||||
for domain_full in shared_items_federated_domains:
|
||||
if not tokensJson.get(domain_full):
|
||||
tokensJson[domain_full] = ''
|
||||
tokensAdded = True
|
||||
|
||||
if not tokensAdded:
|
||||
|
@ -1430,7 +1430,7 @@ def updateSharedItemFederationToken(base_dir: str,
|
|||
return tokensJson
|
||||
|
||||
|
||||
def mergeSharedItemTokens(base_dir: str, domainFull: str,
|
||||
def mergeSharedItemTokens(base_dir: str, domain_full: str,
|
||||
newSharedItemsFederatedDomains: [],
|
||||
tokensJson: {}) -> {}:
|
||||
"""When the shared item federation domains list has changed, update
|
||||
|
@ -1439,8 +1439,8 @@ def mergeSharedItemTokens(base_dir: str, domainFull: str,
|
|||
removals = []
|
||||
changed = False
|
||||
for tokenDomainFull, tok in tokensJson.items():
|
||||
if domainFull:
|
||||
if tokenDomainFull.startswith(domainFull):
|
||||
if domain_full:
|
||||
if tokenDomainFull.startswith(domain_full):
|
||||
continue
|
||||
if tokenDomainFull not in newSharedItemsFederatedDomains:
|
||||
removals.append(tokenDomainFull)
|
||||
|
@ -1540,7 +1540,7 @@ def authorizeSharedItems(shared_items_federated_domains: [],
|
|||
|
||||
|
||||
def _updateFederatedSharesCache(session, shared_items_federated_domains: [],
|
||||
base_dir: str, domainFull: str,
|
||||
base_dir: str, domain_full: str,
|
||||
http_prefix: str,
|
||||
tokensJson: {}, debug: bool,
|
||||
system_language: str,
|
||||
|
@ -1562,12 +1562,12 @@ def _updateFederatedSharesCache(session, shared_items_federated_domains: [],
|
|||
|
||||
asHeader = {
|
||||
"Accept": "application/ld+json",
|
||||
"Origin": domainFull
|
||||
"Origin": domain_full
|
||||
}
|
||||
for federatedDomainFull in shared_items_federated_domains:
|
||||
# NOTE: federatedDomain does not have a port extension,
|
||||
# so may not work in some situations
|
||||
if federatedDomainFull.startswith(domainFull):
|
||||
if federatedDomainFull.startswith(domain_full):
|
||||
# only download from instances other than this one
|
||||
continue
|
||||
if not tokensJson.get(federatedDomainFull):
|
||||
|
@ -1591,7 +1591,7 @@ def _updateFederatedSharesCache(session, shared_items_federated_domains: [],
|
|||
print('Downloaded shared items catalog for ' + federatedDomainFull)
|
||||
sharesJson = _dfcToSharesFormat(catalogJson,
|
||||
base_dir, system_language,
|
||||
http_prefix, domainFull)
|
||||
http_prefix, domain_full)
|
||||
if sharesJson:
|
||||
sharesFilename = \
|
||||
catalogsDir + '/' + federatedDomainFull + '.' + \
|
||||
|
@ -1657,7 +1657,7 @@ def _generateNextSharesTokenUpdate(base_dir: str,
|
|||
fp.write(str(nextUpdateSec))
|
||||
|
||||
|
||||
def _regenerateSharesToken(base_dir: str, domainFull: str,
|
||||
def _regenerateSharesToken(base_dir: str, domain_full: str,
|
||||
minDays: int, maxDays: int, httpd) -> None:
|
||||
"""Occasionally the shared items token for your instance is updated.
|
||||
Scenario:
|
||||
|
@ -1688,7 +1688,7 @@ def _regenerateSharesToken(base_dir: str, domainFull: str,
|
|||
currTime = int(time.time())
|
||||
if currTime <= nextUpdateSec:
|
||||
return
|
||||
createSharedItemFederationToken(base_dir, domainFull, True, None)
|
||||
createSharedItemFederationToken(base_dir, domain_full, True, None)
|
||||
_generateNextSharesTokenUpdate(base_dir, minDays, maxDays)
|
||||
# update the tokens used within the daemon
|
||||
shared_fed_domains = httpd.shared_items_federated_domains
|
||||
|
@ -1698,7 +1698,7 @@ def _regenerateSharesToken(base_dir: str, domainFull: str,
|
|||
|
||||
|
||||
def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
|
||||
domainFull: str, proxy_type: str, debug: bool,
|
||||
domain_full: str, proxy_type: str, debug: bool,
|
||||
system_language: str) -> None:
|
||||
"""Runs the daemon used to update federated shared items
|
||||
"""
|
||||
|
@ -1718,7 +1718,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
|
|||
|
||||
# occasionally change the federated shared items token
|
||||
# for this instance
|
||||
_regenerateSharesToken(base_dir, domainFull, minDays, maxDays, httpd)
|
||||
_regenerateSharesToken(base_dir, domain_full, minDays, maxDays, httpd)
|
||||
|
||||
# get a list of the domains within the shared items federation
|
||||
shared_items_federated_domains = []
|
||||
|
@ -1745,7 +1745,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
|
|||
for sharesFileType in getSharesFilesList():
|
||||
_updateFederatedSharesCache(session,
|
||||
shared_items_federated_domains,
|
||||
base_dir, domainFull, http_prefix,
|
||||
base_dir, domain_full, http_prefix,
|
||||
tokensJson, debug, system_language,
|
||||
sharesFileType)
|
||||
time.sleep(secondsPerHour * 6)
|
||||
|
@ -1753,7 +1753,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str,
|
|||
|
||||
def _dfcToSharesFormat(catalogJson: {},
|
||||
base_dir: str, system_language: str,
|
||||
http_prefix: str, domainFull: str) -> {}:
|
||||
http_prefix: str, domain_full: str) -> {}:
|
||||
"""Converts DFC format into the internal formal used to store shared items.
|
||||
This simplifies subsequent search and display
|
||||
"""
|
||||
|
@ -1766,7 +1766,7 @@ def _dfcToSharesFormat(catalogJson: {},
|
|||
for productType in productTypesList:
|
||||
dfcIds[productType] = \
|
||||
_loadDfcIds(base_dir, system_language, productType,
|
||||
http_prefix, domainFull)
|
||||
http_prefix, domain_full)
|
||||
|
||||
currTime = int(time.time())
|
||||
for item in catalogJson['DFC:supplies']:
|
||||
|
|
|
@ -185,9 +185,9 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
print('WARN: No session for sendSkillViaServer')
|
||||
return 6
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
toUrl = actor
|
||||
ccUrl = actor + '/followers'
|
||||
|
||||
|
@ -204,7 +204,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
'cc': [ccUrl]
|
||||
}
|
||||
|
||||
handle = http_prefix + '://' + domainFull + '/@' + nickname
|
||||
handle = http_prefix + '://' + domain_full + '/@' + nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = \
|
||||
|
@ -251,7 +251,7 @@ def sendSkillViaServer(base_dir: str, session, nickname: str, password: str,
|
|||
'Authorization': authHeader
|
||||
}
|
||||
postResult = \
|
||||
postJson(http_prefix, domainFull,
|
||||
postJson(http_prefix, domain_full,
|
||||
session, newSkillJson, [], inboxUrl,
|
||||
headers, 30, True)
|
||||
if not postResult:
|
||||
|
|
|
@ -49,8 +49,8 @@ def instancesGraph(base_dir: str, handles: str,
|
|||
nickname = handle.split('@')[0]
|
||||
domain = handle.split('@')[1]
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domainFull + "/@" + nickname
|
||||
domain_full = getFullDomain(domain, port)
|
||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||
wfRequest = \
|
||||
webfingerHandle(session, handle, http_prefix,
|
||||
cached_webfingers,
|
||||
|
|
20
speaker.py
20
speaker.py
|
@ -196,21 +196,21 @@ def speakerReplaceLinks(sayText: str, translate: {},
|
|||
prevWord = word
|
||||
|
||||
domain = None
|
||||
domainFull = None
|
||||
domain_full = None
|
||||
if 'https://' in word:
|
||||
domain = word.split('https://')[1]
|
||||
domainFull = 'https://' + domain
|
||||
domain_full = 'https://' + domain
|
||||
elif 'http://' in word:
|
||||
domain = word.split('http://')[1]
|
||||
domainFull = 'http://' + domain
|
||||
domain_full = 'http://' + domain
|
||||
if not domain:
|
||||
continue
|
||||
if '/' in domain:
|
||||
domain = domain.split('/')[0]
|
||||
if domain.startswith('www.'):
|
||||
domain = domain.replace('www.', '')
|
||||
replacements[domainFull] = '. ' + linkedStr + ' ' + domain + '.'
|
||||
detectedLinks.append(domainFull)
|
||||
replacements[domain_full] = '. ' + linkedStr + ' ' + domain + '.'
|
||||
detectedLinks.append(domain_full)
|
||||
for replaceStr, newStr in replacements.items():
|
||||
sayText = sayText.replace(replaceStr, newStr)
|
||||
return sayText.replace('..', '.')
|
||||
|
@ -403,7 +403,7 @@ def speakableText(base_dir: str, content: str, translate: {}) -> (str, []):
|
|||
|
||||
|
||||
def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {}, person_cache: {},
|
||||
translate: {}, announcingActor: str,
|
||||
theme_name: str) -> {}:
|
||||
|
@ -454,7 +454,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
|||
img['name'] + '. '
|
||||
|
||||
isDirect = isDM(post_json_object)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
replyToYou = isReply(post_json_object, actor)
|
||||
|
||||
published = ''
|
||||
|
@ -495,7 +495,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
|||
|
||||
followRequestsExist = False
|
||||
followRequestsList = []
|
||||
accountsDir = acctDir(base_dir, nickname, domainFull)
|
||||
accountsDir = acctDir(base_dir, nickname, domain_full)
|
||||
approveFollowsFilename = accountsDir + '/followrequests.txt'
|
||||
if os.path.isfile(approveFollowsFilename):
|
||||
with open(approveFollowsFilename, 'r') as fp:
|
||||
|
@ -535,7 +535,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
|||
|
||||
|
||||
def updateSpeaker(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
post_json_object: {}, person_cache: {},
|
||||
translate: {}, announcingActor: str,
|
||||
theme_name: str) -> None:
|
||||
|
@ -544,7 +544,7 @@ def updateSpeaker(base_dir: str, http_prefix: str,
|
|||
"""
|
||||
speakerJson = \
|
||||
_postToSpeakerJson(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object, person_cache,
|
||||
translate, announcingActor,
|
||||
theme_name)
|
||||
|
|
4
theme.py
4
theme.py
|
@ -778,7 +778,7 @@ def _setThemeImages(base_dir: str, name: str) -> None:
|
|||
|
||||
def setNewsAvatar(base_dir: str, name: str,
|
||||
http_prefix: str,
|
||||
domain: str, domainFull: str) -> None:
|
||||
domain: str, domain_full: str) -> None:
|
||||
"""Sets the avatar for the news account
|
||||
"""
|
||||
nickname = 'news'
|
||||
|
@ -788,7 +788,7 @@ def setNewsAvatar(base_dir: str, name: str,
|
|||
if not os.path.isfile(newFilename):
|
||||
return
|
||||
avatarFilename = \
|
||||
localActorUrl(http_prefix, domainFull, nickname) + '.png'
|
||||
localActorUrl(http_prefix, domain_full, nickname) + '.png'
|
||||
avatarFilename = avatarFilename.replace('/', '-')
|
||||
filename = base_dir + '/cache/avatars/' + avatarFilename
|
||||
|
||||
|
|
10
utils.py
10
utils.py
|
@ -28,10 +28,10 @@ invalidCharacters = (
|
|||
)
|
||||
|
||||
|
||||
def localActorUrl(http_prefix: str, nickname: str, domainFull: str) -> str:
|
||||
def localActorUrl(http_prefix: str, nickname: str, domain_full: str) -> str:
|
||||
"""Returns the url for an actor on this instance
|
||||
"""
|
||||
return http_prefix + '://' + domainFull + '/users/' + nickname
|
||||
return http_prefix + '://' + domain_full + '/users/' + nickname
|
||||
|
||||
|
||||
def getActorLanguagesList(actorJson: {}) -> []:
|
||||
|
@ -2854,16 +2854,16 @@ def hasObjectDict(post_json_object: {}) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
|
||||
def getAltPath(actor: str, domain_full: str, callingDomain: str) -> str:
|
||||
"""Returns alternate path from the actor
|
||||
eg. https://clearnetdomain/path becomes http://oniondomain/path
|
||||
"""
|
||||
postActor = actor
|
||||
if callingDomain not in actor and domainFull in actor:
|
||||
if callingDomain not in actor and domain_full in actor:
|
||||
if callingDomain.endswith('.onion') or \
|
||||
callingDomain.endswith('.i2p'):
|
||||
postActor = \
|
||||
'http://' + callingDomain + actor.split(domainFull)[1]
|
||||
'http://' + callingDomain + actor.split(domain_full)[1]
|
||||
print('Changed POST domain from ' + actor + ' to ' + postActor)
|
||||
return postActor
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
||||
domainFull: str, onion_domain: str, translate: {},
|
||||
domain_full: str, onion_domain: str, translate: {},
|
||||
system_language: str) -> str:
|
||||
"""Show the about screen
|
||||
"""
|
||||
|
@ -44,7 +44,7 @@ def htmlAbout(cssCache: {}, base_dir: str, http_prefix: str,
|
|||
getConfigParam(base_dir, 'instanceTitle')
|
||||
aboutForm = \
|
||||
htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
system_language)
|
||||
aboutForm += '<div class="container">' + aboutText + '</div>'
|
||||
if onion_domain:
|
||||
|
|
|
@ -33,13 +33,13 @@ from webapp_utils import htmlKeyboardNavigation
|
|||
|
||||
def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
||||
path: str, http_prefix: str,
|
||||
domainFull: str, postId: str, postTime: str,
|
||||
domain_full: str, postId: str, postTime: str,
|
||||
year: int, monthNumber: int,
|
||||
dayNumber: int, callingDomain: str) -> str:
|
||||
"""Shows a screen asking to confirm the deletion of a calendar event
|
||||
"""
|
||||
nickname = getNicknameFromActor(path)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
domain, port = getDomainFromActor(actor)
|
||||
messageId = actor + '/statuses/' + postId
|
||||
|
||||
|
@ -68,7 +68,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, base_dir: str,
|
|||
deletePostStr += ' <p class="followText">' + \
|
||||
translate['Delete this event'] + '</p>'
|
||||
|
||||
postActor = getAltPath(actor, domainFull, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
deletePostStr += \
|
||||
' <form method="POST" action="' + postActor + '/rmpost">\n'
|
||||
deletePostStr += ' <input type="hidden" name="year" value="' + \
|
||||
|
@ -245,16 +245,16 @@ def _htmlCalendarDay(person_cache: {}, cssCache: {}, translate: {},
|
|||
|
||||
def htmlCalendar(person_cache: {}, cssCache: {}, translate: {},
|
||||
base_dir: str, path: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
text_mode_banner: str, accessKeys: {}) -> str:
|
||||
"""Show the calendar for a person
|
||||
"""
|
||||
domain = removeDomainPort(domainFull)
|
||||
domain = removeDomainPort(domain_full)
|
||||
|
||||
monthNumber = 0
|
||||
dayNumber = None
|
||||
year = 1970
|
||||
actor = http_prefix + '://' + domainFull + path.replace('/calendar', '')
|
||||
actor = http_prefix + '://' + domain_full + path.replace('/calendar', '')
|
||||
if '?' in actor:
|
||||
first = True
|
||||
for p in actor.split('?'):
|
||||
|
|
|
@ -33,7 +33,7 @@ def _linksExist(base_dir: str) -> bool:
|
|||
|
||||
|
||||
def _getLeftColumnShares(base_dir: str,
|
||||
http_prefix: str, domain: str, domainFull: str,
|
||||
http_prefix: str, domain: str, domain_full: str,
|
||||
nickname: str,
|
||||
maxSharesInLeftColumn: int,
|
||||
translate: {},
|
||||
|
@ -41,7 +41,7 @@ def _getLeftColumnShares(base_dir: str,
|
|||
"""get any shares and turn them into the left column links format
|
||||
"""
|
||||
pageNumber = 1
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
# NOTE: this could potentially be slow if the number of federated
|
||||
# shared items is large
|
||||
sharesJson, lastPage = \
|
||||
|
@ -75,7 +75,7 @@ def _getLeftColumnShares(base_dir: str,
|
|||
|
||||
|
||||
def _getLeftColumnWanted(base_dir: str,
|
||||
http_prefix: str, domain: str, domainFull: str,
|
||||
http_prefix: str, domain: str, domain_full: str,
|
||||
nickname: str,
|
||||
maxSharesInLeftColumn: int,
|
||||
translate: {},
|
||||
|
@ -83,7 +83,7 @@ def _getLeftColumnWanted(base_dir: str,
|
|||
"""get any wanted items and turn them into the left column links format
|
||||
"""
|
||||
pageNumber = 1
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
# NOTE: this could potentially be slow if the number of federated
|
||||
# wanted items is large
|
||||
sharesJson, lastPage = \
|
||||
|
@ -112,7 +112,7 @@ def _getLeftColumnWanted(base_dir: str,
|
|||
return linksList
|
||||
|
||||
|
||||
def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
||||
def getLeftColumnContent(base_dir: str, nickname: str, domain_full: str,
|
||||
http_prefix: str, translate: {},
|
||||
editor: bool, artist: bool,
|
||||
showBackButton: bool, timelinePath: str,
|
||||
|
@ -125,7 +125,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
htmlStr = ''
|
||||
|
||||
separatorStr = htmlPostSeparator(base_dir, 'left')
|
||||
domain = removeDomainPort(domainFull)
|
||||
domain = removeDomainPort(domain_full)
|
||||
|
||||
editImageClass = ''
|
||||
if showHeaderImage:
|
||||
|
@ -177,11 +177,11 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
# RSS icon
|
||||
if nickname != 'news':
|
||||
# rss feed for this account
|
||||
rssUrl = http_prefix + '://' + domainFull + \
|
||||
rssUrl = http_prefix + '://' + domain_full + \
|
||||
'/blog/' + nickname + '/rss.xml'
|
||||
else:
|
||||
# rss feed for all accounts on the instance
|
||||
rssUrl = http_prefix + '://' + domainFull + '/blog/rss.xml'
|
||||
rssUrl = http_prefix + '://' + domain_full + '/blog/rss.xml'
|
||||
if not frontPage:
|
||||
rssTitle = translate['RSS feed for your blog']
|
||||
else:
|
||||
|
@ -218,7 +218,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
maxSharesInLeftColumn = 3
|
||||
sharesList = \
|
||||
_getLeftColumnShares(base_dir,
|
||||
http_prefix, domain, domainFull, nickname,
|
||||
http_prefix, domain, domain_full, nickname,
|
||||
maxSharesInLeftColumn, translate,
|
||||
shared_items_federated_domains)
|
||||
if linksList and sharesList:
|
||||
|
@ -226,7 +226,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
wantedList = \
|
||||
_getLeftColumnWanted(base_dir,
|
||||
http_prefix, domain, domainFull, nickname,
|
||||
http_prefix, domain, domain_full, nickname,
|
||||
maxSharesInLeftColumn, translate,
|
||||
shared_items_federated_domains)
|
||||
if linksList and wantedList:
|
||||
|
@ -349,7 +349,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
|
||||
def htmlLinksMobile(cssCache: {}, base_dir: str,
|
||||
nickname: str, domainFull: str,
|
||||
nickname: str, domain_full: str,
|
||||
http_prefix: str, translate,
|
||||
timelinePath: str, authorized: bool,
|
||||
rss_icon_at_top: bool,
|
||||
|
@ -374,7 +374,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
|
|||
editor = isEditor(base_dir, nickname)
|
||||
artist = isArtist(base_dir, nickname)
|
||||
|
||||
domain = removeDomainPort(domainFull)
|
||||
domain = removeDomainPort(domain_full)
|
||||
|
||||
instanceTitle = \
|
||||
getConfigParam(base_dir, 'instanceTitle')
|
||||
|
@ -394,7 +394,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
|
|||
'links', authorized,
|
||||
icons_as_buttons) + '</center>'
|
||||
htmlStr += \
|
||||
getLeftColumnContent(base_dir, nickname, domainFull,
|
||||
getLeftColumnContent(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
editor, artist,
|
||||
False, timelinePath,
|
||||
|
|
|
@ -47,7 +47,7 @@ def _votesIndicator(totalVotes: int, positive_voting: bool) -> str:
|
|||
return totalVotesStr
|
||||
|
||||
|
||||
def getRightColumnContent(base_dir: str, nickname: str, domainFull: str,
|
||||
def getRightColumnContent(base_dir: str, nickname: str, domain_full: str,
|
||||
http_prefix: str, translate: {},
|
||||
moderator: bool, editor: bool,
|
||||
newswire: {}, positive_voting: bool,
|
||||
|
@ -65,7 +65,7 @@ def getRightColumnContent(base_dir: str, nickname: str, domainFull: str,
|
|||
"""
|
||||
htmlStr = ''
|
||||
|
||||
domain = removeDomainPort(domainFull)
|
||||
domain = removeDomainPort(domain_full)
|
||||
|
||||
if authorized:
|
||||
# only show the publish button if logged in, otherwise replace it with
|
||||
|
@ -445,7 +445,7 @@ def htmlCitations(base_dir: str, nickname: str, domain: str,
|
|||
|
||||
|
||||
def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
|
||||
domain: str, domainFull: str,
|
||||
domain: str, domain_full: str,
|
||||
http_prefix: str, translate: {},
|
||||
newswire: {},
|
||||
positive_voting: bool,
|
||||
|
@ -498,7 +498,7 @@ def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
|
|||
'newswire', authorized,
|
||||
icons_as_buttons) + '</center>'
|
||||
htmlStr += \
|
||||
getRightColumnContent(base_dir, nickname, domainFull,
|
||||
getRightColumnContent(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positive_voting,
|
||||
|
|
|
@ -45,7 +45,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
actor = messageId.split('/statuses/')[0]
|
||||
nickname = getNicknameFromActor(actor)
|
||||
domain, port = getDomainFromActor(actor)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
|
@ -85,7 +85,7 @@ def htmlConfirmDelete(cssCache: {},
|
|||
' <p class="followText">' + \
|
||||
translate['Delete this post?'] + '</p>'
|
||||
|
||||
postActor = getAltPath(actor, domainFull, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
deletePostStr += \
|
||||
' <form method="POST" action="' + postActor + '/rmpost">\n'
|
||||
deletePostStr += \
|
||||
|
@ -114,7 +114,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
|||
"""
|
||||
nickname = getNicknameFromActor(actor)
|
||||
domain, port = getDomainFromActor(actor)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
sharesFile = \
|
||||
acctDir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||
if not os.path.isfile(sharesFile):
|
||||
|
@ -149,7 +149,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
|||
sharesStr += \
|
||||
' <p class="followText">' + translate['Remove'] + \
|
||||
' ' + sharedItemDisplayName + ' ?</p>\n'
|
||||
postActor = getAltPath(actor, domainFull, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
if sharesFileType == 'shares':
|
||||
endpoint = 'rmshare'
|
||||
else:
|
||||
|
|
|
@ -27,7 +27,7 @@ from webapp_post import individualPostAsHtml
|
|||
|
||||
|
||||
def _htmlFollowingDataList(base_dir: str, nickname: str,
|
||||
domain: str, domainFull: str) -> str:
|
||||
domain: str, domain_full: str) -> str:
|
||||
"""Returns a datalist of handles being followed
|
||||
"""
|
||||
listStr = '<datalist id="followingHandles">\n'
|
||||
|
@ -39,7 +39,7 @@ def _htmlFollowingDataList(base_dir: str, nickname: str,
|
|||
msg = followingFile.read()
|
||||
# add your own handle, so that you can send DMs
|
||||
# to yourself as reminders
|
||||
msg += nickname + '@' + domainFull + '\n'
|
||||
msg += nickname + '@' + domain_full + '\n'
|
||||
if msg:
|
||||
# include petnames
|
||||
petnamesFilename = \
|
||||
|
@ -192,7 +192,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
|
|||
reportUrl: str, pageNumber: int,
|
||||
category: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str,
|
||||
domain_full: str,
|
||||
defaultTimeline: str, newswire: {},
|
||||
theme: str, noDropDown: bool,
|
||||
accessKeys: {}, customSubmitText: str,
|
||||
|
@ -812,7 +812,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
|
|||
' <input type="text" name="mentions" ' + \
|
||||
'list="followingHandles" value="' + mentionsStr + '" selected>\n'
|
||||
newPostForm += \
|
||||
_htmlFollowingDataList(base_dir, nickname, domain, domainFull)
|
||||
_htmlFollowingDataList(base_dir, nickname, domain, domain_full)
|
||||
newPostForm += ''
|
||||
selectedStr = ''
|
||||
|
||||
|
|
|
@ -125,9 +125,9 @@ def htmlFrontScreen(signing_priv_key_pem: str,
|
|||
domain, port = getDomainFromActor(profileJson['id'])
|
||||
if not domain:
|
||||
return ""
|
||||
domainFull = domain
|
||||
domain_full = domain
|
||||
if port:
|
||||
domainFull = domain + ':' + str(port)
|
||||
domain_full = domain + ':' + str(port)
|
||||
|
||||
loginButton = headerButtonsFrontScreen(translate, nickname,
|
||||
'features', authorized,
|
||||
|
@ -153,7 +153,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
|
|||
' <tr>\n' + \
|
||||
' <td valign="top" class="col-left">\n'
|
||||
profileHeaderStr += \
|
||||
getLeftColumnContent(base_dir, 'news', domainFull,
|
||||
getLeftColumnContent(base_dir, 'news', domain_full,
|
||||
http_prefix, translate,
|
||||
False, False,
|
||||
False, None, rss_icon_at_top, True,
|
||||
|
@ -193,7 +193,7 @@ def htmlFrontScreen(signing_priv_key_pem: str,
|
|||
profileFooterStr = ' </td>\n'
|
||||
profileFooterStr += ' <td valign="top" class="col-right">\n'
|
||||
profileFooterStr += \
|
||||
getRightColumnContent(base_dir, 'news', domainFull,
|
||||
getRightColumnContent(base_dir, 'news', domain_full,
|
||||
http_prefix, translate,
|
||||
False, False, newswire, False,
|
||||
False, None, False, False,
|
||||
|
|
|
@ -33,7 +33,7 @@ from webapp_utils import htmlKeyboardNavigation
|
|||
|
||||
def htmlPersonOptions(defaultTimeline: str,
|
||||
cssCache: {}, translate: {}, base_dir: str,
|
||||
domain: str, domainFull: str,
|
||||
domain: str, domain_full: str,
|
||||
originPathStr: str,
|
||||
optionsActor: str,
|
||||
optionsProfileUrl: str,
|
||||
|
@ -288,7 +288,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
|
||||
# checkbox for permission to post to newswire
|
||||
newswirePostsPermitted = False
|
||||
if optionsDomainFull == domainFull:
|
||||
if optionsDomainFull == domain_full:
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
if (nickname == adminNickname or
|
||||
(isModerator(base_dir, nickname) and
|
||||
|
@ -329,7 +329,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
optionsStr += checkboxStr
|
||||
|
||||
# checkbox for permission to post to featured articles
|
||||
if news_instance and optionsDomainFull == domainFull:
|
||||
if news_instance and optionsDomainFull == domain_full:
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
if (nickname == adminNickname or
|
||||
(isModerator(base_dir, nickname) and
|
||||
|
|
|
@ -331,7 +331,7 @@ def _getPostFromRecentCache(session,
|
|||
|
||||
|
||||
def _getAvatarImageHtml(showAvatarOptions: bool,
|
||||
nickname: str, domainFull: str,
|
||||
nickname: str, domain_full: str,
|
||||
avatarUrl: str, postActor: str,
|
||||
translate: {}, avatarPosition: str,
|
||||
pageNumber: int, messageIdStr: str) -> str:
|
||||
|
@ -349,7 +349,7 @@ def _getAvatarImageHtml(showAvatarOptions: bool,
|
|||
getBrokenLinkSubstitute() + '/></a>\n'
|
||||
|
||||
if showAvatarOptions and \
|
||||
domainFull + '/users/' + nickname not in postActor:
|
||||
domain_full + '/users/' + nickname not in postActor:
|
||||
showOptionsForThisPersonStr = 'Show options for this person'
|
||||
if translate.get(showOptionsForThisPersonStr):
|
||||
showOptionsForThisPersonStr = \
|
||||
|
@ -460,7 +460,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
|
|||
return replyStr
|
||||
|
||||
|
||||
def _getEditIconHtml(base_dir: str, nickname: str, domainFull: str,
|
||||
def _getEditIconHtml(base_dir: str, nickname: str, domain_full: str,
|
||||
post_json_object: {}, actorNickname: str,
|
||||
translate: {}, isEvent: bool) -> str:
|
||||
"""Returns html for the edit icon/button
|
||||
|
@ -471,9 +471,9 @@ def _getEditIconHtml(base_dir: str, nickname: str, domainFull: str,
|
|||
# or it could be generated from the newswire (see
|
||||
# _addBlogsToNewswire) in which case anyone with
|
||||
# editor status should be able to alter it
|
||||
if (actor.endswith('/' + domainFull + '/users/' + nickname) or
|
||||
if (actor.endswith('/' + domain_full + '/users/' + nickname) or
|
||||
(isEditor(base_dir, nickname) and
|
||||
actor.endswith('/' + domainFull + '/users/news'))):
|
||||
actor.endswith('/' + domain_full + '/users/news'))):
|
||||
|
||||
postId = removeIdEnding(post_json_object['object']['id'])
|
||||
|
||||
|
@ -526,7 +526,7 @@ def _getEditIconHtml(base_dir: str, nickname: str, domainFull: str,
|
|||
|
||||
def _getAnnounceIconHtml(isAnnounced: bool,
|
||||
postActor: str,
|
||||
nickname: str, domainFull: str,
|
||||
nickname: str, domain_full: str,
|
||||
announceJsonObject: {},
|
||||
post_json_object: {},
|
||||
isPublicRepeat: bool,
|
||||
|
@ -559,7 +559,7 @@ def _getAnnounceIconHtml(isAnnounced: bool,
|
|||
unannounceLinkStr = ''
|
||||
|
||||
if announcedByPerson(isAnnounced,
|
||||
postActor, nickname, domainFull):
|
||||
postActor, nickname, domain_full):
|
||||
announceIcon = 'repeat.png'
|
||||
announceEmoji = '🔁 '
|
||||
announceLink = 'unrepeat'
|
||||
|
@ -592,7 +592,7 @@ def _getAnnounceIconHtml(isAnnounced: bool,
|
|||
return announceStr
|
||||
|
||||
|
||||
def _getLikeIconHtml(nickname: str, domainFull: str,
|
||||
def _getLikeIconHtml(nickname: str, domain_full: str,
|
||||
isModerationPost: bool,
|
||||
showLikeButton: bool,
|
||||
post_json_object: {},
|
||||
|
@ -623,7 +623,7 @@ def _getLikeIconHtml(nickname: str, domainFull: str,
|
|||
likeCountStr = ' (' + str(likeCount) + ')'
|
||||
else:
|
||||
likeCountStr = ' (' + str(max_like_count) + '+)'
|
||||
if likedByPerson(post_json_object, nickname, domainFull):
|
||||
if likedByPerson(post_json_object, nickname, domain_full):
|
||||
if likeCount == 1:
|
||||
# liked by the reader only
|
||||
likeCountStr = ''
|
||||
|
@ -660,7 +660,7 @@ def _getLikeIconHtml(nickname: str, domainFull: str,
|
|||
return likeStr
|
||||
|
||||
|
||||
def _getBookmarkIconHtml(nickname: str, domainFull: str,
|
||||
def _getBookmarkIconHtml(nickname: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
isModerationPost: bool,
|
||||
translate: {},
|
||||
|
@ -681,7 +681,7 @@ def _getBookmarkIconHtml(nickname: str, domainFull: str,
|
|||
bookmarkTitle = 'Bookmark this post'
|
||||
if translate.get(bookmarkTitle):
|
||||
bookmarkTitle = translate[bookmarkTitle]
|
||||
if bookmarkedByPerson(post_json_object, nickname, domainFull):
|
||||
if bookmarkedByPerson(post_json_object, nickname, domain_full):
|
||||
bookmarkIcon = 'bookmark.png'
|
||||
bookmarkLink = 'unbookmark'
|
||||
bookmarkEmoji = '🔖 '
|
||||
|
@ -706,7 +706,7 @@ def _getBookmarkIconHtml(nickname: str, domainFull: str,
|
|||
return bookmarkStr
|
||||
|
||||
|
||||
def _getReactionIconHtml(nickname: str, domainFull: str,
|
||||
def _getReactionIconHtml(nickname: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
isModerationPost: bool,
|
||||
showReactionButton: bool,
|
||||
|
@ -746,7 +746,7 @@ def _getReactionIconHtml(nickname: str, domainFull: str,
|
|||
def _getMuteIconHtml(isMuted: bool,
|
||||
postActor: str,
|
||||
messageId: str,
|
||||
nickname: str, domainFull: str,
|
||||
nickname: str, domain_full: str,
|
||||
allow_deletion: bool,
|
||||
pageNumberParam: str,
|
||||
boxName: str,
|
||||
|
@ -756,7 +756,7 @@ def _getMuteIconHtml(isMuted: bool,
|
|||
"""
|
||||
muteStr = ''
|
||||
if (allow_deletion or
|
||||
('/' + domainFull + '/' in postActor and
|
||||
('/' + domain_full + '/' in postActor and
|
||||
messageId.startswith(postActor))):
|
||||
return muteStr
|
||||
|
||||
|
@ -792,7 +792,7 @@ def _getMuteIconHtml(isMuted: bool,
|
|||
return muteStr
|
||||
|
||||
|
||||
def _getDeleteIconHtml(nickname: str, domainFull: str,
|
||||
def _getDeleteIconHtml(nickname: str, domain_full: str,
|
||||
allow_deletion: bool,
|
||||
postActor: str,
|
||||
messageId: str,
|
||||
|
@ -803,7 +803,7 @@ def _getDeleteIconHtml(nickname: str, domainFull: str,
|
|||
"""
|
||||
deleteStr = ''
|
||||
if (allow_deletion or
|
||||
('/' + domainFull + '/' in postActor and
|
||||
('/' + domain_full + '/' in postActor and
|
||||
messageId.startswith(postActor))):
|
||||
if '/users/' + nickname + '/' in messageId:
|
||||
if not isNewsPost(post_json_object):
|
||||
|
@ -1381,7 +1381,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
if messageId:
|
||||
messageIdStr = ';' + messageId
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
pageNumberParam = ''
|
||||
if pageNumber:
|
||||
|
@ -1422,7 +1422,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '5')
|
||||
|
||||
# get the display name
|
||||
if domainFull not in postActor:
|
||||
if domain_full not in postActor:
|
||||
# lookup the correct webfinger for the postActor
|
||||
postActorNickname = getNicknameFromActor(postActor)
|
||||
postActorDomain, postActorPort = getDomainFromActor(postActor)
|
||||
|
@ -1465,7 +1465,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
|
||||
avatarLink = \
|
||||
_getAvatarImageHtml(showAvatarOptions,
|
||||
nickname, domainFull,
|
||||
nickname, domain_full,
|
||||
avatarUrl, postActor,
|
||||
translate, avatarPosition,
|
||||
pageNumber, messageIdStr)
|
||||
|
@ -1504,7 +1504,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
allow_local_network_access,
|
||||
recentPostsCache, False,
|
||||
system_language,
|
||||
domainFull, person_cache,
|
||||
domain_full, person_cache,
|
||||
signing_priv_key_pem,
|
||||
blockedCache)
|
||||
if not postJsonAnnounce:
|
||||
|
@ -1541,14 +1541,14 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
if announceFilename:
|
||||
updateAnnounceCollection(recentPostsCache,
|
||||
base_dir, announceFilename,
|
||||
postActor, nickname, domainFull, False)
|
||||
postActor, nickname, domain_full, False)
|
||||
|
||||
# create a file for use by text-to-speech
|
||||
if isRecentPost(post_json_object, 3):
|
||||
if post_json_object.get('actor'):
|
||||
if not os.path.isfile(announceFilename + '.tts'):
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domainFull,
|
||||
nickname, domain, domain_full,
|
||||
post_json_object, person_cache,
|
||||
translate, post_json_object['actor'],
|
||||
theme_name)
|
||||
|
@ -1644,7 +1644,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
|
||||
_logPostTiming(enableTimingLog, postStartTime, '10')
|
||||
|
||||
editStr = _getEditIconHtml(base_dir, nickname, domainFull,
|
||||
editStr = _getEditIconHtml(base_dir, nickname, domain_full,
|
||||
post_json_object, actorNickname,
|
||||
translate, False)
|
||||
|
||||
|
@ -1653,7 +1653,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
announceStr = \
|
||||
_getAnnounceIconHtml(isAnnounced,
|
||||
postActor,
|
||||
nickname, domainFull,
|
||||
nickname, domain_full,
|
||||
announceJsonObject,
|
||||
post_json_object,
|
||||
isPublicRepeat,
|
||||
|
@ -1683,7 +1683,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
likeJsonObject = post_json_object
|
||||
if announceJsonObject:
|
||||
likeJsonObject = announceJsonObject
|
||||
likeStr = _getLikeIconHtml(nickname, domainFull,
|
||||
likeStr = _getLikeIconHtml(nickname, domain_full,
|
||||
isModerationPost,
|
||||
showLikeButton,
|
||||
likeJsonObject,
|
||||
|
@ -1696,7 +1696,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '12.5')
|
||||
|
||||
bookmarkStr = \
|
||||
_getBookmarkIconHtml(nickname, domainFull,
|
||||
_getBookmarkIconHtml(nickname, domain_full,
|
||||
post_json_object,
|
||||
isModerationPost,
|
||||
translate,
|
||||
|
@ -1708,7 +1708,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
_logPostTiming(enableTimingLog, postStartTime, '12.9')
|
||||
|
||||
reactionStr = \
|
||||
_getReactionIconHtml(nickname, domainFull,
|
||||
_getReactionIconHtml(nickname, domain_full,
|
||||
post_json_object,
|
||||
isModerationPost,
|
||||
showReactionButton,
|
||||
|
@ -1729,7 +1729,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
_getMuteIconHtml(isMuted,
|
||||
postActor,
|
||||
messageId,
|
||||
nickname, domainFull,
|
||||
nickname, domain_full,
|
||||
allow_deletion,
|
||||
pageNumberParam,
|
||||
boxName,
|
||||
|
@ -1737,7 +1737,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
translate)
|
||||
|
||||
deleteStr = \
|
||||
_getDeleteIconHtml(nickname, domainFull,
|
||||
_getDeleteIconHtml(nickname, domain_full,
|
||||
allow_deletion,
|
||||
postActor,
|
||||
messageId,
|
||||
|
@ -1848,8 +1848,8 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
post_json_object['object']['contentMap'][system_language] = \
|
||||
post_json_object['object']['content']
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
personUrl = localActorUrl(http_prefix, nickname, domain_full)
|
||||
actorJson = \
|
||||
getPersonFromCache(base_dir, personUrl, person_cache, False)
|
||||
languagesUnderstood = []
|
||||
|
@ -2033,7 +2033,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
'<p>' + byText + ' <a href="' + byStr + '">@' + \
|
||||
byStrHandle + '</a>' + byTextExtra + '\n'
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = '/users/' + nickname
|
||||
followStr = ' <form method="POST" ' + \
|
||||
'accept-charset="UTF-8" action="' + actor + '/searchhandle">\n'
|
||||
|
@ -2042,7 +2042,7 @@ def htmlIndividualPost(cssCache: {},
|
|||
followStr += \
|
||||
' <input type="hidden" name="searchtext" value="' + \
|
||||
byStrHandle + '">\n'
|
||||
if not isFollowingActor(base_dir, nickname, domainFull, byStr):
|
||||
if not isFollowingActor(base_dir, nickname, domain_full, byStr):
|
||||
translateFollowStr = 'Follow'
|
||||
if translate.get(translateFollowStr):
|
||||
translateFollowStr = translate[translateFollowStr]
|
||||
|
|
|
@ -271,16 +271,16 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
alsoKnownAs, accessKeys,
|
||||
joinedDate)
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
followIsPermitted = True
|
||||
if not profileJson.get('followers'):
|
||||
# no followers collection specified within actor
|
||||
followIsPermitted = False
|
||||
elif searchNickname == 'news' and searchDomainFull == domainFull:
|
||||
elif searchNickname == 'news' and searchDomainFull == domain_full:
|
||||
# currently the news actor is not something you can follow
|
||||
followIsPermitted = False
|
||||
elif searchNickname == nickname and searchDomainFull == domainFull:
|
||||
elif searchNickname == nickname and searchDomainFull == domain_full:
|
||||
# don't follow yourself!
|
||||
followIsPermitted = False
|
||||
|
||||
|
@ -363,7 +363,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
|
||||
def _getProfileHeader(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domainFull: str, translate: {},
|
||||
domain_full: str, translate: {},
|
||||
defaultTimeline: str,
|
||||
displayName: str,
|
||||
avatarDescription: str,
|
||||
|
@ -401,7 +401,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
|||
htmlStr += ' <h1>' + displayName + '</h1>\n' + occupationStr
|
||||
|
||||
htmlStr += \
|
||||
' <p><b>@' + nickname + '@' + domainFull + '</b><br>\n'
|
||||
' <p><b>@' + nickname + '@' + domain_full + '</b><br>\n'
|
||||
if joinedDate:
|
||||
htmlStr += \
|
||||
' <p>' + translate['Joined'] + ' ' + \
|
||||
|
@ -419,7 +419,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str,
|
|||
otherAccountsHtml = \
|
||||
' <p>' + translate['Other accounts'] + ': '
|
||||
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
ctr = 0
|
||||
if isinstance(alsoKnownAs, list):
|
||||
for altActor in alsoKnownAs:
|
||||
|
@ -596,7 +596,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
profileJson['name'], True)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
profileDescription = \
|
||||
addEmojiToDisplayName(session, base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
|
@ -828,10 +828,11 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
|
||||
avatarUrl = profileJson['icon']['url']
|
||||
# use alternate path for local avatars to avoid any caching issues
|
||||
if '://' + domainFull + '/system/accounts/avatars/' in avatarUrl:
|
||||
if '://' + domain_full + '/system/accounts/avatars/' in avatarUrl:
|
||||
avatarUrl = \
|
||||
avatarUrl.replace('://' + domainFull + '/system/accounts/avatars/',
|
||||
'://' + domainFull + '/users/')
|
||||
avatarUrl.replace('://' + domain_full +
|
||||
'/system/accounts/avatars/',
|
||||
'://' + domain_full + '/users/')
|
||||
|
||||
# get pinned post content
|
||||
accountDir = acctDir(base_dir, nickname, domain)
|
||||
|
@ -844,7 +845,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
profileHeaderStr = \
|
||||
_getProfileHeader(base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
domainFull, translate,
|
||||
domain_full, translate,
|
||||
defaultTimeline, displayName,
|
||||
avatarDescription,
|
||||
profileDescriptionShort,
|
||||
|
@ -996,20 +997,20 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
if not isGroup:
|
||||
if selected == 'roles':
|
||||
profileStr += \
|
||||
_htmlProfileRoles(translate, nickname, domainFull,
|
||||
_htmlProfileRoles(translate, nickname, domain_full,
|
||||
extraJson)
|
||||
elif selected == 'skills':
|
||||
profileStr += \
|
||||
_htmlProfileSkills(translate, nickname, domainFull, extraJson)
|
||||
_htmlProfileSkills(translate, nickname, domain_full, extraJson)
|
||||
# elif selected == 'shares':
|
||||
# profileStr += \
|
||||
# _htmlProfileShares(actor, translate,
|
||||
# nickname, domainFull,
|
||||
# nickname, domain_full,
|
||||
# extraJson, 'shares') + licenseStr
|
||||
# elif selected == 'wanted':
|
||||
# profileStr += \
|
||||
# _htmlProfileShares(actor, translate,
|
||||
# nickname, domainFull,
|
||||
# nickname, domain_full,
|
||||
# extraJson, 'wanted') + licenseStr
|
||||
# end of #timeline
|
||||
profileStr += '</div>'
|
||||
|
@ -2053,7 +2054,7 @@ def _htmlEditProfileMain(base_dir: str, displayNickname: str, bioStr: str,
|
|||
|
||||
|
||||
def _htmlEditProfileTopBanner(base_dir: str,
|
||||
nickname: str, domain: str, domainFull: str,
|
||||
nickname: str, domain: str, domain_full: str,
|
||||
defaultTimeline: str, bannerFile: str,
|
||||
path: str, accessKeys: {}, translate: {}) -> str:
|
||||
"""top banner on edit profile screen
|
||||
|
@ -2069,7 +2070,7 @@ def _htmlEditProfileTopBanner(base_dir: str,
|
|||
editProfileForm += ' <div class="vertical-center">\n'
|
||||
editProfileForm += \
|
||||
' <h1>' + translate['Profile for'] + \
|
||||
' ' + nickname + '@' + domainFull + '</h1>'
|
||||
' ' + nickname + '@' + domain_full + '</h1>'
|
||||
editProfileForm += ' <div class="container">\n'
|
||||
editProfileForm += \
|
||||
' <center>\n' + \
|
||||
|
@ -2104,7 +2105,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
nickname = getNicknameFromActor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
||||
if not os.path.isfile(actorFilename):
|
||||
|
@ -2257,7 +2258,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
|||
|
||||
# top banner
|
||||
editProfileForm += \
|
||||
_htmlEditProfileTopBanner(base_dir, nickname, domain, domainFull,
|
||||
_htmlEditProfileTopBanner(base_dir, nickname, domain, domain_full,
|
||||
defaultTimeline, bannerFile,
|
||||
path, accessKeys, translate)
|
||||
|
||||
|
|
|
@ -133,13 +133,13 @@ def _matchSharedItem(searchStrLowerList: [],
|
|||
return False
|
||||
|
||||
|
||||
def _htmlSearchResultSharePage(actor: str, domainFull: str,
|
||||
def _htmlSearchResultSharePage(actor: str, domain_full: str,
|
||||
callingDomain: str, pageNumber: int,
|
||||
searchStrLower: str, translate: {},
|
||||
previous: bool) -> str:
|
||||
"""Returns the html for the previous button on shared items search results
|
||||
"""
|
||||
postActor = getAltPath(actor, domainFull, callingDomain)
|
||||
postActor = getAltPath(actor, domain_full, callingDomain)
|
||||
# previous page link, needs to be a POST
|
||||
if previous:
|
||||
pageNumber -= 1
|
||||
|
@ -172,7 +172,7 @@ def _htmlSearchResultSharePage(actor: str, domainFull: str,
|
|||
def _htmlSharesResult(base_dir: str,
|
||||
sharesJson: {}, pageNumber: int, resultsPerPage: int,
|
||||
searchStrLowerList: [], currPage: int, ctr: int,
|
||||
callingDomain: str, http_prefix: str, domainFull: str,
|
||||
callingDomain: str, http_prefix: str, domain_full: str,
|
||||
contactNickname: str, actor: str,
|
||||
resultsExist: bool, searchStrLower: str, translate: {},
|
||||
sharesFileType: str) -> (bool, int, int, str):
|
||||
|
@ -188,14 +188,14 @@ def _htmlSharesResult(base_dir: str,
|
|||
# show individual search result
|
||||
sharedItemsForm += \
|
||||
htmlSearchResultShare(base_dir, sharedItem, translate,
|
||||
http_prefix, domainFull,
|
||||
http_prefix, domain_full,
|
||||
contactNickname,
|
||||
name, actor, sharesFileType,
|
||||
sharedItem['category'])
|
||||
if not resultsExist and currPage > 1:
|
||||
# show the previous page button
|
||||
sharedItemsForm += \
|
||||
_htmlSearchResultSharePage(actor, domainFull,
|
||||
_htmlSearchResultSharePage(actor, domain_full,
|
||||
callingDomain,
|
||||
pageNumber,
|
||||
searchStrLower,
|
||||
|
@ -207,7 +207,7 @@ def _htmlSharesResult(base_dir: str,
|
|||
if currPage > pageNumber:
|
||||
# show the next page button
|
||||
sharedItemsForm += \
|
||||
_htmlSearchResultSharePage(actor, domainFull,
|
||||
_htmlSearchResultSharePage(actor, domain_full,
|
||||
callingDomain,
|
||||
pageNumber,
|
||||
searchStrLower,
|
||||
|
@ -222,7 +222,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
pageNumber: int,
|
||||
resultsPerPage: int,
|
||||
http_prefix: str,
|
||||
domainFull: str, actor: str,
|
||||
domain_full: str, actor: str,
|
||||
callingDomain: str,
|
||||
shared_items_federated_domains: [],
|
||||
sharesFileType: str) -> str:
|
||||
|
@ -270,7 +270,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, http_prefix,
|
||||
domainFull,
|
||||
domain_full,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
searchStrLower, translate,
|
||||
|
@ -308,7 +308,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
searchStrLowerList,
|
||||
currPage, ctr,
|
||||
callingDomain, http_prefix,
|
||||
domainFull,
|
||||
domain_full,
|
||||
contactNickname,
|
||||
actor, resultsExist,
|
||||
searchStrLower, translate,
|
||||
|
@ -629,8 +629,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, base_dir: str,
|
|||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# add the page title
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
historySearchTitle = '🔍 ' + translate['Your Posts']
|
||||
if boxName == 'bookmarks':
|
||||
historySearchTitle = '🔍 ' + translate['Bookmarks']
|
||||
|
@ -933,11 +933,11 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
|||
if not lines:
|
||||
return None
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
maxFeedLength = 10
|
||||
hashtagFeed = \
|
||||
rss2TagHeader(hashtag, http_prefix, domainFull)
|
||||
rss2TagHeader(hashtag, http_prefix, domain_full)
|
||||
for index in range(len(lines)):
|
||||
postId = lines[index].strip('\n').strip('\r')
|
||||
if ' ' not in postId:
|
||||
|
|
|
@ -357,7 +357,7 @@ def _htmlTimelineKeyboard(moderator: bool, text_mode_banner: str,
|
|||
None, usersPath, translate, followApprovals)
|
||||
|
||||
|
||||
def _htmlTimelineEnd(base_dir: str, nickname: str, domainFull: str,
|
||||
def _htmlTimelineEnd(base_dir: str, nickname: str, domain_full: str,
|
||||
http_prefix: str, translate: {},
|
||||
moderator: bool, editor: bool,
|
||||
newswire: {}, positive_voting: bool,
|
||||
|
@ -376,7 +376,7 @@ def _htmlTimelineEnd(base_dir: str, nickname: str, domainFull: str,
|
|||
tlStr += ' </td>\n'
|
||||
|
||||
# right column
|
||||
rightColumnStr = getRightColumnContent(base_dir, nickname, domainFull,
|
||||
rightColumnStr = getRightColumnContent(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positive_voting,
|
||||
|
@ -741,11 +741,11 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
' <tbody>\n' + \
|
||||
' <tr>\n'
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
|
||||
# left column
|
||||
leftColumnStr = \
|
||||
getLeftColumnContent(base_dir, nickname, domainFull,
|
||||
getLeftColumnContent(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
editor, artist, False, None, rss_icon_at_top,
|
||||
True, False, theme, accessKeys,
|
||||
|
@ -789,7 +789,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
base_dir, actor, nickname, domain, port,
|
||||
maxSharesPerAccount, http_prefix,
|
||||
shared_items_federated_domains, 'shares') +
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
_htmlTimelineEnd(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positive_voting,
|
||||
|
@ -807,7 +807,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
base_dir, actor, nickname, domain, port,
|
||||
maxSharesPerAccount, http_prefix,
|
||||
shared_items_federated_domains, 'wanted') +
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
_htmlTimelineEnd(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positive_voting,
|
||||
|
@ -955,7 +955,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
tlStr += _getHelpForTimeline(base_dir, boxName)
|
||||
|
||||
tlStr += \
|
||||
_htmlTimelineEnd(base_dir, nickname, domainFull,
|
||||
_htmlTimelineEnd(base_dir, nickname, domain_full,
|
||||
http_prefix, translate,
|
||||
moderator, editor,
|
||||
newswire, positive_voting,
|
||||
|
@ -1053,13 +1053,13 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
|||
sharesTimelineJson(actor, pageNumber, itemsPerPage,
|
||||
base_dir, domain, nickname, maxSharesPerAccount,
|
||||
shared_items_federated_domains, sharesFileType)
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
domain_full = getFullDomain(domain, port)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
adminActor = ''
|
||||
if adminNickname:
|
||||
adminActor = \
|
||||
localActorUrl(http_prefix, adminNickname, domainFull)
|
||||
localActorUrl(http_prefix, adminNickname, domain_full)
|
||||
timelineStr = ''
|
||||
|
||||
if pageNumber > 1:
|
||||
|
|
|
@ -17,7 +17,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlTermsOfService(cssCache: {}, base_dir: str,
|
||||
http_prefix: str, domainFull: str) -> str:
|
||||
http_prefix: str, domain_full: str) -> str:
|
||||
"""Show the terms of service screen
|
||||
"""
|
||||
adminNickname = getConfigParam(base_dir, 'admin')
|
||||
|
@ -45,7 +45,7 @@ def htmlTermsOfService(cssCache: {}, base_dir: str,
|
|||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||
if adminNickname:
|
||||
adminActor = localActorUrl(http_prefix, adminNickname, domainFull)
|
||||
adminActor = localActorUrl(http_prefix, adminNickname, domain_full)
|
||||
TOSForm += \
|
||||
'<div class="container"><center>\n' + \
|
||||
'<p class="administeredby">Administered by <a href="' + \
|
||||
|
|
|
@ -652,8 +652,8 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
|||
|
||||
description = removeHtml(actorJson['summary'])
|
||||
nameStr = removeHtml(actorJson['name'])
|
||||
domainFull = actorJson['id'].split('://')[1].split('/')[0]
|
||||
handle = actorJson['preferredUsername'] + '@' + domainFull
|
||||
domain_full = actorJson['id'].split('://')[1].split('/')[0]
|
||||
handle = actorJson['preferredUsername'] + '@' + domain_full
|
||||
|
||||
personMarkup = \
|
||||
' "about": {\n' + \
|
||||
|
@ -696,7 +696,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
|||
"\" name='description'>\n" + \
|
||||
" <meta content=\"" + actorJson['url'] + \
|
||||
"\" property=\"og:url\" />\n" + \
|
||||
" <meta content=\"" + domainFull + \
|
||||
" <meta content=\"" + domain_full + \
|
||||
"\" property=\"og:site_name\" />\n" + \
|
||||
" <meta content=\"" + nameStr + " (@" + handle + \
|
||||
")\" property=\"og:title\" />\n" + \
|
||||
|
@ -1406,7 +1406,7 @@ def editTextArea(label: str, name: str, value: str,
|
|||
|
||||
|
||||
def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
contactNickname: str, itemID: str,
|
||||
actor: str, sharesFileType: str,
|
||||
category: str) -> str:
|
||||
|
@ -1448,7 +1448,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
|||
contactTitleStr = translate['Buy']
|
||||
sharedItemsForm += '</p>\n'
|
||||
contactActor = \
|
||||
localActorUrl(http_prefix, contactNickname, domainFull)
|
||||
localActorUrl(http_prefix, contactNickname, domain_full)
|
||||
buttonStyleStr = 'button'
|
||||
if category == 'accommodation':
|
||||
contactTitleStr = translate['Request to stay']
|
||||
|
@ -1493,7 +1493,7 @@ def htmlSearchResultShare(base_dir: str, sharedItem: {}, translate: {},
|
|||
|
||||
|
||||
def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
itemID: str, translate: {},
|
||||
shared_items_federated_domains: [],
|
||||
defaultTimeline: str, theme: str,
|
||||
|
@ -1507,7 +1507,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
if not contactNickname:
|
||||
return None
|
||||
|
||||
if '://' + domainFull + '/' in shareUrl:
|
||||
if '://' + domain_full + '/' in shareUrl:
|
||||
# shared item on this instance
|
||||
sharesFilename = \
|
||||
acctDir(base_dir, contactNickname, domain) + '/' + \
|
||||
|
@ -1545,7 +1545,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
if not sharesJson.get(itemID):
|
||||
return None
|
||||
sharedItem = sharesJson[itemID]
|
||||
actor = localActorUrl(http_prefix, nickname, domainFull)
|
||||
actor = localActorUrl(http_prefix, nickname, domain_full)
|
||||
|
||||
# filename of the banner shown at the top
|
||||
bannerFile, bannerFilename = \
|
||||
|
@ -1561,7 +1561,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
|||
'</header><br>\n'
|
||||
shareStr += \
|
||||
htmlSearchResultShare(base_dir, sharedItem, translate, http_prefix,
|
||||
domainFull, contactNickname, itemID,
|
||||
domain_full, contactNickname, itemID,
|
||||
actor, sharesFileType, category)
|
||||
|
||||
cssFilename = base_dir + '/epicyon-profile.css'
|
||||
|
|
|
@ -17,7 +17,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlWelcomeFinal(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
language: str, translate: {},
|
||||
theme_name: str) -> str:
|
||||
"""Returns the final welcome screen after first login
|
||||
|
|
|
@ -23,7 +23,7 @@ from markdown import markdownToHtml
|
|||
|
||||
|
||||
def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, domainFull: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
language: str, translate: {},
|
||||
theme_name: str) -> str:
|
||||
"""Returns the welcome profile screen to set avatar and bio
|
||||
|
@ -76,7 +76,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
|||
if os.path.isfile(avatarFilename):
|
||||
break
|
||||
avatarUrl = \
|
||||
localActorUrl(http_prefix, nickname, domainFull) + '/avatar.' + ext
|
||||
localActorUrl(http_prefix, nickname, domain_full) + '/avatar.' + ext
|
||||
|
||||
imageFormats = getImageFormats()
|
||||
profileForm += '<div class="container">' + profileText + '</div>\n'
|
||||
|
|
10
webfinger.py
10
webfinger.py
|
@ -181,13 +181,13 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
|||
return account
|
||||
|
||||
|
||||
def webfingerNodeInfo(http_prefix: str, domainFull: str) -> {}:
|
||||
def webfingerNodeInfo(http_prefix: str, domain_full: str) -> {}:
|
||||
""" /.well-known/nodeinfo endpoint
|
||||
"""
|
||||
nodeinfo = {
|
||||
'links': [
|
||||
{
|
||||
'href': http_prefix + '://' + domainFull + '/nodeinfo/2.0',
|
||||
'href': http_prefix + '://' + domain_full + '/nodeinfo/2.0',
|
||||
'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.0'
|
||||
}
|
||||
]
|
||||
|
@ -195,7 +195,7 @@ def webfingerNodeInfo(http_prefix: str, domainFull: str) -> {}:
|
|||
return nodeinfo
|
||||
|
||||
|
||||
def webfingerMeta(http_prefix: str, domainFull: str) -> str:
|
||||
def webfingerMeta(http_prefix: str, domain_full: str) -> str:
|
||||
"""Return /.well-known/host-meta
|
||||
"""
|
||||
metaStr = \
|
||||
|
@ -203,10 +203,10 @@ def webfingerMeta(http_prefix: str, domainFull: str) -> str:
|
|||
"<XRD xmlns=’http://docs.oasis-open.org/ns/xri/xrd-1.0'" + \
|
||||
" xmlns:hm=’http://host-meta.net/xrd/1.0'>" + \
|
||||
"" + \
|
||||
"<hm:Host>" + domainFull + "</hm:Host>" + \
|
||||
"<hm:Host>" + domain_full + "</hm:Host>" + \
|
||||
"" + \
|
||||
"<Link rel=’lrdd’" + \
|
||||
" template=’" + http_prefix + "://" + domainFull + \
|
||||
" template=’" + http_prefix + "://" + domain_full + \
|
||||
"/describe?uri={uri}'>" + \
|
||||
" <Title>Resource Descriptor</Title>" + \
|
||||
" </Link>" + \
|
||||
|
|
Loading…
Reference in New Issue