mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
65e42a7c12
commit
8f97b42fd4
|
@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import hasObjectStringObject
|
from utils import hasObjectStringObject
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
|
@ -196,7 +196,7 @@ def receiveAcceptReject(session, base_dir: str,
|
||||||
return False
|
return False
|
||||||
if not hasActor(message_json, debug):
|
if not hasActor(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'] + '. Assuming single user instance.')
|
message_json['type'] + '. Assuming single user instance.')
|
||||||
|
|
|
@ -11,7 +11,7 @@ from utils import hasObjectStringObject
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
from utils import createOutboxDir
|
from utils import createOutboxDir
|
||||||
|
@ -164,7 +164,7 @@ def createAnnounce(session, base_dir: str, federation_list: [],
|
||||||
announceDomain = None
|
announceDomain = None
|
||||||
announcePort = None
|
announcePort = None
|
||||||
group_account = False
|
group_account = False
|
||||||
if hasUsersPath(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
announceNickname = getNicknameFromActor(objectUrl)
|
announceNickname = getNicknameFromActor(objectUrl)
|
||||||
announceDomain, announcePort = getDomainFromActor(objectUrl)
|
announceDomain, announcePort = getDomainFromActor(objectUrl)
|
||||||
if '/' + str(announceNickname) + '/' in objectUrl:
|
if '/' + str(announceNickname) + '/' in objectUrl:
|
||||||
|
|
4
auth.py
4
auth.py
|
@ -14,7 +14,7 @@ import os
|
||||||
import secrets
|
import secrets
|
||||||
import datetime
|
import datetime
|
||||||
from utils import isSystemAccount
|
from utils import isSystemAccount
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
|
|
||||||
|
|
||||||
def _hashPassword(password: str) -> str:
|
def _hashPassword(password: str) -> str:
|
||||||
|
@ -92,7 +92,7 @@ def authorizeBasic(base_dir: str, path: str, authHeader: str,
|
||||||
print('DEBUG: basic auth - Authorisation header does not ' +
|
print('DEBUG: basic auth - Authorisation header does not ' +
|
||||||
'contain a space character')
|
'contain a space character')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(path):
|
if not has_users_path(path):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: basic auth - ' +
|
print('DEBUG: basic auth - ' +
|
||||||
'path for Authorization does not contain a user')
|
'path for Authorization does not contain a user')
|
||||||
|
|
10
blocking.py
10
blocking.py
|
@ -22,7 +22,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import fileLastModified
|
from utils import fileLastModified
|
||||||
from utils import setConfigParam
|
from utils import setConfigParam
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import isEvil
|
from utils import isEvil
|
||||||
|
@ -437,7 +437,7 @@ def outboxBlock(base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s block object is not a status')
|
print('DEBUG: c2s block object is not a status')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(messageId):
|
if not has_users_path(messageId):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s block object has no nickname')
|
print('DEBUG: c2s block object has no nickname')
|
||||||
return False
|
return False
|
||||||
|
@ -493,7 +493,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s undo block object is not a status')
|
print('DEBUG: c2s undo block object is not a status')
|
||||||
return
|
return
|
||||||
if not hasUsersPath(messageId):
|
if not has_users_path(messageId):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s undo block object has no nickname')
|
print('DEBUG: c2s undo block object has no nickname')
|
||||||
return
|
return
|
||||||
|
@ -793,7 +793,7 @@ def outboxMute(base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s mute object is not a status')
|
print('DEBUG: c2s mute object is not a status')
|
||||||
return
|
return
|
||||||
if not hasUsersPath(messageId):
|
if not has_users_path(messageId):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s mute object has no nickname')
|
print('DEBUG: c2s mute object has no nickname')
|
||||||
return
|
return
|
||||||
|
@ -848,7 +848,7 @@ def outboxUndoMute(base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s undo mute object is not a status')
|
print('DEBUG: c2s undo mute object is not a status')
|
||||||
return
|
return
|
||||||
if not hasUsersPath(messageId):
|
if not has_users_path(messageId):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s undo mute object has no nickname')
|
print('DEBUG: c2s undo mute object has no nickname')
|
||||||
return
|
return
|
||||||
|
|
|
@ -12,7 +12,7 @@ from pprint import pprint
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from auth import createBasicAuthHeader
|
from auth import createBasicAuthHeader
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import removePostFromCache
|
from utils import removePostFromCache
|
||||||
|
@ -286,7 +286,7 @@ def bookmark(recentPostsCache: {},
|
||||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
||||||
else:
|
else:
|
||||||
if hasUsersPath(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
ou = objectUrl
|
ou = objectUrl
|
||||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
||||||
|
@ -350,7 +350,7 @@ def undoBookmark(recentPostsCache: {},
|
||||||
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
bookmarkedPostNickname = getNicknameFromActor(acBm)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(acBm)
|
||||||
else:
|
else:
|
||||||
if hasUsersPath(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
ou = objectUrl
|
ou = objectUrl
|
||||||
bookmarkedPostNickname = getNicknameFromActor(ou)
|
bookmarkedPostNickname = getNicknameFromActor(ou)
|
||||||
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
bookmarkedPostDomain, bookmarkedPostPort = getDomainFromActor(ou)
|
||||||
|
|
|
@ -271,7 +271,7 @@ from utils import getLocalNetworkAddresses
|
||||||
from utils import decodedHost
|
from utils import decodedHost
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import get_locked_account
|
from utils import get_locked_account
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import isEditor
|
from utils import isEditor
|
||||||
|
@ -3489,7 +3489,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
elif ('@' in searchStr or
|
elif ('@' in searchStr or
|
||||||
('://' in searchStr and
|
('://' in searchStr and
|
||||||
hasUsersPath(searchStr))):
|
has_users_path(searchStr))):
|
||||||
if searchStr.endswith(':') or \
|
if searchStr.endswith(':') or \
|
||||||
searchStr.endswith(';') or \
|
searchStr.endswith(';') or \
|
||||||
searchStr.endswith('.'):
|
searchStr.endswith('.'):
|
||||||
|
@ -3508,7 +3508,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# are we already following the searched for handle?
|
# are we already following the searched for handle?
|
||||||
if isFollowingActor(base_dir, nickname, domain, searchStr):
|
if isFollowingActor(base_dir, nickname, domain, searchStr):
|
||||||
if not hasUsersPath(searchStr):
|
if not has_users_path(searchStr):
|
||||||
searchNickname = getNicknameFromActor(searchStr)
|
searchNickname = getNicknameFromActor(searchStr)
|
||||||
searchDomain, searchPort = \
|
searchDomain, searchPort = \
|
||||||
getDomainFromActor(searchStr)
|
getDomainFromActor(searchStr)
|
||||||
|
@ -14807,7 +14807,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
if '/ontologies/' in self.path or \
|
if '/ontologies/' in self.path or \
|
||||||
'/data/' in self.path:
|
'/data/' in self.path:
|
||||||
if not hasUsersPath(self.path):
|
if not has_users_path(self.path):
|
||||||
self._getOntology(callingDomain,
|
self._getOntology(callingDomain,
|
||||||
self.path, self.server.base_dir,
|
self.path, self.server.base_dir,
|
||||||
GETstartTime)
|
GETstartTime)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from utils import hasObjectString
|
from utils import hasObjectString
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
|
@ -143,7 +143,7 @@ def outboxDelete(base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s delete object is not a status')
|
print('DEBUG: c2s delete object is not a status')
|
||||||
return
|
return
|
||||||
if not hasUsersPath(messageId):
|
if not has_users_path(messageId):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: c2s delete object has no nickname')
|
print('DEBUG: c2s delete object has no nickname')
|
||||||
return
|
return
|
||||||
|
|
|
@ -67,7 +67,7 @@ from auth import storeBasicCredentials
|
||||||
from auth import createPassword
|
from auth import createPassword
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import getPortFromDomain
|
from utils import getPortFromDomain
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import setConfigParam
|
from utils import setConfigParam
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
|
@ -2129,7 +2129,7 @@ if args.followers:
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
args.followers = args.followers.replace(prefix, '')
|
args.followers = args.followers.replace(prefix, '')
|
||||||
args.followers = args.followers.replace('/@', '/users/')
|
args.followers = args.followers.replace('/@', '/users/')
|
||||||
if not hasUsersPath(args.followers):
|
if not has_users_path(args.followers):
|
||||||
print('Expected actor format: ' +
|
print('Expected actor format: ' +
|
||||||
'https://domain/@nick or https://domain/users/nick')
|
'https://domain/@nick or https://domain/users/nick')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -2212,7 +2212,7 @@ if args.followers:
|
||||||
personUrl = None
|
personUrl = None
|
||||||
if wfRequest.get('errors'):
|
if wfRequest.get('errors'):
|
||||||
print('wfRequest error: ' + str(wfRequest['errors']))
|
print('wfRequest error: ' + str(wfRequest['errors']))
|
||||||
if hasUsersPath(args.followers):
|
if has_users_path(args.followers):
|
||||||
personUrl = originalActor
|
personUrl = originalActor
|
||||||
else:
|
else:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -12,7 +12,7 @@ import os
|
||||||
from utils import hasObjectStringObject
|
from utils import hasObjectStringObject
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getFollowersList
|
from utils import getFollowersList
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
|
@ -409,7 +409,7 @@ def _getNoOfFollows(base_dir: str, nickname: str, domain: str,
|
||||||
ctr += 1
|
ctr += 1
|
||||||
elif ((line.startswith('http') or
|
elif ((line.startswith('http') or
|
||||||
line.startswith('hyper')) and
|
line.startswith('hyper')) and
|
||||||
hasUsersPath(line)):
|
has_users_path(line)):
|
||||||
ctr += 1
|
ctr += 1
|
||||||
return ctr
|
return ctr
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ def getFollowingFeed(base_dir: str, domain: str, port: int, path: str,
|
||||||
following['orderedItems'].append(url)
|
following['orderedItems'].append(url)
|
||||||
elif ((line.startswith('http') or
|
elif ((line.startswith('http') or
|
||||||
line.startswith('hyper')) and
|
line.startswith('hyper')) and
|
||||||
hasUsersPath(line)):
|
has_users_path(line)):
|
||||||
# https://domain/users/nickname
|
# https://domain/users/nickname
|
||||||
pageCtr += 1
|
pageCtr += 1
|
||||||
totalCtr += 1
|
totalCtr += 1
|
||||||
|
|
32
inbox.py
32
inbox.py
|
@ -36,7 +36,7 @@ from utils import has_object_dict
|
||||||
from utils import dmAllowedFromDomain
|
from utils import dmAllowedFromDomain
|
||||||
from utils import isRecentPost
|
from utils import isRecentPost
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import validPostDate
|
from utils import validPostDate
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
|
@ -746,7 +746,7 @@ def _receiveUndoFollow(session, base_dir: str, http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: follow request has no actor within object')
|
print('DEBUG: follow request has no actor within object')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['object']['actor']):
|
if not has_users_path(message_json['object']['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing ' +
|
print('DEBUG: "users" or "profile" missing ' +
|
||||||
'from actor within object')
|
'from actor within object')
|
||||||
|
@ -807,7 +807,7 @@ def _receiveUndo(session, base_dir: str, http_prefix: str,
|
||||||
print('DEBUG: Undo activity received')
|
print('DEBUG: Undo activity received')
|
||||||
if not hasActor(message_json, debug):
|
if not hasActor(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor')
|
print('DEBUG: "users" or "profile" missing from actor')
|
||||||
return False
|
return False
|
||||||
|
@ -953,7 +953,7 @@ def _receiveUpdate(recentPostsCache: {}, session, base_dir: str,
|
||||||
return False
|
return False
|
||||||
if not hasObjectStringType(message_json, debug):
|
if not hasObjectStringType(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'])
|
message_json['type'])
|
||||||
|
@ -1021,7 +1021,7 @@ def _receiveLike(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'])
|
message_json['type'])
|
||||||
|
@ -1143,7 +1143,7 @@ def _receiveUndoLike(recentPostsCache: {},
|
||||||
return False
|
return False
|
||||||
if not hasObjectStringObject(message_json, debug):
|
if not hasObjectStringObject(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'] + ' like')
|
message_json['type'] + ' like')
|
||||||
|
@ -1267,7 +1267,7 @@ def _receiveReaction(recentPostsCache: {},
|
||||||
print('_receiveReaction: Invalid emoji reaction: "' +
|
print('_receiveReaction: Invalid emoji reaction: "' +
|
||||||
message_json['content'] + '" from ' + message_json['actor'])
|
message_json['content'] + '" from ' + message_json['actor'])
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'])
|
message_json['type'])
|
||||||
|
@ -1412,7 +1412,7 @@ def _receiveUndoReaction(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' + message_json['type'] + ' content is not string')
|
print('DEBUG: ' + message_json['type'] + ' content is not string')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'] + ' reaction')
|
message_json['type'] + ' reaction')
|
||||||
|
@ -1753,7 +1753,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' +
|
print('DEBUG: ' +
|
||||||
'"users" or "profile" missing from actor in ' +
|
'"users" or "profile" missing from actor in ' +
|
||||||
|
@ -1835,7 +1835,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
print('DEBUG: ' + message_json['type'] + ' has no "to" list')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' +
|
print('DEBUG: ' +
|
||||||
'"users" or "profile" missing from actor in ' +
|
'"users" or "profile" missing from actor in ' +
|
||||||
|
@ -1845,7 +1845,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: self-boost rejected')
|
print('DEBUG: self-boost rejected')
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['object']):
|
if not has_users_path(message_json['object']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: ' +
|
print('DEBUG: ' +
|
||||||
'"users", "channel" or "profile" missing in ' +
|
'"users", "channel" or "profile" missing in ' +
|
||||||
|
@ -1984,7 +1984,7 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
if isinstance(attrib, str):
|
if isinstance(attrib, str):
|
||||||
lookupActor = attrib
|
lookupActor = attrib
|
||||||
if lookupActor:
|
if lookupActor:
|
||||||
if hasUsersPath(lookupActor):
|
if has_users_path(lookupActor):
|
||||||
if '/statuses/' in lookupActor:
|
if '/statuses/' in lookupActor:
|
||||||
lookupActor = lookupActor.split('/statuses/')[0]
|
lookupActor = lookupActor.split('/statuses/')[0]
|
||||||
|
|
||||||
|
@ -2048,7 +2048,7 @@ def _receiveUndoAnnounce(recentPostsCache: {},
|
||||||
return False
|
return False
|
||||||
if message_json['object']['type'] != 'Announce':
|
if message_json['object']['type'] != 'Announce':
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: "users" or "profile" missing from actor in ' +
|
print('DEBUG: "users" or "profile" missing from actor in ' +
|
||||||
message_json['type'] + ' announce')
|
message_json['type'] + ' announce')
|
||||||
|
@ -2318,7 +2318,7 @@ def _obtainAvatarForReplyPost(session, base_dir: str, http_prefix: str,
|
||||||
if not isinstance(lookupActor, str):
|
if not isinstance(lookupActor, str):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not hasUsersPath(lookupActor):
|
if not has_users_path(lookupActor):
|
||||||
return
|
return
|
||||||
|
|
||||||
if '/statuses/' in lookupActor:
|
if '/statuses/' in lookupActor:
|
||||||
|
@ -3868,7 +3868,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||||
print('Receiving follow request')
|
print('Receiving follow request')
|
||||||
if not hasActor(message_json, debug):
|
if not hasActor(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not hasUsersPath(message_json['actor']):
|
if not has_users_path(message_json['actor']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: users/profile/accounts/channel missing from actor')
|
print('DEBUG: users/profile/accounts/channel missing from actor')
|
||||||
return False
|
return False
|
||||||
|
@ -3890,7 +3890,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||||
'nickname. Assuming single user instance.')
|
'nickname. Assuming single user instance.')
|
||||||
if not message_json.get('to'):
|
if not message_json.get('to'):
|
||||||
message_json['to'] = message_json['object']
|
message_json['to'] = message_json['object']
|
||||||
if not hasUsersPath(message_json['object']):
|
if not has_users_path(message_json['object']):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: users/profile/channel/accounts ' +
|
print('DEBUG: users/profile/channel/accounts ' +
|
||||||
'not found within object')
|
'not found within object')
|
||||||
|
|
4
like.py
4
like.py
|
@ -14,7 +14,7 @@ from utils import hasObjectStringObject
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
|
@ -108,7 +108,7 @@ def _like(recentPostsCache: {},
|
||||||
likedPostDomain, likedPostPort = getDomainFromActor(actorLiked)
|
likedPostDomain, likedPostPort = getDomainFromActor(actorLiked)
|
||||||
group_account = hasGroupType(base_dir, actorLiked, person_cache)
|
group_account = hasGroupType(base_dir, actorLiked, person_cache)
|
||||||
else:
|
else:
|
||||||
if hasUsersPath(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
likedPostNickname = getNicknameFromActor(objectUrl)
|
likedPostNickname = getNicknameFromActor(objectUrl)
|
||||||
likedPostDomain, likedPostPort = getDomainFromActor(objectUrl)
|
likedPostDomain, likedPostPort = getDomainFromActor(objectUrl)
|
||||||
if '/' + str(likedPostNickname) + '/' in objectUrl:
|
if '/' + str(likedPostNickname) + '/' in objectUrl:
|
||||||
|
|
|
@ -52,7 +52,7 @@ from utils import setConfigParam
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import refresh_newswire
|
from utils import refresh_newswire
|
||||||
from utils import getProtocolPrefixes
|
from utils import getProtocolPrefixes
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import isImageFile
|
from utils import isImageFile
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
|
@ -1450,7 +1450,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
||||||
group_account = True
|
group_account = True
|
||||||
# format: https://domain/@nick
|
# format: https://domain/@nick
|
||||||
originalHandle = handle
|
originalHandle = handle
|
||||||
if not hasUsersPath(originalHandle):
|
if not has_users_path(originalHandle):
|
||||||
if not quiet or debug:
|
if not quiet or debug:
|
||||||
print('getActorJson: Expected actor format: ' +
|
print('getActorJson: Expected actor format: ' +
|
||||||
'https://domain/@nick or https://domain' +
|
'https://domain/@nick or https://domain' +
|
||||||
|
@ -1556,7 +1556,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool,
|
||||||
if not quiet or debug:
|
if not quiet or debug:
|
||||||
print('getActorJson wfRequest error: ' +
|
print('getActorJson wfRequest error: ' +
|
||||||
str(wfRequest['errors']))
|
str(wfRequest['errors']))
|
||||||
if hasUsersPath(handle):
|
if has_users_path(handle):
|
||||||
personUrl = originalActor
|
personUrl = originalActor
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
|
|
8
posts.py
8
posts.py
|
@ -46,7 +46,7 @@ from utils import rejectPostId
|
||||||
from utils import removeInvalidChars
|
from utils import removeInvalidChars
|
||||||
from utils import fileLastModified
|
from utils import fileLastModified
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import validPostDate
|
from utils import validPostDate
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import getFollowersList
|
from utils import getFollowersList
|
||||||
|
@ -216,7 +216,7 @@ def getUserUrl(wfRequest: {}, sourceId: int, debug: bool) -> str:
|
||||||
if link['type'] != 'application/activity+json':
|
if link['type'] != 'application/activity+json':
|
||||||
continue
|
continue
|
||||||
if '/@' not in link['href']:
|
if '/@' not in link['href']:
|
||||||
if debug and not hasUsersPath(link['href']):
|
if debug and not has_users_path(link['href']):
|
||||||
print('getUserUrl webfinger activity+json ' +
|
print('getUserUrl webfinger activity+json ' +
|
||||||
'contains single user instance actor ' +
|
'contains single user instance actor ' +
|
||||||
str(sourceId) + ' ' + str(link))
|
str(sourceId) + ' ' + str(link))
|
||||||
|
@ -4636,7 +4636,7 @@ def downloadAnnounce(session, base_dir: str, http_prefix: str,
|
||||||
base_dir, nickname, domain, postId,
|
base_dir, nickname, domain, postId,
|
||||||
recentPostsCache)
|
recentPostsCache)
|
||||||
return None
|
return None
|
||||||
if not hasUsersPath(announcedJson['id']):
|
if not has_users_path(announcedJson['id']):
|
||||||
_rejectAnnounce(announceFilename,
|
_rejectAnnounce(announceFilename,
|
||||||
base_dir, nickname, domain, postId,
|
base_dir, nickname, domain, postId,
|
||||||
recentPostsCache)
|
recentPostsCache)
|
||||||
|
@ -5299,7 +5299,7 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, base_dir: str,
|
||||||
url = origPostId
|
url = origPostId
|
||||||
else:
|
else:
|
||||||
# we don't have the original post
|
# we don't have the original post
|
||||||
if hasUsersPath(origPostId):
|
if has_users_path(origPostId):
|
||||||
# get the actor from the original post url
|
# get the actor from the original post url
|
||||||
origNick = getNicknameFromActor(origPostId)
|
origNick = getNicknameFromActor(origPostId)
|
||||||
origDomain, origPort = getDomainFromActor(origPostId)
|
origDomain, origPort = getDomainFromActor(origPostId)
|
||||||
|
|
|
@ -16,7 +16,7 @@ from utils import hasObjectStringObject
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import hasUsersPath
|
from utils import has_users_path
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
|
@ -106,7 +106,7 @@ def _reaction(recentPostsCache: {},
|
||||||
getDomainFromActor(actorReaction)
|
getDomainFromActor(actorReaction)
|
||||||
group_account = hasGroupType(base_dir, actorReaction, person_cache)
|
group_account = hasGroupType(base_dir, actorReaction, person_cache)
|
||||||
else:
|
else:
|
||||||
if hasUsersPath(objectUrl):
|
if has_users_path(objectUrl):
|
||||||
reactionPostNickname = getNicknameFromActor(objectUrl)
|
reactionPostNickname = getNicknameFromActor(objectUrl)
|
||||||
reactionPostDomain, reactionPostPort = \
|
reactionPostDomain, reactionPostPort = \
|
||||||
getDomainFromActor(objectUrl)
|
getDomainFromActor(objectUrl)
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -191,7 +191,7 @@ def get_locked_account(actor_json: {}) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def hasUsersPath(pathStr: str) -> bool:
|
def has_users_path(pathStr: str) -> bool:
|
||||||
"""Whether there is a /users/ path (or equivalent) in the given string
|
"""Whether there is a /users/ path (or equivalent) in the given string
|
||||||
"""
|
"""
|
||||||
usersList = getUserPaths()
|
usersList = getUserPaths()
|
||||||
|
|
Loading…
Reference in New Issue