From 6abe5d83fe19ce1ee4ecc520b290575ae9689293 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 10:00:46 +0000 Subject: [PATCH] Snake case --- announce.py | 10 +- availability.py | 8 +- blocking.py | 22 +- blog.py | 66 ++-- bookmarks.py | 24 +- cache.py | 6 +- daemon.py | 626 +++++++++++++++++++------------------- desktop_client.py | 12 +- devices.py | 4 +- epicyon.py | 14 +- feeds.py | 4 +- follow.py | 24 +- inbox.py | 64 ++-- languages.py | 4 +- mastoapiv1.py | 10 +- metadata.py | 12 +- newsdaemon.py | 24 +- newswire.py | 18 +- outbox.py | 14 +- person.py | 10 +- pgp.py | 12 +- posts.py | 96 +++--- schedule.py | 2 +- session.py | 20 +- shares.py | 90 +++--- skills.py | 8 +- socnet.py | 4 +- speaker.py | 20 +- theme.py | 4 +- utils.py | 10 +- webapp_about.py | 4 +- webapp_calendar.py | 12 +- webapp_column_left.py | 26 +- webapp_column_right.py | 8 +- webapp_confirm.py | 8 +- webapp_create_post.py | 8 +- webapp_frontscreen.py | 8 +- webapp_person_options.py | 6 +- webapp_post.py | 66 ++-- webapp_profile.py | 39 +-- webapp_search.py | 26 +- webapp_timeline.py | 20 +- webapp_tos.py | 4 +- webapp_utils.py | 18 +- webapp_welcome_final.py | 2 +- webapp_welcome_profile.py | 4 +- webfinger.py | 10 +- 47 files changed, 756 insertions(+), 755 deletions(-) diff --git a/announce.py b/announce.py index d568e19fd..31e3b111e 100644 --- a/announce.py +++ b/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: diff --git a/availability.py b/availability.py index e60a9a66f..562d2824d 100644 --- a/availability.py +++ b/availability.py @@ -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: diff --git a/blocking.py b/blocking.py index 7ddbffb9a..b2ebbb4a8 100644 --- a/blocking.py +++ b/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') diff --git a/blog.py b/blog.py index a747a3324..19ec22782 100644 --- a/blog.py +++ b/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 += ' ' + handle + '' linkedAuthor = True else: @@ -265,7 +265,7 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool, if attachmentStr: blogStr += '
' + attachmentStr + '
' - 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 += '

' + translate['About the author'] + \ '

\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 + '

' + translate['Replies'] + '

\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 += '

' blogStr += '' + domain_full + '/blog/' + nickname + '/rss.xml">' blogStr += 'RSS 2.0' # blogStr += '' + # domain_full + '/blog/' + nickname + '/rss.txt">' # blogStr += 'RSS 3.0' + \ '<' + \ '>' blogStr += '' + domain_full + '/blog/' + nickname + '/rss.xml">' blogStr += 'RSS 2.0' # blogStr += '' + # domain_full + '/blog/' + nickname + '/rss.txt">' # blogStr += 'RSS 3.0' @@ -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 += '

' blogStr += '' + acct + '' blogStr += '

