mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
1b64e604ca
commit
b8a3176154
|
@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
|
|||
|
||||
from utils import has_object_string_object
|
||||
from utils import has_group_type
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import removeIdEnding
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -133,7 +133,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
|||
if not urlPermitted(objectUrl, federation_list):
|
||||
return None
|
||||
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
fullDomain = get_full_domain(domain, port)
|
||||
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
@ -408,7 +408,7 @@ def outboxUndoAnnounce(recentPostsCache: {},
|
|||
print('DEBUG: c2s undo announce request arrived in outbox')
|
||||
|
||||
messageId = removeIdEnding(message_json['object']['object'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
|
14
blocking.py
14
blocking.py
|
@ -14,7 +14,7 @@ from datetime import datetime
|
|||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_object_dict
|
||||
from utils import isAccountDir
|
||||
from utils import getCachedPostFilename
|
||||
|
@ -79,7 +79,7 @@ def addBlock(base_dir: str, nickname: str, domain: str,
|
|||
# don't block self
|
||||
return False
|
||||
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
blockingFilename = acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||
blockHandle = blockNickname + '@' + blockDomain
|
||||
if os.path.isfile(blockingFilename):
|
||||
|
@ -202,7 +202,7 @@ def removeBlock(base_dir: str, nickname: str, domain: str,
|
|||
unblockNickname: str, unblockDomain: str) -> bool:
|
||||
"""Unblock the given account
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
unblockingFilename = acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||
unblockHandle = unblockNickname + '@' + unblockDomain
|
||||
if os.path.isfile(unblockingFilename):
|
||||
|
@ -441,7 +441,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: c2s block object has no nickname')
|
||||
return False
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -497,7 +497,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: c2s undo block object has no nickname')
|
||||
return
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -797,7 +797,7 @@ def outboxMute(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: c2s mute object has no nickname')
|
||||
return
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -852,7 +852,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
|
|||
if debug:
|
||||
print('DEBUG: c2s undo mute object has no nickname')
|
||||
return
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
from pprint import pprint
|
||||
from webfinger import webfingerHandle
|
||||
from auth import createBasicAuthHeader
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
from utils import removeIdEnding
|
||||
|
@ -592,7 +592,7 @@ def outboxBookmark(recentPostsCache: {},
|
|||
print('DEBUG: c2s bookmark Add request arrived in outbox')
|
||||
|
||||
messageUrl = removeIdEnding(message_json['object']['url'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageUrl)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -648,7 +648,7 @@ def outboxUndoBookmark(recentPostsCache: {},
|
|||
print('DEBUG: c2s unbookmark Remove request arrived in outbox')
|
||||
|
||||
messageUrl = removeIdEnding(message_json['object']['url'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageUrl)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
|
|
@ -12,7 +12,7 @@ import email.parser
|
|||
import urllib.parse
|
||||
from shutil import copyfile
|
||||
from utils import dangerousSVG
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import isValidLanguage
|
||||
from utils import get_image_extensions
|
||||
from utils import load_json
|
||||
|
@ -855,7 +855,7 @@ def addHtmlTags(base_dir: str, http_prefix: str,
|
|||
replaceEmoji = {}
|
||||
emojiDict = {}
|
||||
originalDomain = domain
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||
|
||||
# read the following list so that we can detect just @nick
|
||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "ActivityPub"
|
|||
import os
|
||||
from datetime import datetime
|
||||
from utils import has_object_string
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
from utils import removeIdEnding
|
||||
|
@ -154,7 +154,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
|
|||
"wasn't created by you (nickname does not match)")
|
||||
return
|
||||
deleteDomain, deletePort = getDomainFromActor(messageId)
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
if deleteDomain != domain:
|
||||
if debug:
|
||||
print("DEBUG: you can't delete a post which " +
|
||||
|
|
|
@ -65,7 +65,7 @@ from tests import testUpdateActor
|
|||
from tests import runAllTests
|
||||
from auth import storeBasicCredentials
|
||||
from auth import createPassword
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import get_port_from_domain
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -1278,7 +1278,7 @@ if args.message:
|
|||
toPort = 443
|
||||
if ':' in toDomain:
|
||||
toPort = get_port_from_domain(toDomain)
|
||||
toDomain = removeDomainPort(toDomain)
|
||||
toDomain = remove_domain_port(toDomain)
|
||||
else:
|
||||
if args.sendto.endswith('followers'):
|
||||
toNickname = None
|
||||
|
|
14
follow.py
14
follow.py
|
@ -11,7 +11,7 @@ from pprint import pprint
|
|||
import os
|
||||
from utils import has_object_string_object
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
from utils import getFollowersList
|
||||
|
@ -169,7 +169,7 @@ def isFollowingActor(base_dir: str,
|
|||
"""Is the given nickname following the given actor?
|
||||
The actor can also be a handle: nickname@domain
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
handle = nickname + '@' + domain
|
||||
if not os.path.isdir(base_dir + '/accounts/' + handle):
|
||||
return False
|
||||
|
@ -221,7 +221,7 @@ def followerOfPerson(base_dir: str, nickname: str, domain: str,
|
|||
def getFollowerDomains(base_dir: str, nickname: str, domain: str) -> []:
|
||||
"""Returns a list of domains for followers
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
followersFile = acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||
if not os.path.isfile(followersFile):
|
||||
return []
|
||||
|
@ -254,7 +254,7 @@ def isFollowerOfPerson(base_dir: str, nickname: str, domain: str,
|
|||
if not followerNickname:
|
||||
print('No followerNickname for ' + followerDomain)
|
||||
return False
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
followersFile = acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||
if not os.path.isfile(followersFile):
|
||||
return False
|
||||
|
@ -288,7 +288,7 @@ def unfollowAccount(base_dir: str, nickname: str, domain: str,
|
|||
followFile: str = 'following.txt') -> bool:
|
||||
"""Removes a person to the follow list
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
handle = nickname + '@' + domain
|
||||
handleToUnfollow = followNickname + '@' + followDomain
|
||||
if group_account:
|
||||
|
@ -503,7 +503,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
|||
}
|
||||
|
||||
handleDomain = domain
|
||||
handleDomain = removeDomainPort(handleDomain)
|
||||
handleDomain = remove_domain_port(handleDomain)
|
||||
handle = nickname + '@' + handleDomain
|
||||
filename = base_dir + '/accounts/' + handle + '/' + followFile + '.txt'
|
||||
if not os.path.isfile(filename):
|
||||
|
@ -570,7 +570,7 @@ def followApprovalRequired(base_dir: str, nicknameToFollow: str,
|
|||
return False
|
||||
|
||||
manuallyApproveFollows = False
|
||||
domainToFollow = removeDomainPort(domainToFollow)
|
||||
domainToFollow = remove_domain_port(domainToFollow)
|
||||
actorFilename = base_dir + '/accounts/' + \
|
||||
nicknameToFollow + '@' + domainToFollow + '.json'
|
||||
if os.path.isfile(actorFilename):
|
||||
|
|
|
@ -17,7 +17,7 @@ def _dirAcct(base_dir: str, nickname: str, domain: str) -> str:
|
|||
def _portDomainRemove(domain: str) -> str:
|
||||
"""If the domain has a port appended then remove it
|
||||
eg. mydomain.com:80 becomes mydomain.com
|
||||
same as removeDomainPort in utils.py
|
||||
same as remove_domain_port in utils.py
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
|
|
18
inbox.py
18
inbox.py
|
@ -30,7 +30,7 @@ from utils import canReplyTo
|
|||
from utils import get_user_paths
|
||||
from utils import get_base_content_from_post
|
||||
from utils import acct_dir
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import get_port_from_domain
|
||||
from utils import has_object_dict
|
||||
from utils import dmAllowedFromDomain
|
||||
|
@ -324,7 +324,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, max_recent_posts: int,
|
|||
def validInbox(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
"""Checks whether files were correctly saved to the inbox
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
inboxDir = acct_dir(base_dir, nickname, domain) + '/inbox'
|
||||
if not os.path.isdir(inboxDir):
|
||||
return True
|
||||
|
@ -346,7 +346,7 @@ def validInboxFilenames(base_dir: str, nickname: str, domain: str,
|
|||
"""Used by unit tests to check that the port number gets appended to
|
||||
domain names within saved post filenames
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
inboxDir = acct_dir(base_dir, nickname, domain) + '/inbox'
|
||||
if not os.path.isdir(inboxDir):
|
||||
print('Not an inbox directory: ' + inboxDir)
|
||||
|
@ -465,7 +465,7 @@ def savePostToInboxQueue(base_dir: str, http_prefix: str,
|
|||
str(len(messageBytes)) + ' bytes')
|
||||
return None
|
||||
originalDomain = domain
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
|
||||
# block at the ealiest stage possible, which means the data
|
||||
# isn't written to file
|
||||
|
@ -644,7 +644,7 @@ def _inboxPostRecipients(base_dir: str, post_json_object: {},
|
|||
print('WARNING: inbox post has no actor')
|
||||
return recipientsDict, recipientsDictFollowers
|
||||
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
domainBase = domain
|
||||
domain = get_full_domain(domain, port)
|
||||
domainMatch = '/' + domain + '/users/'
|
||||
|
@ -1564,7 +1564,7 @@ def _receiveBookmark(recentPostsCache: {},
|
|||
print('DEBUG: c2s inbox bookmark Add request arrived in outbox')
|
||||
|
||||
messageUrl = removeIdEnding(message_json['object']['url'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageUrl)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -1677,7 +1677,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
|
|||
'request arrived in outbox')
|
||||
|
||||
messageUrl = removeIdEnding(message_json['object']['url'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageUrl)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -2770,7 +2770,7 @@ def _updateLastSeen(base_dir: str, handle: str, actor: str) -> None:
|
|||
return
|
||||
nickname = handle.split('@')[0]
|
||||
domain = handle.split('@')[1]
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
accountPath = acct_dir(base_dir, nickname, domain)
|
||||
if not os.path.isdir(accountPath):
|
||||
return
|
||||
|
@ -2831,7 +2831,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
|
|||
senderPort = port
|
||||
if ':' in senderDomain:
|
||||
senderPort = get_port_from_domain(senderDomain)
|
||||
senderDomain = removeDomainPort(senderDomain)
|
||||
senderDomain = remove_domain_port(senderDomain)
|
||||
cc = []
|
||||
|
||||
# create the bounce DM
|
||||
|
|
6
like.py
6
like.py
|
@ -12,7 +12,7 @@ from pprint import pprint
|
|||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_object_dict
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -359,7 +359,7 @@ def outboxLike(recentPostsCache: {},
|
|||
print('DEBUG: c2s like request arrived in outbox')
|
||||
|
||||
messageId = removeIdEnding(message_json['object'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
@ -396,7 +396,7 @@ def outboxUndoLike(recentPostsCache: {},
|
|||
print('DEBUG: c2s undo like request arrived in outbox')
|
||||
|
||||
messageId = removeIdEnding(message_json['object']['object'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
|
|
@ -12,7 +12,7 @@ from follow import followedAccountAccepts
|
|||
from follow import followedAccountRejects
|
||||
from follow import removeFromFollowRequests
|
||||
from utils import load_json
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import get_port_from_domain
|
||||
from utils import get_user_paths
|
||||
from utils import acct_dir
|
||||
|
@ -58,7 +58,7 @@ def manualDenyFollowRequest(session, base_dir: str,
|
|||
denyPort = port
|
||||
if ':' in denyDomain:
|
||||
denyPort = get_port_from_domain(denyDomain)
|
||||
denyDomain = removeDomainPort(denyDomain)
|
||||
denyDomain = remove_domain_port(denyDomain)
|
||||
followedAccountRejects(session, base_dir, http_prefix,
|
||||
nickname, domain, port,
|
||||
denyNickname, denyDomain, denyPort,
|
||||
|
@ -202,7 +202,8 @@ def manualApproveFollowRequest(session, base_dir: str,
|
|||
if ':' in approveDomain:
|
||||
approvePort = \
|
||||
get_port_from_domain(approveDomain)
|
||||
approveDomain = removeDomainPort(approveDomain)
|
||||
approveDomain = \
|
||||
remove_domain_port(approveDomain)
|
||||
print('Manual follow accept: Sending Accept for ' +
|
||||
handle + ' follow request from ' +
|
||||
approveNickname + '@' + approveDomain)
|
||||
|
|
|
@ -8,7 +8,7 @@ __status__ = "Production"
|
|||
__module_group__ = "Calendar"
|
||||
|
||||
import os
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import acct_dir
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ def _notifyOnPostArrival(base_dir: str, nickname: str, domain: str,
|
|||
indicating whether to notify when a new post arrives from that account
|
||||
"""
|
||||
# check that a following file exists
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||
if not os.path.isfile(followingFilename):
|
||||
print("WARN: following.txt doesn't exist for " +
|
||||
|
|
|
@ -42,7 +42,7 @@ from utils import removeHtml
|
|||
from utils import containsInvalidChars
|
||||
from utils import replace_users_with_at
|
||||
from utils import remove_line_endings
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import getStatusNumber
|
||||
from utils import get_full_domain
|
||||
from utils import validNickname
|
||||
|
@ -107,7 +107,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
|
|||
if image_filename.startswith('~/'):
|
||||
image_filename = image_filename.replace('~/', str(Path.home()) + '/')
|
||||
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
fullDomain = get_full_domain(domain, port)
|
||||
|
||||
handle = nickname + '@' + domain
|
||||
|
@ -167,7 +167,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
|
|||
def _accountExists(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
"""Returns true if the given account exists
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
accountDir = acct_dir(base_dir, nickname, domain)
|
||||
return os.path.isdir(accountDir) or \
|
||||
os.path.isdir(base_dir + '/deactivated/' + nickname + '@' + domain)
|
||||
|
@ -885,7 +885,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
|
|||
return None
|
||||
if not isSharedInbox and not validNickname(domain, nickname):
|
||||
return None
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
handle = nickname + '@' + domain
|
||||
filename = base_dir + '/accounts/' + handle + '.json'
|
||||
if not os.path.isfile(filename):
|
||||
|
|
8
posts.py
8
posts.py
|
@ -39,7 +39,7 @@ from utils import removeIdEnding
|
|||
from utils import replace_users_with_at
|
||||
from utils import has_group_type
|
||||
from utils import get_base_content_from_post
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import get_port_from_domain
|
||||
from utils import has_object_dict
|
||||
from utils import rejectPostId
|
||||
|
@ -916,7 +916,7 @@ def savePostToBox(base_dir: str, http_prefix: str, postId: str,
|
|||
boxname != 'scheduled':
|
||||
return None
|
||||
originalDomain = domain
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
|
||||
if not postId:
|
||||
statusNumber, published = getStatusNumber()
|
||||
|
@ -2036,7 +2036,7 @@ def getMentionedPeople(base_dir: str, http_prefix: str,
|
|||
mentionedNickname = handle.split('@')[0]
|
||||
mentionedDomain = handle.split('@')[1].strip('\n').strip('\r')
|
||||
if ':' in mentionedDomain:
|
||||
mentionedDomain = removeDomainPort(mentionedDomain)
|
||||
mentionedDomain = remove_domain_port(mentionedDomain)
|
||||
if not validNickname(mentionedDomain, mentionedNickname):
|
||||
continue
|
||||
actor = \
|
||||
|
@ -3172,7 +3172,7 @@ def sendToFollowers(session, base_dir: str,
|
|||
toDomain = followerHandles[index].split('@')[1]
|
||||
if ':' in toDomain:
|
||||
toPort = get_port_from_domain(toDomain)
|
||||
toDomain = removeDomainPort(toDomain)
|
||||
toDomain = remove_domain_port(toDomain)
|
||||
|
||||
cc = ''
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from pprint import pprint
|
|||
from utils import has_object_string
|
||||
from utils import has_object_string_object
|
||||
from utils import has_object_stringType
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import has_object_dict
|
||||
from utils import has_users_path
|
||||
from utils import get_full_domain
|
||||
|
@ -382,7 +382,7 @@ def outboxReaction(recentPostsCache: {},
|
|||
print('DEBUG: c2s reaction request arrived in outbox')
|
||||
|
||||
messageId = removeIdEnding(message_json['object'])
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
emojiContent = message_json['content']
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
|
@ -425,7 +425,7 @@ def outboxUndoReaction(recentPostsCache: {},
|
|||
|
||||
messageId = removeIdEnding(message_json['object']['object'])
|
||||
emojiContent = message_json['object']['content']
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
postFilename = locatePost(base_dir, nickname, domain, messageId)
|
||||
if not postFilename:
|
||||
if debug:
|
||||
|
|
4
roles.py
4
roles.py
|
@ -11,7 +11,7 @@ import os
|
|||
from utils import load_json
|
||||
from utils import save_json
|
||||
from utils import getStatusNumber
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import acct_dir
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ def _addRole(base_dir: str, nickname: str, domain: str,
|
|||
"""Adds a role nickname to the file.
|
||||
This is a file containing the nicknames of accounts having this role
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
roleFile = base_dir + '/accounts/' + roleFilename
|
||||
if os.path.isfile(roleFile):
|
||||
# is this nickname already in the file?
|
||||
|
|
|
@ -31,7 +31,7 @@ from utils import validNickname
|
|||
from utils import load_json
|
||||
from utils import save_json
|
||||
from utils import get_image_extensions
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import isAccountDir
|
||||
from utils import acct_dir
|
||||
from utils import is_float
|
||||
|
@ -415,7 +415,7 @@ def _expireSharesForAccount(base_dir: str, nickname: str, domain: str,
|
|||
sharesFileType: str) -> None:
|
||||
"""Removes expired items from shares for a particular account
|
||||
"""
|
||||
handleDomain = removeDomainPort(domain)
|
||||
handleDomain = remove_domain_port(domain)
|
||||
handle = nickname + '@' + handleDomain
|
||||
sharesFilename = \
|
||||
base_dir + '/accounts/' + handle + '/' + sharesFileType + '.json'
|
||||
|
@ -488,7 +488,7 @@ def getSharesFeedForPerson(base_dir: str,
|
|||
|
||||
domain = get_full_domain(domain, port)
|
||||
|
||||
handleDomain = removeDomainPort(domain)
|
||||
handleDomain = remove_domain_port(domain)
|
||||
sharesFilename = \
|
||||
acct_dir(base_dir, nickname, handleDomain) + '/' + \
|
||||
sharesFileType + '.json'
|
||||
|
|
14
utils.py
14
utils.py
|
@ -573,7 +573,7 @@ def getFollowersOfPerson(base_dir: str,
|
|||
Used by the shared inbox to know who to send incoming mail to
|
||||
"""
|
||||
followers = []
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
handle = nickname + '@' + domain
|
||||
if not os.path.isdir(base_dir + '/accounts/' + handle):
|
||||
return followers
|
||||
|
@ -814,7 +814,7 @@ def createInboxQueueDir(nickname: str, domain: str, base_dir: str) -> str:
|
|||
def domainPermitted(domain: str, federation_list: []):
|
||||
if len(federation_list) == 0:
|
||||
return True
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
if domain in federation_list:
|
||||
return True
|
||||
return False
|
||||
|
@ -1098,7 +1098,7 @@ def getDomainFromActor(actor: str) -> (str, int):
|
|||
domain = domain.split('/')[0]
|
||||
if ':' in domain:
|
||||
port = get_port_from_domain(domain)
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
return domain, port
|
||||
|
||||
|
||||
|
@ -1107,7 +1107,7 @@ def _setDefaultPetName(base_dir: str, nickname: str, domain: str,
|
|||
"""Sets a default petname
|
||||
This helps especially when using onion or i2p address
|
||||
"""
|
||||
domain = removeDomainPort(domain)
|
||||
domain = remove_domain_port(domain)
|
||||
userPath = acct_dir(base_dir, nickname, domain)
|
||||
petnamesFilename = userPath + '/petnames.txt'
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ def followPerson(base_dir: str, nickname: str, domain: str,
|
|||
print('DEBUG: follow of domain ' + followDomain)
|
||||
|
||||
if ':' in domain:
|
||||
domainOnly = removeDomainPort(domain)
|
||||
domainOnly = remove_domain_port(domain)
|
||||
handle = nickname + '@' + domainOnly
|
||||
else:
|
||||
handle = nickname + '@' + domain
|
||||
|
@ -1160,7 +1160,7 @@ def followPerson(base_dir: str, nickname: str, domain: str,
|
|||
return False
|
||||
|
||||
if ':' in followDomain:
|
||||
followDomainOnly = removeDomainPort(followDomain)
|
||||
followDomainOnly = remove_domain_port(followDomain)
|
||||
handleToFollow = followNickname + '@' + followDomainOnly
|
||||
else:
|
||||
handleToFollow = followNickname + '@' + followDomain
|
||||
|
@ -2909,7 +2909,7 @@ def getActorPropertyUrl(actor_json: {}, propertyName: str) -> str:
|
|||
return ''
|
||||
|
||||
|
||||
def removeDomainPort(domain: str) -> str:
|
||||
def remove_domain_port(domain: str) -> str:
|
||||
"""If the domain has a port appended then remove it
|
||||
eg. mydomain.com:80 becomes mydomain.com
|
||||
"""
|
||||
|
|
|
@ -18,7 +18,7 @@ from utils import locatePost
|
|||
from utils import load_json
|
||||
from utils import weekDayOfMonthStart
|
||||
from utils import getAltPath
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import acct_dir
|
||||
from utils import local_actor_url
|
||||
from utils import replace_users_with_at
|
||||
|
@ -249,7 +249,7 @@ def htmlCalendar(person_cache: {}, cssCache: {}, translate: {},
|
|||
text_mode_banner: str, accessKeys: {}) -> str:
|
||||
"""Show the calendar for a person
|
||||
"""
|
||||
domain = removeDomainPort(domain_full)
|
||||
domain = remove_domain_port(domain_full)
|
||||
|
||||
monthNumber = 0
|
||||
dayNumber = None
|
||||
|
|
|
@ -12,7 +12,7 @@ from utils import get_config_param
|
|||
from utils import getNicknameFromActor
|
||||
from utils import is_editor
|
||||
from utils import is_artist
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import local_actor_url
|
||||
from webapp_utils import sharesTimelineJson
|
||||
from webapp_utils import htmlPostSeparator
|
||||
|
@ -125,7 +125,7 @@ def getLeftColumnContent(base_dir: str, nickname: str, domain_full: str,
|
|||
htmlStr = ''
|
||||
|
||||
separatorStr = htmlPostSeparator(base_dir, 'left')
|
||||
domain = removeDomainPort(domain_full)
|
||||
domain = remove_domain_port(domain_full)
|
||||
|
||||
editImageClass = ''
|
||||
if showHeaderImage:
|
||||
|
@ -374,7 +374,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
|
|||
editor = is_editor(base_dir, nickname)
|
||||
artist = is_artist(base_dir, nickname)
|
||||
|
||||
domain = removeDomainPort(domain_full)
|
||||
domain = remove_domain_port(domain_full)
|
||||
|
||||
instanceTitle = \
|
||||
get_config_param(base_dir, 'instanceTitle')
|
||||
|
|
|
@ -20,7 +20,7 @@ from utils import votesOnNewswireItem
|
|||
from utils import getNicknameFromActor
|
||||
from utils import is_editor
|
||||
from utils import get_config_param
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import acct_dir
|
||||
from posts import isModerator
|
||||
from newswire import getNewswireFaviconUrl
|
||||
|
@ -65,7 +65,7 @@ def getRightColumnContent(base_dir: str, nickname: str, domain_full: str,
|
|||
"""
|
||||
htmlStr = ''
|
||||
|
||||
domain = removeDomainPort(domain_full)
|
||||
domain = remove_domain_port(domain_full)
|
||||
|
||||
if authorized:
|
||||
# only show the publish button if logged in, otherwise replace it with
|
||||
|
|
|
@ -17,7 +17,7 @@ from utils import load_json
|
|||
from utils import load_json_onionify
|
||||
from utils import save_json
|
||||
from utils import getProtocolPrefixes
|
||||
from utils import removeDomainPort
|
||||
from utils import remove_domain_port
|
||||
from utils import get_user_paths
|
||||
from utils import get_group_paths
|
||||
from utils import local_actor_url
|
||||
|
@ -75,7 +75,7 @@ def webfingerHandle(session, handle: str, http_prefix: str,
|
|||
nickname, domain, grpAccount = _parseHandle(handle)
|
||||
if not nickname:
|
||||
return None
|
||||
wfDomain = removeDomainPort(domain)
|
||||
wfDomain = remove_domain_port(domain)
|
||||
|
||||
wfHandle = nickname + '@' + wfDomain
|
||||
wf = getWebfingerFromCache(wfHandle, cached_webfingers)
|
||||
|
|
Loading…
Reference in New Issue