' 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 diff --git a/bookmarks.py b/bookmarks.py index 8780fa79e..d0dc79d34 100644 --- a/bookmarks.py +++ b/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: diff --git a/cache.py b/cache.py index 9fb4530a8..d6b06bba2 100644 --- a/cache.py +++ b/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) diff --git a/daemon.py b/daemon.py index fdcaaf67d..6772f3723 100644 --- a/daemon.py +++ b/daemon.py @@ -391,12 +391,12 @@ sharesPerPage = 12 def save_domain_qrcode(base_dir: str, http_prefix: str, - domainFull: str, scale=6) -> None: + domain_full: str, scale=6) -> None: """Saves a qrcode image for the domain name This helps to transfer onion or i2p domains to a mobile device """ qrcodeFilename = base_dir + '/accounts/qrcode.png' - url = pyqrcode.create(http_prefix + '://' + domainFull) + url = pyqrcode.create(http_prefix + '://' + domain_full) url.png(qrcodeFilename, scale) @@ -444,7 +444,7 @@ class PubServer(BaseHTTPRequestHandler): instanceUrl = 'http://' + self.server.i2p_domain else: instanceUrl = \ - self.server.http_prefix + '://' + self.server.domainFull + self.server.http_prefix + '://' + self.server.domain_full return instanceUrl def _getheaderSignatureInput(self): @@ -532,7 +532,7 @@ class PubServer(BaseHTTPRequestHandler): if post_json_object: populateReplies(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, post_json_object, self.server.max_replies, self.server.debug) @@ -747,7 +747,7 @@ class PubServer(BaseHTTPRequestHandler): # verify the GET request without any digest if verifyPostHeaders(self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, pubKey, self.headers, self.path, True, None, '', self.server.debug): return True @@ -812,7 +812,7 @@ class PubServer(BaseHTTPRequestHandler): self.send_header('Cache-Control', cache_control) else: self.send_header('Cache-Control', 'public') - self.send_header('Origin', self.server.domainFull) + self.send_header('Origin', self.server.domain_full) if length > -1: self.send_header('Content-Length', str(length)) if callingDomain: @@ -1042,7 +1042,7 @@ class PubServer(BaseHTTPRequestHandler): 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, @@ -1069,7 +1069,7 @@ class PubServer(BaseHTTPRequestHandler): http_prefix, base_dir, nickname, domain, - domainFull, + domain_full, onion_domain, i2p_domain, translate, @@ -1106,7 +1106,7 @@ class PubServer(BaseHTTPRequestHandler): uaStr: 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, @@ -1116,7 +1116,7 @@ class PubServer(BaseHTTPRequestHandler): show_node_info_accounts: bool) -> bool: return self._mastoApiV1(path, callingDomain, uaStr, authorized, http_prefix, base_dir, nickname, domain, - domainFull, onion_domain, i2p_domain, + domain_full, onion_domain, i2p_domain, translate, registration, system_language, project_version, customEmoji, show_node_info_accounts) @@ -1190,7 +1190,7 @@ class PubServer(BaseHTTPRequestHandler): else: wfResult = \ webfingerMeta(self.server.http_prefix, - self.server.domainFull) + self.server.domain_full) if wfResult: msg = wfResult.encode('utf-8') msglen = len(msg) @@ -1220,7 +1220,7 @@ class PubServer(BaseHTTPRequestHandler): else: wfResult = \ webfingerNodeInfo(self.server.http_prefix, - self.server.domainFull) + self.server.domain_full) if wfResult: msg = json.dumps(wfResult).encode('utf-8') msglen = len(msg) @@ -1279,7 +1279,7 @@ class PubServer(BaseHTTPRequestHandler): self.server, self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.port, @@ -1535,7 +1535,7 @@ class PubServer(BaseHTTPRequestHandler): savePostToInboxQueue(self.server.base_dir, self.server.http_prefix, nickname, - self.server.domainFull, + self.server.domain_full, message_json, originalMessageJson, messageBytesDecoded, headersDict, @@ -1628,13 +1628,13 @@ class PubServer(BaseHTTPRequestHandler): del self.server.tokens_lookup[self.server.tokens[nickname]] del self.server.tokens[nickname] self._redirect_headers(self.server.http_prefix + '://' + - self.server.domainFull + '/login', + self.server.domain_full + '/login', 'epicyon=; SameSite=Strict', callingDomain) def _loginScreen(self, path: str, callingDomain: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Shows the login screen @@ -1699,7 +1699,7 @@ class PubServer(BaseHTTPRequestHandler): callingDomain) else: self._redirect_headers(http_prefix + '://' + - domainFull + '/login', + domain_full + '/login', cookie, callingDomain) return @@ -1717,7 +1717,7 @@ class PubServer(BaseHTTPRequestHandler): callingDomain) else: self._redirect_headers(http_prefix + '://' + - domainFull + '/login', + domain_full + '/login', cookie, callingDomain) return authHeader = \ @@ -1821,7 +1821,7 @@ class PubServer(BaseHTTPRequestHandler): cookieStr, callingDomain) else: self._redirect_headers(http_prefix + '://' + - domainFull + '/users/' + + domain_full + '/users/' + loginNickname + '/' + self.server.defaultTimeline, cookieStr, callingDomain) @@ -1832,7 +1832,7 @@ class PubServer(BaseHTTPRequestHandler): def _moderatorActions(self, path: str, callingDomain: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Actions on the moderator screen @@ -2041,7 +2041,7 @@ class PubServer(BaseHTTPRequestHandler): def _keyShortcuts(self, path: str, callingDomain: str, cookie: str, base_dir: str, http_prefix: str, nickname: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool, accessKeys: {}, defaultTimeline: str) -> None: @@ -2049,7 +2049,7 @@ class PubServer(BaseHTTPRequestHandler): """ usersPath = '/users/' + nickname originPathStr = \ - http_prefix + '://' + domainFull + usersPath + '/' + \ + http_prefix + '://' + domain_full + usersPath + '/' + \ defaultTimeline length = int(self.headers['Content-length']) @@ -2128,7 +2128,7 @@ class PubServer(BaseHTTPRequestHandler): def _themeDesigner(self, path: str, callingDomain: str, cookie: str, base_dir: str, http_prefix: str, nickname: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool, accessKeys: {}, defaultTimeline: str, theme_name: str, @@ -2138,7 +2138,7 @@ class PubServer(BaseHTTPRequestHandler): """ usersPath = '/users/' + nickname originPathStr = \ - http_prefix + '://' + domainFull + usersPath + '/' + \ + http_prefix + '://' + domain_full + usersPath + '/' + \ defaultTimeline length = int(self.headers['Content-length']) @@ -2263,14 +2263,14 @@ class PubServer(BaseHTTPRequestHandler): def _personOptions(self, path: str, callingDomain: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Receive POST from person options screen """ pageNumber = 1 usersPath = path.split('/personoptions')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath chooserNickname = getNicknameFromActor(originPathStr) if not chooserNickname: @@ -2620,7 +2620,7 @@ class PubServer(BaseHTTPRequestHandler): optionsNickname, optionsDomainFull): # send block activity self._sendBlock(http_prefix, - chooserNickname, domainFull, + chooserNickname, domain_full, optionsNickname, optionsDomainFull) # person options screen, unblock button @@ -2707,7 +2707,7 @@ class PubServer(BaseHTTPRequestHandler): pageNumber, '', chooserNickname, domain, - domainFull, + domain_full, self.server.defaultTimeline, self.server.newswire, self.server.theme_name, @@ -2773,7 +2773,7 @@ class PubServer(BaseHTTPRequestHandler): # See htmlPersonOptions if '&submitSnooze=' in optionsConfirmParams: usersPath = path.split('/personoptions')[0] - thisActor = http_prefix + '://' + domainFull + usersPath + thisActor = http_prefix + '://' + domain_full + usersPath if debug: print('Snoozing ' + optionsActor + ' ' + thisActor) if '/users/' in thisActor: @@ -2796,7 +2796,7 @@ class PubServer(BaseHTTPRequestHandler): # See htmlPersonOptions if '&submitUnSnooze=' in optionsConfirmParams: usersPath = path.split('/personoptions')[0] - thisActor = http_prefix + '://' + domainFull + usersPath + thisActor = http_prefix + '://' + domain_full + usersPath if debug: print('Unsnoozing ' + optionsActor + ' ' + thisActor) if '/users/' in thisActor: @@ -2841,7 +2841,7 @@ class PubServer(BaseHTTPRequestHandler): None, postUrl, pageNumber, '', chooserNickname, domain, - domainFull, + domain_full, self.server.defaultTimeline, self.server.newswire, self.server.theme_name, @@ -2886,13 +2886,13 @@ class PubServer(BaseHTTPRequestHandler): def _unfollowConfirm(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Confirm to unfollow """ usersPath = path.split('/unfollowconfirm')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath followerNickname = getNicknameFromActor(originPathStr) length = int(self.headers['Content-length']) @@ -2937,7 +2937,7 @@ class PubServer(BaseHTTPRequestHandler): print(followerNickname + ' stops following ' + followingActor) followActor = \ - localActorUrl(http_prefix, followerNickname, domainFull) + localActorUrl(http_prefix, followerNickname, domain_full) statusNumber, published = getStatusNumber() followId = followActor + '/statuses/' + str(statusNumber) unfollowJson = { @@ -2973,13 +2973,13 @@ class PubServer(BaseHTTPRequestHandler): def _followConfirm(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Confirm to follow """ usersPath = path.split('/followconfirm')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath followerNickname = getNicknameFromActor(originPathStr) length = int(self.headers['Content-length']) @@ -3063,13 +3063,13 @@ class PubServer(BaseHTTPRequestHandler): def _blockConfirm(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Confirms a block """ usersPath = path.split('/blockconfirm')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath blockerNickname = getNicknameFromActor(originPathStr) if not blockerNickname: if callingDomain.endswith('.onion') and onion_domain: @@ -3138,7 +3138,7 @@ class PubServer(BaseHTTPRequestHandler): blockingDomainFull): # send block activity self._sendBlock(http_prefix, - blockerNickname, domainFull, + blockerNickname, domain_full, blockingNickname, blockingDomainFull) if callingDomain.endswith('.onion') and onion_domain: originPathStr = 'http://' + onion_domain + usersPath @@ -3150,13 +3150,13 @@ class PubServer(BaseHTTPRequestHandler): def _unblockConfirm(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Confirms a unblock """ usersPath = path.split('/unblockconfirm')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath blockerNickname = getNicknameFromActor(originPathStr) if not blockerNickname: if callingDomain.endswith('.onion') and onion_domain: @@ -3234,7 +3234,7 @@ class PubServer(BaseHTTPRequestHandler): def _receiveSearchQuery(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, port: int, searchForEmoji: bool, onion_domain: str, i2p_domain: str, GETstartTime, GETtimings: {}, @@ -3531,7 +3531,7 @@ class PubServer(BaseHTTPRequestHandler): self._showPersonOptions(callingDomain, profilePathStr, base_dir, http_prefix, - domain, domainFull, + domain, domain_full, GETstartTime, onion_domain, i2p_domain, cookie, debug, authorized) @@ -3627,7 +3627,7 @@ class PubServer(BaseHTTPRequestHandler): searchStr[1:], pageNumber, maxPostsInFeed, http_prefix, - domainFull, + domain_full, actorStr, callingDomain, shared_items_federated_domains, 'wanted') @@ -3650,7 +3650,7 @@ class PubServer(BaseHTTPRequestHandler): searchStr, pageNumber, maxPostsInFeed, http_prefix, - domainFull, + domain_full, actorStr, callingDomain, shared_items_federated_domains, 'shares') @@ -3671,7 +3671,7 @@ class PubServer(BaseHTTPRequestHandler): def _receiveVote(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Receive a vote via POST @@ -3687,7 +3687,7 @@ class PubServer(BaseHTTPRequestHandler): # the actor who votes usersPath = path.replace('/question', '') - actor = http_prefix + '://' + domainFull + usersPath + actor = http_prefix + '://' + domain_full + usersPath nickname = getNicknameFromActor(actor) if not nickname: if callingDomain.endswith('.onion') and onion_domain: @@ -3758,7 +3758,7 @@ class PubServer(BaseHTTPRequestHandler): callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Receives an image via POST @@ -3820,13 +3820,13 @@ class PubServer(BaseHTTPRequestHandler): def _removeShare(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Removes a shared item """ usersPath = path.split('/rmshare')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath length = int(self.headers['Content-length']) @@ -3861,7 +3861,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(base_dir, 'admin') adminActor = \ - localActorUrl(http_prefix, adminNickname, domainFull) + localActorUrl(http_prefix, adminNickname, domain_full) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ @@ -3874,7 +3874,7 @@ class PubServer(BaseHTTPRequestHandler): shareDomain, sharePort = getDomainFromActor(shareActor) removeSharedItem(base_dir, shareNickname, shareDomain, itemID, - http_prefix, domainFull, 'shares') + http_prefix, domain_full, 'shares') if callingDomain.endswith('.onion') and onion_domain: originPathStr = 'http://' + onion_domain + usersPath @@ -3887,13 +3887,13 @@ class PubServer(BaseHTTPRequestHandler): def _removeWanted(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Removes a wanted item """ usersPath = path.split('/rmwanted')[0] - originPathStr = http_prefix + '://' + domainFull + usersPath + originPathStr = http_prefix + '://' + domain_full + usersPath length = int(self.headers['Content-length']) @@ -3928,7 +3928,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(base_dir, 'admin') adminActor = \ - localActorUrl(http_prefix, adminNickname, domainFull) + localActorUrl(http_prefix, adminNickname, domain_full) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ @@ -3941,7 +3941,7 @@ class PubServer(BaseHTTPRequestHandler): shareDomain, sharePort = getDomainFromActor(shareActor) removeSharedItem(base_dir, shareNickname, shareDomain, itemID, - http_prefix, domainFull, 'wanted') + http_prefix, domain_full, 'wanted') if callingDomain.endswith('.onion') and onion_domain: originPathStr = 'http://' + onion_domain + usersPath @@ -3954,7 +3954,7 @@ class PubServer(BaseHTTPRequestHandler): def _removePost(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool) -> None: """Endpoint for removing posts after confirmation @@ -3963,7 +3963,7 @@ class PubServer(BaseHTTPRequestHandler): usersPath = path.split('/rmpost')[0] originPathStr = \ http_prefix + '://' + \ - domainFull + usersPath + domain_full + usersPath length = int(self.headers['Content-length']) @@ -4054,7 +4054,7 @@ class PubServer(BaseHTTPRequestHandler): def _linksUpdate(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, defaultTimeline: str, allow_local_network_access: bool) -> None: @@ -4195,7 +4195,7 @@ class PubServer(BaseHTTPRequestHandler): def _setHashtagCategory(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, defaultTimeline: str, allow_local_network_access: bool) -> None: @@ -4297,7 +4297,7 @@ class PubServer(BaseHTTPRequestHandler): def _newswireUpdate(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, defaultTimeline: str) -> None: """Updates the right newswire column of the timeline @@ -4452,7 +4452,7 @@ class PubServer(BaseHTTPRequestHandler): def _citationsUpdate(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, defaultTimeline: str, newswire: {}) -> None: @@ -4542,7 +4542,7 @@ class PubServer(BaseHTTPRequestHandler): def _newsPostEdit(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, defaultTimeline: str) -> None: """edits a news post after receiving POST @@ -4676,7 +4676,7 @@ class PubServer(BaseHTTPRequestHandler): def _profileUpdate(self, callingDomain: str, cookie: str, authorized: bool, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, debug: bool, allow_local_network_access: bool, system_language: str, content_license_url: str) -> None: @@ -5039,7 +5039,7 @@ class PubServer(BaseHTTPRequestHandler): fields['themeDropdown'], http_prefix, domain, - domainFull) + domain_full) if nickname == adminNickname: # change media instance status @@ -5528,7 +5528,7 @@ class PubServer(BaseHTTPRequestHandler): addHtmlTags(base_dir, http_prefix, nickname, - domainFull, + domain_full, bioStr, [], actorTags) if actorTags: actorJson['tag'] = [] @@ -5585,7 +5585,7 @@ class PubServer(BaseHTTPRequestHandler): getConfigParam(base_dir, "broch_mode") if broch_mode != currBrochMode: setBrochMode(self.server.base_dir, - self.server.domainFull, + self.server.domain_full, broch_mode) setConfigParam(base_dir, "broch_mode", broch_mode) @@ -5630,10 +5630,10 @@ class PubServer(BaseHTTPRequestHandler): self.server.sharedItemFederationTokens self.server.shared_items_federated_domains = \ siDomains - domainFull = self.server.domainFull + domain_full = self.server.domain_full self.server.sharedItemFederationTokens = \ mergeSharedItemTokens(self.server.base_dir, - domainFull, + domain_full, siDomains, siTokens) @@ -6707,7 +6707,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(faviconFilename, favType, favBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(favBinary) if debug: @@ -6725,7 +6725,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(faviconFilename, favType, favBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(favBinary) self.server.iconsCache[favFilename] = favBinary @@ -6759,7 +6759,7 @@ class PubServer(BaseHTTPRequestHandler): self._write(msg) def _getExportedTheme(self, callingDomain: str, path: str, - base_dir: str, domainFull: str, + base_dir: str, domain_full: str, debug: bool) -> None: """Returns an exported theme zip file """ @@ -6776,7 +6776,7 @@ class PubServer(BaseHTTPRequestHandler): exportType = 'application/zip' self._set_headers_etag(filename, exportType, exportBinary, None, - domainFull, False, None) + domain_full, False, None) self._write(exportBinary) self._404() @@ -6809,7 +6809,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(fontFilename, fontType, fontBinary, None, - self.server.domainFull, False, None) + self.server.domain_full, False, None) self._write(fontBinary) if debug: print('font sent from cache: ' + @@ -6830,7 +6830,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(fontFilename, fontType, fontBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(fontBinary) self.server.fontsCache[fontStr] = fontBinary @@ -6895,7 +6895,7 @@ class PubServer(BaseHTTPRequestHandler): def _getRSS2site(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domainFull: str, port: int, proxy_type: str, + domain_full: str, port: int, proxy_type: str, translate: {}, GETstartTime, debug: bool) -> None: @@ -6927,7 +6927,7 @@ class PubServer(BaseHTTPRequestHandler): break if msg: msg = rss2Header(http_prefix, - 'news', domainFull, + 'news', domain_full, 'Site', translate) + msg + rss2Footer() msg = msg.encode('utf-8') @@ -6961,7 +6961,7 @@ class PubServer(BaseHTTPRequestHandler): msg = getRSSfromDict(self.server.base_dir, self.server.newswire, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, 'Newswire', self.server.translate) if msg: msg = msg.encode('utf-8') @@ -7057,7 +7057,7 @@ class PubServer(BaseHTTPRequestHandler): def _showPersonOptions(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, GETstartTime, onion_domain: str, i2p_domain: str, cookie: str, debug: bool, @@ -7137,7 +7137,7 @@ class PubServer(BaseHTTPRequestHandler): checkForChangedActor(self.server.session, self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, optionsActor, optionsProfileUrl, self.server.person_cache, 5) @@ -7152,7 +7152,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.cssCache, self.server.translate, base_dir, domain, - domainFull, + domain_full, originPathStr, optionsActor, optionsProfileUrl, @@ -7194,7 +7194,7 @@ class PubServer(BaseHTTPRequestHandler): 'http://' + i2p_domain + originPathStr else: originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + http_prefix + '://' + domain_full + originPathStr self._redirect_headers(originPathStrAbsolute, cookie, callingDomain) @@ -7311,7 +7311,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(emojiFilename, mediaImageType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -7348,7 +7348,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(mediaFilename, mimeTypeStr, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -7367,7 +7367,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(mediaFilename, mimeType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) self.server.iconsCache[mediaStr] = mediaBinary @@ -7414,7 +7414,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(mediaFilename, mimeType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -7504,7 +7504,7 @@ class PubServer(BaseHTTPRequestHandler): def _hashtagSearch(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime) -> None: """Return the result of a hashtag search @@ -7567,7 +7567,7 @@ class PubServer(BaseHTTPRequestHandler): else: originPathStr = path.split('/tags/')[0] originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + http_prefix + '://' + domain_full + originPathStr if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ 'http://' + onion_domain + originPathStr @@ -7583,7 +7583,7 @@ class PubServer(BaseHTTPRequestHandler): def _hashtagSearchRSS2(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime) -> None: """Return an RSS 2 feed for a hashtag @@ -7595,7 +7595,7 @@ class PubServer(BaseHTTPRequestHandler): nickname = None if '/users/' in path: actor = \ - http_prefix + '://' + domainFull + path + http_prefix + '://' + domain_full + path nickname = \ getNicknameFromActor(actor) hashtagStr = \ @@ -7622,7 +7622,7 @@ class PubServer(BaseHTTPRequestHandler): else: originPathStr = path.split('/tags/rss2/')[0] originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + http_prefix + '://' + domain_full + originPathStr if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ 'http://' + onion_domain + originPathStr @@ -7639,7 +7639,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir: str, cookie: str, proxy_type: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, repeatPrivate: bool, @@ -7685,7 +7685,7 @@ class PubServer(BaseHTTPRequestHandler): return self.server.actorRepeat = path.split('?actor=')[1] announceToStr = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + \ + localActorUrl(http_prefix, self.postToNickname, domain_full) + \ '/followers' if not repeatPrivate: announceToStr = 'https://www.w3.org/ns/activitystreams#Public' @@ -7713,7 +7713,7 @@ class PubServer(BaseHTTPRequestHandler): announceId = removeIdEnding(announceJson['id']) announceFilename = \ savePostToBox(base_dir, http_prefix, announceId, - self.postToNickname, domainFull, + self.postToNickname, domain_full, announceJson, 'outbox') # clear the icon from the cache so that it gets updated @@ -7788,7 +7788,7 @@ class PubServer(BaseHTTPRequestHandler): base_dir: str, cookie: str, proxy_type: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, repeatPrivate: bool, debug: bool, @@ -7836,7 +7836,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoAnnounceActor = \ - http_prefix + '://' + domainFull + \ + http_prefix + '://' + domain_full + \ '/users/' + self.postToNickname unRepeatToStr = 'https://www.w3.org/ns/activitystreams#Public' newUndoAnnounce = { @@ -7865,7 +7865,7 @@ class PubServer(BaseHTTPRequestHandler): postFilename = None nickname = getNicknameFromActor(announceUrl) if nickname: - if domainFull + '/users/' + nickname + '/' in announceUrl: + if domain_full + '/users/' + nickname + '/' in announceUrl: postFilename = \ locatePost(base_dir, nickname, domain, announceUrl) if postFilename: @@ -7888,7 +7888,7 @@ class PubServer(BaseHTTPRequestHandler): def _followApproveButton(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, debug: bool) -> None: @@ -7920,7 +7920,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.project_version, self.server.signing_priv_key_pem) originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + http_prefix + '://' + domain_full + originPathStr if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ 'http://' + onion_domain + originPathStr @@ -7936,7 +7936,7 @@ class PubServer(BaseHTTPRequestHandler): def _newswireVote(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, debug: bool, @@ -7975,7 +7975,7 @@ class PubServer(BaseHTTPRequestHandler): str(newswire)) originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + '/' + \ + http_prefix + '://' + domain_full + originPathStr + '/' + \ self.server.defaultTimeline if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ @@ -7992,7 +7992,7 @@ class PubServer(BaseHTTPRequestHandler): def _newswireUnvote(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, debug: bool, @@ -8029,7 +8029,7 @@ class PubServer(BaseHTTPRequestHandler): str(newswire)) originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + '/' + \ + http_prefix + '://' + domain_full + originPathStr + '/' + \ self.server.defaultTimeline if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ @@ -8046,7 +8046,7 @@ class PubServer(BaseHTTPRequestHandler): def _followDenyButton(self, callingDomain: str, path: str, cookie: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, debug: bool) -> None: @@ -8075,7 +8075,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.project_version, self.server.signing_priv_key_pem) originPathStrAbsolute = \ - http_prefix + '://' + domainFull + originPathStr + http_prefix + '://' + domain_full + originPathStr if callingDomain.endswith('.onion') and onion_domain: originPathStrAbsolute = \ 'http://' + onion_domain + originPathStr @@ -8090,7 +8090,7 @@ class PubServer(BaseHTTPRequestHandler): def _likeButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8136,7 +8136,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return likeActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) actorLiked = path.split('?actor=')[1] if '?' in actorLiked: actorLiked = actorLiked.split('?')[0] @@ -8255,7 +8255,7 @@ class PubServer(BaseHTTPRequestHandler): def _undoLikeButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8300,7 +8300,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) actorLiked = path.split('?actor=')[1] if '?' in actorLiked: actorLiked = actorLiked.split('?')[0] @@ -8405,7 +8405,7 @@ class PubServer(BaseHTTPRequestHandler): def _reactionButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8467,7 +8467,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return reactionActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) actorReaction = path.split('?actor=')[1] if '?' in actorReaction: actorReaction = actorReaction.split('?')[0] @@ -8591,7 +8591,7 @@ class PubServer(BaseHTTPRequestHandler): def _undoReactionButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, + domain: str, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8651,7 +8651,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) actorReaction = path.split('?actor=')[1] if '?' in actorReaction: actorReaction = actorReaction.split('?')[0] @@ -8759,7 +8759,7 @@ class PubServer(BaseHTTPRequestHandler): def _reactionPicker(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8852,7 +8852,7 @@ class PubServer(BaseHTTPRequestHandler): def _bookmarkButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -8898,7 +8898,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return bookmarkActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) ccList = [] bookmark(self.server.recentPostsCache, self.server.session, @@ -8979,7 +8979,7 @@ class PubServer(BaseHTTPRequestHandler): def _undoBookmarkButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9024,7 +9024,7 @@ class PubServer(BaseHTTPRequestHandler): self._404() return undoActor = \ - localActorUrl(http_prefix, self.postToNickname, domainFull) + localActorUrl(http_prefix, self.postToNickname, domain_full) ccList = [] undoBookmark(self.server.recentPostsCache, self.server.session, @@ -9106,7 +9106,7 @@ class PubServer(BaseHTTPRequestHandler): def _deleteButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9136,7 +9136,7 @@ class PubServer(BaseHTTPRequestHandler): timelineStr = timelineStr.split('?')[0] usersPath = path.split('?delete=')[0] actor = \ - http_prefix + '://' + domainFull + usersPath + http_prefix + '://' + domain_full + usersPath if self.server.allow_deletion or \ deleteUrl.startswith(actor): if self.server.debug: @@ -9205,7 +9205,7 @@ class PubServer(BaseHTTPRequestHandler): def _muteButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9236,7 +9236,7 @@ class PubServer(BaseHTTPRequestHandler): if pageNumberStr.isdigit(): pageNumber = int(pageNumberStr) actor = \ - http_prefix + '://' + domainFull + path.split('?mute=')[0] + http_prefix + '://' + domain_full + path.split('?mute=')[0] nickname = getNicknameFromActor(actor) mutePost(base_dir, nickname, domain, port, http_prefix, muteUrl, @@ -9314,7 +9314,7 @@ class PubServer(BaseHTTPRequestHandler): def _undoMuteButton(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9345,7 +9345,7 @@ class PubServer(BaseHTTPRequestHandler): if pageNumberStr.isdigit(): pageNumber = int(pageNumberStr) actor = \ - http_prefix + '://' + domainFull + path.split('?unmute=')[0] + http_prefix + '://' + domain_full + path.split('?unmute=')[0] nickname = getNicknameFromActor(actor) unmutePost(base_dir, nickname, domain, port, http_prefix, muteUrl, @@ -9422,7 +9422,7 @@ class PubServer(BaseHTTPRequestHandler): def _showRepliesToPost(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9453,7 +9453,7 @@ class PubServer(BaseHTTPRequestHandler): acctDir(base_dir, nickname, domain) + '/' + boxname postRepliesFilename = \ postDir + '/' + \ - http_prefix + ':##' + domainFull + '#users#' + \ + http_prefix + ':##' + domain_full + '#users#' + \ nickname + '#statuses#' + statusNumber + '.replies' if not os.path.isfile(postRepliesFilename): # There are no replies, @@ -9462,15 +9462,15 @@ class PubServer(BaseHTTPRequestHandler): 'https://www.w3.org/ns/activitystreams' firstStr = \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies?page=true' idStr = \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies' lastStr = \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '/replies?page=true' repliesJson = { @@ -9552,11 +9552,11 @@ class PubServer(BaseHTTPRequestHandler): contextStr = 'https://www.w3.org/ns/activitystreams' idStr = \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber + '?page=true' partOfStr = \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/statuses/' + statusNumber repliesJson = { @@ -9644,7 +9644,7 @@ class PubServer(BaseHTTPRequestHandler): def _showRoles(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9754,7 +9754,7 @@ class PubServer(BaseHTTPRequestHandler): def _showSkills(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9879,7 +9879,7 @@ class PubServer(BaseHTTPRequestHandler): def _showIndividualAtPost(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -9924,7 +9924,7 @@ class PubServer(BaseHTTPRequestHandler): postFilename = \ acctDir(base_dir, nickname, domain) + '/outbox/' + \ - http_prefix + ':##' + domainFull + '#users#' + nickname + \ + http_prefix + ':##' + domain_full + '#users#' + nickname + \ '#statuses#' + statusNumber + '.json' includeCreateWrapper = False @@ -9935,7 +9935,7 @@ class PubServer(BaseHTTPRequestHandler): reactBy, reactEmoji, authorized, callingDomain, path, base_dir, http_prefix, nickname, - domain, domainFull, port, + domain, domain_full, port, onion_domain, i2p_domain, GETstartTime, proxy_type, cookie, debug, @@ -9950,7 +9950,7 @@ class PubServer(BaseHTTPRequestHandler): authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, nickname: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10043,7 +10043,7 @@ class PubServer(BaseHTTPRequestHandler): def _showIndividualPost(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10082,7 +10082,7 @@ class PubServer(BaseHTTPRequestHandler): postFilename = \ acctDir(base_dir, nickname, domain) + '/outbox/' + \ - http_prefix + ':##' + domainFull + '#users#' + nickname + \ + http_prefix + ':##' + domain_full + '#users#' + nickname + \ '#statuses#' + statusNumber + '.json' includeCreateWrapper = False @@ -10093,7 +10093,7 @@ class PubServer(BaseHTTPRequestHandler): reactBy, reactEmoji, authorized, callingDomain, path, base_dir, http_prefix, nickname, - domain, domainFull, port, + domain, domain_full, port, onion_domain, i2p_domain, GETstartTime, proxy_type, cookie, debug, @@ -10106,7 +10106,7 @@ class PubServer(BaseHTTPRequestHandler): def _showNotifyPost(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10137,7 +10137,7 @@ class PubServer(BaseHTTPRequestHandler): reactBy, reactEmoji, authorized, callingDomain, path, base_dir, http_prefix, nickname, - domain, domainFull, port, + domain, domain_full, port, onion_domain, i2p_domain, GETstartTime, proxy_type, cookie, debug, @@ -10150,7 +10150,7 @@ class PubServer(BaseHTTPRequestHandler): def _showInbox(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10319,7 +10319,7 @@ class PubServer(BaseHTTPRequestHandler): def _showDMs(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10464,7 +10464,7 @@ class PubServer(BaseHTTPRequestHandler): def _showReplies(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10609,7 +10609,7 @@ class PubServer(BaseHTTPRequestHandler): def _showMediaTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10751,7 +10751,7 @@ class PubServer(BaseHTTPRequestHandler): def _showBlogsTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -10894,7 +10894,7 @@ class PubServer(BaseHTTPRequestHandler): def _showNewsTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11045,7 +11045,7 @@ class PubServer(BaseHTTPRequestHandler): def _showFeaturesTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11196,7 +11196,7 @@ class PubServer(BaseHTTPRequestHandler): def _showSharesTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11282,7 +11282,7 @@ class PubServer(BaseHTTPRequestHandler): def _showWantedTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11367,7 +11367,7 @@ class PubServer(BaseHTTPRequestHandler): def _showBookmarksTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11513,7 +11513,7 @@ class PubServer(BaseHTTPRequestHandler): def _showOutboxTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11640,7 +11640,7 @@ class PubServer(BaseHTTPRequestHandler): def _showModTimeline(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11783,7 +11783,7 @@ class PubServer(BaseHTTPRequestHandler): def _showSharesFeed(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -11899,7 +11899,7 @@ class PubServer(BaseHTTPRequestHandler): def _showFollowingFeed(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -12018,7 +12018,7 @@ class PubServer(BaseHTTPRequestHandler): def _showFollowersFeed(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -12140,13 +12140,13 @@ class PubServer(BaseHTTPRequestHandler): path: str, http_prefix: str, nickname: str, domain: str, - domainFull: str, system_language: str) -> None: + domain_full: str, system_language: str) -> None: """Returns the featured posts collections in actor/collections/featured """ featuredCollection = \ jsonPinPost(base_dir, http_prefix, - nickname, domain, domainFull, system_language) + nickname, domain, domain_full, system_language) msg = json.dumps(featuredCollection, ensure_ascii=False).encode('utf-8') msglen = len(msg) @@ -12157,7 +12157,7 @@ class PubServer(BaseHTTPRequestHandler): def _getFeaturedTagsCollection(self, callingDomain: str, path: str, http_prefix: str, - domainFull: str): + domain_full: str): """Returns the featured tags collections in actor/collections/featuredTags TODO add ability to set a featured tags @@ -12165,7 +12165,7 @@ class PubServer(BaseHTTPRequestHandler): postContext = getIndividualPostContext() featuredTagsCollection = { '@context': postContext, - 'id': http_prefix + '://' + domainFull + path, + 'id': http_prefix + '://' + domain_full + path, 'orderedItems': [], 'totalItems': 0, 'type': 'OrderedCollection' @@ -12180,7 +12180,7 @@ class PubServer(BaseHTTPRequestHandler): def _showPersonProfile(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -12277,7 +12277,7 @@ class PubServer(BaseHTTPRequestHandler): def _showInstanceActor(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -12301,7 +12301,7 @@ class PubServer(BaseHTTPRequestHandler): elif i2p_domain and callingDomain.endswith('.i2p'): actorDomainUrl = 'http://' + i2p_domain else: - actorDomainUrl = http_prefix + '://' + domainFull + actorDomainUrl = http_prefix + '://' + domain_full actorUrl = actorDomainUrl + '/users/Actor' removeFields = ('icon', 'image', 'tts', 'shares', 'alsoKnownAs', 'hasOccupation', 'featured', @@ -12316,7 +12316,7 @@ class PubServer(BaseHTTPRequestHandler): 'sharedInbox': actorDomainUrl + '/inbox' } actorJson['name'] = 'ACTOR' - actorJson['preferredUsername'] = domainFull + actorJson['preferredUsername'] = domain_full actorJson['id'] = actorDomainUrl + '/actor' actorJson['type'] = 'Application' actorJson['summary'] = 'Instance Actor' @@ -12328,10 +12328,10 @@ class PubServer(BaseHTTPRequestHandler): actorJson['following'] = actorUrl + '/following' msgStr = json.dumps(actorJson, ensure_ascii=False) if onion_domain and callingDomain.endswith('.onion'): - msgStr = msgStr.replace(http_prefix + '://' + domainFull, + msgStr = msgStr.replace(http_prefix + '://' + domain_full, 'http://' + onion_domain) elif i2p_domain and callingDomain.endswith('.i2p'): - msgStr = msgStr.replace(http_prefix + '://' + domainFull, + msgStr = msgStr.replace(http_prefix + '://' + domain_full, 'http://' + i2p_domain) msg = msgStr.encode('utf-8') msglen = len(msg) @@ -12354,7 +12354,7 @@ class PubServer(BaseHTTPRequestHandler): def _showBlogPage(self, authorized: bool, callingDomain: str, path: str, base_dir: str, http_prefix: str, - domain: str, domainFull: str, port: int, + domain: str, domain_full: str, port: int, onion_domain: str, i2p_domain: str, GETstartTime, proxy_type: str, cookie: str, @@ -12410,7 +12410,7 @@ class PubServer(BaseHTTPRequestHandler): return True def _redirectToLoginScreen(self, callingDomain: str, path: str, - http_prefix: str, domainFull: str, + http_prefix: str, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime, authorized: bool, debug: bool): @@ -12464,7 +12464,7 @@ class PubServer(BaseHTTPRequestHandler): None, callingDomain) else: self._redirect_headers(http_prefix + '://' + - domainFull + + domain_full + divertPath, None, callingDomain) fitnessPerformance(GETstartTime, self.server.fitness, @@ -12537,7 +12537,7 @@ class PubServer(BaseHTTPRequestHandler): mimeType = mediaFileMimeType(qrFilename) self._set_headers_etag(qrFilename, mimeType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, @@ -12582,7 +12582,7 @@ class PubServer(BaseHTTPRequestHandler): mimeType = mediaFileMimeType(bannerFilename) self._set_headers_etag(bannerFilename, mimeType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, @@ -12625,7 +12625,7 @@ class PubServer(BaseHTTPRequestHandler): mimeType = mediaFileMimeType(bannerFilename) self._set_headers_etag(bannerFilename, mimeType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, @@ -12672,7 +12672,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(bgFilename, 'image/' + ext, bgBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(bgBinary) fitnessPerformance(GETstartTime, @@ -12717,7 +12717,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(bgFilename, 'image/' + ext, bgBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(bgBinary) fitnessPerformance(GETstartTime, @@ -12761,7 +12761,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(mediaFilename, mediaFileType, mediaBinary, None, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, @@ -12863,7 +12863,7 @@ class PubServer(BaseHTTPRequestHandler): def _confirmDeleteEvent(self, callingDomain: str, path: str, base_dir: str, http_prefix: str, cookie: str, - translate: {}, domainFull: str, + translate: {}, domain_full: str, onion_domain: str, i2p_domain: str, GETstartTime) -> bool: """Confirm whether to delete a calendar event @@ -12888,14 +12888,14 @@ class PubServer(BaseHTTPRequestHandler): translate, base_dir, path, http_prefix, - domainFull, + domain_full, postId, postTime, postYear, postMonth, postDay, callingDomain) if not msg: actor = \ http_prefix + '://' + \ - domainFull + \ + domain_full + \ path.split('/eventdelete')[0] if callingDomain.endswith('.onion') and onion_domain: actor = \ @@ -12925,7 +12925,7 @@ class PubServer(BaseHTTPRequestHandler): inReplyToUrl: str, replyToList: [], shareDescription: str, replyPageNumber: int, replyCategory: str, - domain: str, domainFull: str, + domain: str, domain_full: str, GETstartTime, cookie, noDropDown: bool, conversationId: str) -> bool: """Shows the new post screen @@ -12977,7 +12977,7 @@ class PubServer(BaseHTTPRequestHandler): replyPageNumber, replyCategory, nickname, domain, - domainFull, + domain_full, self.server.defaultTimeline, self.server.newswire, self.server.theme_name, @@ -13166,7 +13166,7 @@ class PubServer(BaseHTTPRequestHandler): def _editNewsPost(self, callingDomain: str, path: str, translate: {}, base_dir: str, http_prefix: str, domain: str, port: int, - domainFull: str, + domain_full: str, cookie: str) -> bool: """Show the edit screen for a news post """ @@ -13179,7 +13179,7 @@ class PubServer(BaseHTTPRequestHandler): postId = path.split('/editnewspost=')[1] if '?' in postId: postId = postId.split('?')[0] - postUrl = localActorUrl(http_prefix, postActor, domainFull) + \ + postUrl = localActorUrl(http_prefix, postActor, domain_full) + \ '/statuses/' + postId path = path.split('/editnewspost=')[0] msg = htmlEditNewsPost(self.server.cssCache, @@ -13307,27 +13307,27 @@ class PubServer(BaseHTTPRequestHandler): return False def do_GET(self): - callingDomain = self.server.domainFull + callingDomain = self.server.domain_full if self.headers.get('Host'): callingDomain = decodedHost(self.headers['Host']) if self.server.onion_domain: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull and \ + callingDomain != self.server.domain_full and \ callingDomain != self.server.onion_domain: print('GET domain blocked: ' + callingDomain) self._400() return elif self.server.i2p_domain: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull and \ + callingDomain != self.server.domain_full and \ callingDomain != self.server.i2p_domain: print('GET domain blocked: ' + callingDomain) self._400() return else: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull: + callingDomain != self.server.domain_full: print('GET domain blocked: ' + callingDomain) self._400() return @@ -13363,7 +13363,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.translate, self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.system_language, False).encode('utf-8') msglen = len(msg) @@ -13385,7 +13385,7 @@ class PubServer(BaseHTTPRequestHandler): else: self._logout_redirect(self.server.http_prefix + '://' + - self.server.domainFull + + self.server.domain_full + '/users/news', None, callingDomain) fitnessPerformance(GETstartTime, self.server.fitness, @@ -13421,7 +13421,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -13550,10 +13550,10 @@ class PubServer(BaseHTTPRequestHandler): catalogJson = \ sharesCatalogEndpoint(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.path, 'shares') else: - domainFull = self.server.domainFull + domain_full = self.server.domain_full http_prefix = self.server.http_prefix nickname = self.path.split('/users/')[1] if '/' in nickname: @@ -13565,7 +13565,7 @@ class PubServer(BaseHTTPRequestHandler): http_prefix, nickname, self.server.domain, - domainFull, + domain_full, self.path, self.server.debug, 'shares') @@ -13581,7 +13581,7 @@ class PubServer(BaseHTTPRequestHandler): msg = \ sharesCatalogCSVEndpoint(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.path, 'shares').encode('utf-8') msglen = len(msg) @@ -13643,10 +13643,10 @@ class PubServer(BaseHTTPRequestHandler): catalogJson = \ sharesCatalogEndpoint(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.path, 'wanted') else: - domainFull = self.server.domainFull + domain_full = self.server.domain_full http_prefix = self.server.http_prefix nickname = self.path.split('/users/')[1] if '/' in nickname: @@ -13658,7 +13658,7 @@ class PubServer(BaseHTTPRequestHandler): http_prefix, nickname, self.server.domain, - domainFull, + domain_full, self.path, self.server.debug, 'wanted') @@ -13674,7 +13674,7 @@ class PubServer(BaseHTTPRequestHandler): msg = \ sharesCatalogCSVEndpoint(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.path, 'wanted').encode('utf-8') msglen = len(msg) @@ -13694,7 +13694,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.authorizedNickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.translate, @@ -13749,7 +13749,7 @@ class PubServer(BaseHTTPRequestHandler): # cached favicon images # Note that this comes before the busy flag to avoid conflicts if self.path.startswith('/favicons/'): - if self.server.domainFull in self.path: + if self.server.domain_full in self.path: # favicon for this instance self._getFavicon(callingDomain, self.server.base_dir, self.server.debug, @@ -13770,7 +13770,7 @@ class PubServer(BaseHTTPRequestHandler): if authorized and '/exports/' in self.path: self._getExportedTheme(callingDomain, self.path, self.server.base_dir, - self.server.domainFull, + self.server.domain_full, self.server.debug) return @@ -13842,7 +13842,7 @@ class PubServer(BaseHTTPRequestHandler): callingDomain, self.path, self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.proxy_type, self.server.translate, @@ -13957,7 +13957,7 @@ class PubServer(BaseHTTPRequestHandler): getPinnedPostAsJson(self.server.base_dir, self.server.http_prefix, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.system_language) message_json = {} if pinnedPostJson: @@ -13991,7 +13991,7 @@ class PubServer(BaseHTTPRequestHandler): self.path, self.server.http_prefix, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.system_language) return @@ -14000,7 +14000,7 @@ class PubServer(BaseHTTPRequestHandler): self._getFeaturedTagsCollection(callingDomain, self.path, self.server.http_prefix, - self.server.domainFull) + self.server.domain_full) return fitnessPerformance(GETstartTime, self.server.fitness, @@ -14092,7 +14092,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -14112,7 +14112,7 @@ class PubServer(BaseHTTPRequestHandler): devJson = E2EEdevicesCollection(self.server.base_dir, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.http_prefix) msg = json.dumps(devJson, ensure_ascii=False).encode('utf-8') @@ -14137,7 +14137,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, GETstartTime, self.server.onion_domain, self.server.i2p_domain, @@ -14153,7 +14153,7 @@ class PubServer(BaseHTTPRequestHandler): pathContainsBlogLink(self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.path) if blogFilename and nickname: post_json_object = loadJson(blogFilename) @@ -14164,7 +14164,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, self.server.translate, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, post_json_object, self.server.peertube_instances, self.server.system_language, @@ -14204,7 +14204,7 @@ class PubServer(BaseHTTPRequestHandler): msg = \ htmlShowShare(self.server.base_dir, self.server.domain, nickname, - self.server.http_prefix, self.server.domainFull, + self.server.http_prefix, self.server.domain_full, itemID, self.server.translate, self.server.shared_items_federated_domains, self.server.defaultTimeline, @@ -14243,7 +14243,7 @@ class PubServer(BaseHTTPRequestHandler): msg = \ htmlShowShare(self.server.base_dir, self.server.domain, nickname, - self.server.http_prefix, self.server.domainFull, + self.server.http_prefix, self.server.domain_full, itemID, self.server.translate, self.server.shared_items_federated_domains, self.server.defaultTimeline, @@ -14275,7 +14275,7 @@ class PubServer(BaseHTTPRequestHandler): usersPath = self.path.split('?rmshare=')[0] actor = \ self.server.http_prefix + '://' + \ - self.server.domainFull + usersPath + self.server.domain_full + usersPath msg = htmlConfirmRemoveSharedItem(self.server.cssCache, self.server.translate, self.server.base_dir, @@ -14308,7 +14308,7 @@ class PubServer(BaseHTTPRequestHandler): usersPath = self.path.split('?rmwanted=')[0] actor = \ self.server.http_prefix + '://' + \ - self.server.domainFull + usersPath + self.server.domain_full + usersPath msg = htmlConfirmRemoveSharedItem(self.server.cssCache, self.server.translate, self.server.base_dir, @@ -14353,7 +14353,7 @@ class PubServer(BaseHTTPRequestHandler): msg = htmlTermsOfService(self.server.cssCache, self.server.base_dir, self.server.http_prefix, - self.server.domainFull) + self.server.domain_full) msg = msg.encode('utf-8') msglen = len(msg) self._login_headers('text/html', msglen, callingDomain) @@ -14411,7 +14411,7 @@ class PubServer(BaseHTTPRequestHandler): htmlAbout(self.server.cssCache, self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.translate, self.server.system_language) @@ -14521,7 +14521,7 @@ class PubServer(BaseHTTPRequestHandler): htmlWelcomeProfile(self.server.base_dir, nickname, self.server.domain, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.system_language, self.server.translate, self.server.theme_name) @@ -14549,7 +14549,7 @@ class PubServer(BaseHTTPRequestHandler): htmlWelcomeFinal(self.server.base_dir, nickname, self.server.domain, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.system_language, self.server.translate, self.server.theme_name) @@ -14572,7 +14572,7 @@ class PubServer(BaseHTTPRequestHandler): self.path != '/users/news/newswiremobile': if self._redirectToLoginScreen(callingDomain, self.path, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime, @@ -14619,7 +14619,7 @@ class PubServer(BaseHTTPRequestHandler): mimeType = mediaFileMimeType(mediaFilename) self._set_headers_etag(mediaFilename, mimeType, mediaBinary, cookie, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -14661,7 +14661,7 @@ class PubServer(BaseHTTPRequestHandler): mimeType = mediaFileMimeType(screenFilename) self._set_headers_etag(screenFilename, mimeType, mediaBinary, cookie, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -14704,7 +14704,7 @@ class PubServer(BaseHTTPRequestHandler): self._set_headers_etag(iconFilename, mimeTypeStr, mediaBinary, cookie, - self.server.domainFull, + self.server.domain_full, False, None) self._write(mediaBinary) fitnessPerformance(GETstartTime, self.server.fitness, @@ -14918,7 +14918,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.translate, self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.system_language, True).encode('utf-8') msglen = len(msg) @@ -14949,7 +14949,7 @@ class PubServer(BaseHTTPRequestHandler): else: self._logout_redirect(self.server.http_prefix + '://' + - self.server.domainFull + + self.server.domain_full + '/users/news', None, callingDomain) fitnessPerformance(GETstartTime, self.server.fitness, @@ -14987,7 +14987,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.http_prefix, self.server.translate, self.server.newswire, @@ -15029,7 +15029,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.shared_items_federated_domains msg = htmlLinksMobile(self.server.cssCache, self.server.base_dir, nickname, - self.server.domainFull, + self.server.domain_full, self.server.http_prefix, self.server.translate, timelinePath, @@ -15056,7 +15056,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15068,7 +15068,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15177,7 +15177,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.translate, self.server.base_dir, self.path, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, self.server.text_mode_banner, accessKeys).encode('utf-8') msglen = len(msg) @@ -15204,7 +15204,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, cookie, self.server.translate, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime): @@ -15248,7 +15248,7 @@ class PubServer(BaseHTTPRequestHandler): cookie, self.server.proxy_type, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15272,7 +15272,7 @@ class PubServer(BaseHTTPRequestHandler): cookie, self.server.proxy_type, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15295,7 +15295,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15314,7 +15314,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15333,7 +15333,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15355,7 +15355,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15375,7 +15375,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime, @@ -15395,7 +15395,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime, @@ -15416,7 +15416,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime, @@ -15438,7 +15438,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, GETstartTime, @@ -15457,7 +15457,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15477,7 +15477,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15497,7 +15497,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15517,7 +15517,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15537,7 +15537,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15557,7 +15557,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15687,7 +15687,7 @@ class PubServer(BaseHTTPRequestHandler): if nickname == actor: postUrl = \ localActorUrl(self.server.http_prefix, nickname, - self.server.domainFull) + \ + self.server.domain_full) + \ '/statuses/' + messageId msg = htmlEditBlog(self.server.media_instance, self.server.translate, @@ -15754,7 +15754,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, self.server.domain, self.server.port, - self.server.domainFull, + self.server.domain_full, cookie): self.server.GETbusy = False return @@ -15768,7 +15768,7 @@ class PubServer(BaseHTTPRequestHandler): shareDescription, replyPageNumber, replyCategory, self.server.domain, - self.server.domainFull, + self.server.domain_full, GETstartTime, cookie, noDropDown, conversationId): self.server.GETbusy = False @@ -15784,7 +15784,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15805,7 +15805,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15826,7 +15826,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15847,7 +15847,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15867,7 +15867,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15885,7 +15885,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15906,7 +15906,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15938,7 +15938,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15959,7 +15959,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -15980,7 +15980,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16001,7 +16001,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16022,7 +16022,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16040,7 +16040,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16061,7 +16061,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16078,7 +16078,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16178,7 +16178,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16200,7 +16200,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16222,7 +16222,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16241,7 +16241,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16260,7 +16260,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16279,7 +16279,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16299,7 +16299,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -16365,19 +16365,19 @@ class PubServer(BaseHTTPRequestHandler): self.server.debug) def do_HEAD(self): - callingDomain = self.server.domainFull + callingDomain = self.server.domain_full if self.headers.get('Host'): callingDomain = decodedHost(self.headers['Host']) if self.server.onion_domain: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull and \ + callingDomain != self.server.domain_full and \ callingDomain != self.server.onion_domain: print('HEAD domain blocked: ' + callingDomain) self._400() return else: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull: + callingDomain != self.server.domain_full: print('HEAD domain blocked: ' + callingDomain) self._400() return @@ -16652,7 +16652,7 @@ class PubServer(BaseHTTPRequestHandler): nickname): populateReplies(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, message_json, self.server.max_replies, self.server.debug) @@ -16729,7 +16729,7 @@ class PubServer(BaseHTTPRequestHandler): refreshNewswire(self.server.base_dir) populateReplies(self.server.base_dir, self.server.http_prefix, - self.server.domainFull, + self.server.domain_full, message_json, self.server.max_replies, self.server.debug) @@ -17001,7 +17001,7 @@ class PubServer(BaseHTTPRequestHandler): return -1 elif postType == 'newreminder': message_json = None - handle = nickname + '@' + self.server.domainFull + handle = nickname + '@' + self.server.domain_full print('A reminder was posted for ' + handle) if '@' + handle not in mentionsStr: mentionsStr = '@' + handle + ' ' + mentionsStr @@ -17478,26 +17478,26 @@ class PubServer(BaseHTTPRequestHandler): ' path: ' + self.path + ' busy: ' + str(self.server.POSTbusy)) - callingDomain = self.server.domainFull + callingDomain = self.server.domain_full if self.headers.get('Host'): callingDomain = decodedHost(self.headers['Host']) if self.server.onion_domain: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull and \ + callingDomain != self.server.domain_full and \ callingDomain != self.server.onion_domain: print('POST domain blocked: ' + callingDomain) self._400() return elif self.server.i2p_domain: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull and \ + callingDomain != self.server.domain_full and \ callingDomain != self.server.i2p_domain: print('POST domain blocked: ' + callingDomain) self._400() return else: if callingDomain != self.server.domain and \ - callingDomain != self.server.domainFull: + callingDomain != self.server.domain_full: print('POST domain blocked: ' + callingDomain) self._400() return @@ -17568,7 +17568,7 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/login'): self._loginScreen(self.path, callingDomain, cookie, self.server.base_dir, self.server.http_prefix, - self.server.domain, self.server.domainFull, + self.server.domain, self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -17585,7 +17585,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, @@ -17600,7 +17600,7 @@ class PubServer(BaseHTTPRequestHandler): self._profileUpdate(callingDomain, cookie, authorized, self.path, self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, self.server.allow_local_network_access, @@ -17613,7 +17613,7 @@ class PubServer(BaseHTTPRequestHandler): self._linksUpdate(callingDomain, cookie, authorized, self.path, self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, self.server.defaultTimeline, @@ -17625,7 +17625,7 @@ class PubServer(BaseHTTPRequestHandler): self._newswireUpdate(callingDomain, cookie, authorized, self.path, self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, self.server.defaultTimeline) @@ -17637,7 +17637,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, self.server.defaultTimeline, @@ -17649,7 +17649,7 @@ class PubServer(BaseHTTPRequestHandler): self._newsPostEdit(callingDomain, cookie, authorized, self.path, self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug, self.server.defaultTimeline) @@ -17671,7 +17671,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17705,7 +17705,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, searchForEmoji, self.server.onion_domain, @@ -17735,7 +17735,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -17749,7 +17749,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -17763,7 +17763,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -17788,7 +17788,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -17806,7 +17806,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17825,7 +17825,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17844,7 +17844,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17863,7 +17863,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17883,7 +17883,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17909,7 +17909,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17937,7 +17937,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, nickname, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.port, self.server.onion_domain, self.server.i2p_domain, @@ -17967,7 +17967,7 @@ class PubServer(BaseHTTPRequestHandler): for siDomain in siDomainsList: domainsList.append(siDomain.strip()) originDomain = self.headers.get('Origin') - if originDomain != self.server.domainFull and \ + if originDomain != self.server.domain_full and \ originDomain != self.server.onion_domain and \ originDomain != self.server.i2p_domain and \ originDomain in self.server.shared_items_federated_domains: @@ -17975,7 +17975,7 @@ class PubServer(BaseHTTPRequestHandler): print('DEBUG: ' + 'POST updating shared item federation ' + 'token for ' + originDomain + ' to ' + - self.server.domainFull) + self.server.domain_full) sharedItemTokens = self.server.sharedItemFederationTokens sharesToken = self.headers['SharesCatalog'] self.server.sharedItemFederationTokens = \ @@ -17991,7 +17991,7 @@ class PubServer(BaseHTTPRequestHandler): originDomain) else: print('originDomain is not a different instance. ' + - originDomain + ' ' + self.server.domainFull + ' ' + + originDomain + ' ' + self.server.domain_full + ' ' + str(fed_domains)) fitnessPerformance(POSTstartTime, self.server.fitness, @@ -18046,7 +18046,7 @@ class PubServer(BaseHTTPRequestHandler): else: actorPathStr = \ localActorUrl(self.server.http_prefix, nickname, - self.server.domainFull) + \ + self.server.domain_full) + \ '/' + postRedirect + '?page=' + str(pageNumber) self._redirect_headers(actorPathStr, cookie, callingDomain) @@ -18118,7 +18118,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.server.http_prefix, self.server.domain, - self.server.domainFull, + self.server.domain_full, self.server.onion_domain, self.server.i2p_domain, self.server.debug) @@ -18732,8 +18732,8 @@ def runDaemon(content_license_url: str, httpd.maxPostsInBox = 32000 httpd.domain = domain httpd.port = port - httpd.domainFull = getFullDomain(domain, port) - save_domain_qrcode(base_dir, http_prefix, httpd.domainFull) + httpd.domain_full = getFullDomain(domain, port) + save_domain_qrcode(base_dir, http_prefix, httpd.domain_full) httpd.http_prefix = http_prefix httpd.debug = debug httpd.federation_list = fed_list.copy() @@ -18784,10 +18784,10 @@ def runDaemon(content_license_url: str, # get the list of custom emoji, for use by the mastodon api httpd.customEmoji = \ - metadataCustomEmoji(base_dir, http_prefix, httpd.domainFull) + metadataCustomEmoji(base_dir, http_prefix, httpd.domain_full) # whether to enable broch mode, which locks down the instance - setBrochMode(base_dir, httpd.domainFull, broch_mode) + setBrochMode(base_dir, httpd.domain_full, broch_mode) if not os.path.isdir(base_dir + '/accounts/inbox@' + domain): print('Creating shared inbox: inbox@' + domain) @@ -18833,7 +18833,7 @@ def runDaemon(content_license_url: str, httpd.theme_name, http_prefix, domain, - httpd.domainFull) + httpd.domain_full) if not os.path.isdir(base_dir + '/cache'): os.mkdir(base_dir + '/cache') @@ -18910,7 +18910,7 @@ def runDaemon(content_license_url: str, generateSharedItemFederationTokens(fed_domains, base_dir) httpd.sharedItemFederationTokens = \ - createSharedItemFederationToken(base_dir, httpd.domainFull, False, + createSharedItemFederationToken(base_dir, httpd.domain_full, False, httpd.sharedItemFederationTokens) # load peertube instances from file into a list @@ -18967,7 +18967,7 @@ def runDaemon(content_license_url: str, httpd.thrFederatedSharesDaemon = \ threadWithTrace(target=runFederatedSharesDaemon, args=(base_dir, httpd, - http_prefix, httpd.domainFull, + http_prefix, httpd.domain_full, proxy_type, debug, httpd.system_language), daemon=True) diff --git a/desktop_client.py b/desktop_client.py index f7a1dccce..cb42103c9 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -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: diff --git a/devices.py b/devices.py index 887c04b47..6a4fc34f9 100644 --- a/devices.py +++ b/devices.py @@ -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 = [] diff --git a/epicyon.py b/epicyon.py index 0bc5bc376..a4c5f3aa9 100644 --- a/epicyon.py +++ b/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) diff --git a/feeds.py b/feeds.py index 07cb7741d..6d0ba0902 100644 --- a/feeds.py +++ b/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 \ "" + \ "" + \ '' + \ ' #' + hashtag + '' + \ - ' ' + http_prefix + '://' + domainFull + \ + ' ' + http_prefix + '://' + domain_full + \ '/tags/rss2/' + hashtag + '' diff --git a/follow.py b/follow.py index 90c121849..3cea35a0f 100644 --- a/follow.py +++ b/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) diff --git a/inbox.py b/inbox.py index 0be5f2bac..a3a9ccb0c 100644 --- a/inbox.py +++ b/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, diff --git a/languages.py b/languages.py index 905e4868a..7f367cdf8 100644 --- a/languages.py +++ b/languages.py @@ -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) diff --git a/mastoapiv1.py b/mastoapiv1.py index 38f3cb6b1..f38f34f35 100644 --- a/mastoapiv1.py +++ b/mastoapiv1.py @@ -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 = [] diff --git a/metadata.py b/metadata.py index 01533cab5..5e3d0434f 100644 --- a/metadata.py +++ b/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: diff --git a/newsdaemon.py b/newsdaemon.py index b85fcd07a..2d45f3b72 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -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 = \ " 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 += \ ' Newswire' + \ - ' ' + http_prefix + '://' + domainFull + \ + ' ' + http_prefix + '://' + domain_full + \ '/newswire.xml' + '' elif title.startswith('Site'): rssStr += \ - ' ' + domainFull + '' + \ - ' ' + http_prefix + '://' + domainFull + \ + ' ' + domain_full + '' + \ + ' ' + http_prefix + '://' + domain_full + \ '/blog/rss.xml' + '' else: rssStr += \ ' ' + translate[title] + '' + \ ' ' + \ - localActorUrl(http_prefix, nickname, domainFull) + \ + localActorUrl(http_prefix, nickname, domain_full) + \ '/rss.xml' + '' 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 + '\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 += ' ' + url + '\n' rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT") diff --git a/outbox.py b/outbox.py index 1a9695bfa..670a495b8 100644 --- a/outbox.py +++ b/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, diff --git a/person.py b/person.py index 292d5a261..550026238 100644 --- a/person.py +++ b/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 diff --git a/pgp.py b/pgp.py index 1f09b5fa1..438f4cf74 100644 --- a/pgp.py +++ b/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: diff --git a/posts.py b/posts.py index 58fa7606b..d4a478ac9 100644 --- a/posts.py +++ b/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) diff --git a/schedule.py b/schedule.py index 601532740..852f68422 100644 --- a/schedule.py +++ b/schedule.py @@ -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, diff --git a/session.py b/session.py index 00df94561..c8ecc118b 100644 --- a/session.py +++ b/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 = \ diff --git a/shares.py b/shares.py index 5a419b919..7e67e17f5 100644 --- a/shares.py +++ b/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']: diff --git a/skills.py b/skills.py index dcccea27a..dde4798b2 100644 --- a/skills.py +++ b/skills.py @@ -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: diff --git a/socnet.py b/socnet.py index a9c22d062..954ae9a45 100644 --- a/socnet.py +++ b/socnet.py @@ -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, diff --git a/speaker.py b/speaker.py index be6b7120d..9038307cc 100644 --- a/speaker.py +++ b/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) diff --git a/theme.py b/theme.py index 47f8cec30..f7ad702bf 100644 --- a/theme.py +++ b/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 diff --git a/utils.py b/utils.py index c796345fb..90a051587 100644 --- a/utils.py +++ b/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 diff --git a/webapp_about.py b/webapp_about.py index 2fa2a0fbb..9490e1fc0 100644 --- a/webapp_about.py +++ b/webapp_about.py @@ -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 += '
' + aboutText + '
' if onion_domain: diff --git a/webapp_calendar.py b/webapp_calendar.py index 28bda223a..95d64d2fa 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -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 += '

' + \ translate['Delete this event'] + '

' - postActor = getAltPath(actor, domainFull, callingDomain) + postActor = getAltPath(actor, domain_full, callingDomain) deletePostStr += \ '
\n' deletePostStr += ' 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) + '' htmlStr += \ - getLeftColumnContent(base_dir, nickname, domainFull, + getLeftColumnContent(base_dir, nickname, domain_full, http_prefix, translate, editor, artist, False, timelinePath, diff --git a/webapp_column_right.py b/webapp_column_right.py index 164345312..c8e4f53eb 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -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) + '' htmlStr += \ - getRightColumnContent(base_dir, nickname, domainFull, + getRightColumnContent(base_dir, nickname, domain_full, http_prefix, translate, moderator, editor, newswire, positive_voting, diff --git a/webapp_confirm.py b/webapp_confirm.py index 22327f113..f3a6250f0 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -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: {}, '

' + \ translate['Delete this post?'] + '

' - postActor = getAltPath(actor, domainFull, callingDomain) + postActor = getAltPath(actor, domain_full, callingDomain) deletePostStr += \ ' \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 += \ '

' + translate['Remove'] + \ ' ' + sharedItemDisplayName + ' ?

\n' - postActor = getAltPath(actor, domainFull, callingDomain) + postActor = getAltPath(actor, domain_full, callingDomain) if sharesFileType == 'shares': endpoint = 'rmshare' else: diff --git a/webapp_create_post.py b/webapp_create_post.py index 8dd2d8ca6..ca659d054 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -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 = '\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: {}, ' \n' newPostForm += \ - _htmlFollowingDataList(base_dir, nickname, domain, domainFull) + _htmlFollowingDataList(base_dir, nickname, domain, domain_full) newPostForm += '' selectedStr = '' diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index 8bc6a5e2e..683c6e6c6 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -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, ' \n' + \ ' \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 = ' \n' profileFooterStr += ' \n' profileFooterStr += \ - getRightColumnContent(base_dir, 'news', domainFull, + getRightColumnContent(base_dir, 'news', domain_full, http_prefix, translate, False, False, newswire, False, False, None, False, False, diff --git a/webapp_person_options.py b/webapp_person_options.py index afd9cca8e..8bcccc292 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -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 diff --git a/webapp_post.py b/webapp_post.py index d153caa2c..4b4488eec 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -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() + '/>
\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: {}, '

' + byText + ' @' + \ byStrHandle + '' + byTextExtra + '\n' - domainFull = getFullDomain(domain, port) + domain_full = getFullDomain(domain, port) actor = '/users/' + nickname followStr = ' \n' @@ -2042,7 +2042,7 @@ def htmlIndividualPost(cssCache: {}, followStr += \ ' \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] diff --git a/webapp_profile.py b/webapp_profile.py index eca5ef184..e91e53ee1 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -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 += '

' + displayName + '

\n' + occupationStr htmlStr += \ - '

@' + nickname + '@' + domainFull + '
\n' + '

@' + nickname + '@' + domain_full + '
\n' if joinedDate: htmlStr += \ '

' + translate['Joined'] + ' ' + \ @@ -419,7 +419,7 @@ def _getProfileHeader(base_dir: str, http_prefix: str, otherAccountsHtml = \ '

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

\n' editProfileForm += \ '

' + translate['Profile for'] + \ - ' ' + nickname + '@' + domainFull + '

' + ' ' + nickname + '@' + domain_full + '' editProfileForm += '
\n' editProfileForm += \ '
\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) diff --git a/webapp_search.py b/webapp_search.py index 5946d9805..3b70c1923 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -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: diff --git a/webapp_timeline.py b/webapp_timeline.py index 49e68c213..37d6f6b4d 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -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 += ' \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, ' \n' + \ ' \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: diff --git a/webapp_tos.py b/webapp_tos.py index 34134e709..7710dfde1 100644 --- a/webapp_tos.py +++ b/webapp_tos.py @@ -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 += '
' + TOSText + '
\n' if adminNickname: - adminActor = localActorUrl(http_prefix, adminNickname, domainFull) + adminActor = localActorUrl(http_prefix, adminNickname, domain_full) TOSForm += \ '
\n' + \ '

Administered by \n" + \ " \n" + \ - " \n" + \ " \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 += '

\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, '
\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' diff --git a/webapp_welcome_final.py b/webapp_welcome_final.py index cd145a585..934e6bff5 100644 --- a/webapp_welcome_final.py +++ b/webapp_welcome_final.py @@ -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 diff --git a/webapp_welcome_profile.py b/webapp_welcome_profile.py index 958ef5e64..1f80c339e 100644 --- a/webapp_welcome_profile.py +++ b/webapp_welcome_profile.py @@ -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 += '
' + profileText + '
\n' diff --git a/webfinger.py b/webfinger.py index ad49bf061..eea5e358a 100644 --- a/webfinger.py +++ b/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: "" + \ "" + \ - "" + domainFull + "" + \ + "" + domain_full + "" + \ "" + \ "" + \ " Resource Descriptor" + \ " " + \