mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
098d3eec30
commit
a7c1c5272b
|
@ -18474,7 +18474,7 @@ def runDaemon(content_license_url: str,
|
||||||
port: int = 80, proxy_port: int = 80,
|
port: int = 80, proxy_port: int = 80,
|
||||||
http_prefix: str = 'https',
|
http_prefix: str = 'https',
|
||||||
fed_list: [] = [],
|
fed_list: [] = [],
|
||||||
maxMentions: int = 10, maxEmoji: int = 10,
|
max_mentions: int = 10, maxEmoji: int = 10,
|
||||||
secureMode: bool = False,
|
secureMode: bool = False,
|
||||||
proxyType: str = None, maxReplies: int = 64,
|
proxyType: str = None, maxReplies: int = 64,
|
||||||
domainMaxPostsPerDay: int = 8640,
|
domainMaxPostsPerDay: int = 8640,
|
||||||
|
@ -18931,7 +18931,7 @@ def runDaemon(content_license_url: str,
|
||||||
domainMaxPostsPerDay,
|
domainMaxPostsPerDay,
|
||||||
accountMaxPostsPerDay,
|
accountMaxPostsPerDay,
|
||||||
allowDeletion, debug,
|
allowDeletion, debug,
|
||||||
maxMentions, maxEmoji,
|
max_mentions, maxEmoji,
|
||||||
httpd.translate, unitTest,
|
httpd.translate, unitTest,
|
||||||
httpd.yt_replace_domain,
|
httpd.yt_replace_domain,
|
||||||
httpd.twitter_replacement_domain,
|
httpd.twitter_replacement_domain,
|
||||||
|
|
|
@ -558,7 +558,7 @@ parser.add_argument("-c", "--client", type=str2bool, nargs='?',
|
||||||
help="Use as an ActivityPub client")
|
help="Use as an ActivityPub client")
|
||||||
parser.add_argument('--maxreplies', dest='maxReplies', type=int, default=64,
|
parser.add_argument('--maxreplies', dest='maxReplies', type=int, default=64,
|
||||||
help='Maximum number of replies to a post')
|
help='Maximum number of replies to a post')
|
||||||
parser.add_argument('--maxMentions', '--hellthread', dest='maxMentions',
|
parser.add_argument('--max_mentions', '--hellthread', dest='max_mentions',
|
||||||
type=int, default=10,
|
type=int, default=10,
|
||||||
help='Maximum number of mentions within a post')
|
help='Maximum number of mentions within a post')
|
||||||
parser.add_argument('--maxEmoji', '--maxemoji', dest='maxEmoji',
|
parser.add_argument('--maxEmoji', '--maxemoji', dest='maxEmoji',
|
||||||
|
@ -2998,8 +2998,8 @@ if args.testdata:
|
||||||
|
|
||||||
# set a lower bound to the maximum mentions
|
# set a lower bound to the maximum mentions
|
||||||
# so that it can't be accidentally set to zero and disable replies
|
# so that it can't be accidentally set to zero and disable replies
|
||||||
if args.maxMentions < 4:
|
if args.max_mentions < 4:
|
||||||
args.maxMentions = 4
|
args.max_mentions = 4
|
||||||
|
|
||||||
registration = getConfigParam(base_dir, 'registration')
|
registration = getConfigParam(base_dir, 'registration')
|
||||||
if not registration:
|
if not registration:
|
||||||
|
@ -3251,7 +3251,7 @@ if __name__ == "__main__":
|
||||||
args.yt_replace_domain,
|
args.yt_replace_domain,
|
||||||
args.twitter_replacement_domain,
|
args.twitter_replacement_domain,
|
||||||
port, proxy_port, http_prefix,
|
port, proxy_port, http_prefix,
|
||||||
federationList, args.maxMentions,
|
federationList, args.max_mentions,
|
||||||
args.maxEmoji, args.secureMode,
|
args.maxEmoji, args.secureMode,
|
||||||
proxyType, args.maxReplies,
|
proxyType, args.maxReplies,
|
||||||
args.domainMaxPostsPerDay,
|
args.domainMaxPostsPerDay,
|
||||||
|
|
14
inbox.py
14
inbox.py
|
@ -2185,7 +2185,7 @@ def _estimateNumberOfEmoji(content: str) -> int:
|
||||||
|
|
||||||
|
|
||||||
def _validPostContent(base_dir: str, nickname: str, domain: str,
|
def _validPostContent(base_dir: str, nickname: str, domain: str,
|
||||||
messageJson: {}, maxMentions: int, maxEmoji: int,
|
messageJson: {}, max_mentions: int, maxEmoji: int,
|
||||||
allow_local_network_access: bool, debug: bool,
|
allow_local_network_access: bool, debug: bool,
|
||||||
systemLanguage: str,
|
systemLanguage: str,
|
||||||
http_prefix: str, domainFull: str,
|
http_prefix: str, domainFull: str,
|
||||||
|
@ -2238,7 +2238,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
# check (rough) number of mentions
|
# check (rough) number of mentions
|
||||||
mentionsEst = _estimateNumberOfMentions(contentStr)
|
mentionsEst = _estimateNumberOfMentions(contentStr)
|
||||||
if mentionsEst > maxMentions:
|
if mentionsEst > max_mentions:
|
||||||
if messageJson['object'].get('id'):
|
if messageJson['object'].get('id'):
|
||||||
print('REJECT HELLTHREAD: ' + messageJson['object']['id'])
|
print('REJECT HELLTHREAD: ' + messageJson['object']['id'])
|
||||||
print('REJECT HELLTHREAD: Too many mentions in post - ' +
|
print('REJECT HELLTHREAD: Too many mentions in post - ' +
|
||||||
|
@ -2255,7 +2255,7 @@ def _validPostContent(base_dir: str, nickname: str, domain: str,
|
||||||
if not isinstance(messageJson['object']['tag'], list):
|
if not isinstance(messageJson['object']['tag'], list):
|
||||||
messageJson['object']['tag'] = []
|
messageJson['object']['tag'] = []
|
||||||
else:
|
else:
|
||||||
if len(messageJson['object']['tag']) > int(maxMentions * 2):
|
if len(messageJson['object']['tag']) > int(max_mentions * 2):
|
||||||
if messageJson['object'].get('id'):
|
if messageJson['object'].get('id'):
|
||||||
print('REJECT: ' + messageJson['object']['id'])
|
print('REJECT: ' + messageJson['object']['id'])
|
||||||
print('REJECT: Too many tags in post - ' +
|
print('REJECT: Too many tags in post - ' +
|
||||||
|
@ -3186,7 +3186,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
||||||
federationList: [], debug: bool,
|
federationList: [], debug: bool,
|
||||||
queueFilename: str, destinationFilename: str,
|
queueFilename: str, destinationFilename: str,
|
||||||
maxReplies: int, allowDeletion: bool,
|
maxReplies: int, allowDeletion: bool,
|
||||||
maxMentions: int, maxEmoji: int, translate: {},
|
max_mentions: int, maxEmoji: int, translate: {},
|
||||||
unitTest: bool,
|
unitTest: bool,
|
||||||
yt_replace_domain: str,
|
yt_replace_domain: str,
|
||||||
twitter_replacement_domain: str,
|
twitter_replacement_domain: str,
|
||||||
|
@ -3415,7 +3415,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
||||||
jsonObj = None
|
jsonObj = None
|
||||||
domainFull = getFullDomain(domain, port)
|
domainFull = getFullDomain(domain, port)
|
||||||
if _validPostContent(base_dir, nickname, domain,
|
if _validPostContent(base_dir, nickname, domain,
|
||||||
postJsonObject, maxMentions, maxEmoji,
|
postJsonObject, max_mentions, maxEmoji,
|
||||||
allow_local_network_access, debug,
|
allow_local_network_access, debug,
|
||||||
systemLanguage, http_prefix,
|
systemLanguage, http_prefix,
|
||||||
domainFull, personCache):
|
domainFull, personCache):
|
||||||
|
@ -4070,7 +4070,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
federationList: [], maxReplies: int,
|
federationList: [], maxReplies: int,
|
||||||
domainMaxPostsPerDay: int,
|
domainMaxPostsPerDay: int,
|
||||||
accountMaxPostsPerDay: int,
|
accountMaxPostsPerDay: int,
|
||||||
allowDeletion: bool, debug: bool, maxMentions: int,
|
allowDeletion: bool, debug: bool, max_mentions: int,
|
||||||
maxEmoji: int, translate: {}, unitTest: bool,
|
maxEmoji: int, translate: {}, unitTest: bool,
|
||||||
yt_replace_domain: str,
|
yt_replace_domain: str,
|
||||||
twitter_replacement_domain: str,
|
twitter_replacement_domain: str,
|
||||||
|
@ -4501,7 +4501,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
debug,
|
debug,
|
||||||
queueFilename, destination,
|
queueFilename, destination,
|
||||||
maxReplies, allowDeletion,
|
maxReplies, allowDeletion,
|
||||||
maxMentions, maxEmoji,
|
max_mentions, maxEmoji,
|
||||||
translate, unitTest,
|
translate, unitTest,
|
||||||
yt_replace_domain,
|
yt_replace_domain,
|
||||||
twitter_replacement_domain,
|
twitter_replacement_domain,
|
||||||
|
|
22
posts.py
22
posts.py
|
@ -524,7 +524,7 @@ def isCreateInsideAnnounce(item: {}) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def _getPosts(session, outboxUrl: str, maxPosts: int,
|
def _getPosts(session, outboxUrl: str, maxPosts: int,
|
||||||
maxMentions: int,
|
max_mentions: int,
|
||||||
maxEmoji: int, maxAttachments: int,
|
maxEmoji: int, maxAttachments: int,
|
||||||
federationList: [],
|
federationList: [],
|
||||||
personCache: {}, raw: bool,
|
personCache: {}, raw: bool,
|
||||||
|
@ -623,7 +623,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
|
||||||
if tagItem.get('name'):
|
if tagItem.get('name'):
|
||||||
if tagItem['name'] not in mentions:
|
if tagItem['name'] not in mentions:
|
||||||
mentions.append(tagItem['name'])
|
mentions.append(tagItem['name'])
|
||||||
if len(mentions) > maxMentions:
|
if len(mentions) > max_mentions:
|
||||||
if debug:
|
if debug:
|
||||||
print('max mentions reached')
|
print('max mentions reached')
|
||||||
continue
|
continue
|
||||||
|
@ -743,7 +743,7 @@ def _updateWordFrequency(content: str, wordFrequency: {}) -> None:
|
||||||
|
|
||||||
|
|
||||||
def getPostDomains(session, outboxUrl: str, maxPosts: int,
|
def getPostDomains(session, outboxUrl: str, maxPosts: int,
|
||||||
maxMentions: int,
|
max_mentions: int,
|
||||||
maxEmoji: int, maxAttachments: int,
|
maxEmoji: int, maxAttachments: int,
|
||||||
federationList: [],
|
federationList: [],
|
||||||
personCache: {},
|
personCache: {},
|
||||||
|
@ -810,7 +810,7 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int,
|
||||||
|
|
||||||
def _getPostsForBlockedDomains(base_dir: str,
|
def _getPostsForBlockedDomains(base_dir: str,
|
||||||
session, outboxUrl: str, maxPosts: int,
|
session, outboxUrl: str, maxPosts: int,
|
||||||
maxMentions: int,
|
max_mentions: int,
|
||||||
maxEmoji: int, maxAttachments: int,
|
maxEmoji: int, maxAttachments: int,
|
||||||
federationList: [],
|
federationList: [],
|
||||||
personCache: {},
|
personCache: {},
|
||||||
|
@ -4113,10 +4113,10 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str,
|
||||||
if not personId:
|
if not personId:
|
||||||
return
|
return
|
||||||
|
|
||||||
maxMentions = 10
|
max_mentions = 10
|
||||||
maxEmoji = 10
|
maxEmoji = 10
|
||||||
maxAttachments = 5
|
maxAttachments = 5
|
||||||
_getPosts(session, personUrl, 30, maxMentions, maxEmoji,
|
_getPosts(session, personUrl, 30, max_mentions, maxEmoji,
|
||||||
maxAttachments, federationList,
|
maxAttachments, federationList,
|
||||||
personCache, raw, simple, debug,
|
personCache, raw, simple, debug,
|
||||||
project_version, http_prefix, originDomain, systemLanguage,
|
project_version, http_prefix, originDomain, systemLanguage,
|
||||||
|
@ -4161,11 +4161,11 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str,
|
||||||
project_version, http_prefix,
|
project_version, http_prefix,
|
||||||
nickname, domain, 'outbox',
|
nickname, domain, 'outbox',
|
||||||
92522)
|
92522)
|
||||||
maxMentions = 99
|
max_mentions = 99
|
||||||
maxEmoji = 99
|
maxEmoji = 99
|
||||||
maxAttachments = 5
|
maxAttachments = 5
|
||||||
postDomains = \
|
postDomains = \
|
||||||
getPostDomains(session, personUrl, 64, maxMentions, maxEmoji,
|
getPostDomains(session, personUrl, 64, max_mentions, maxEmoji,
|
||||||
maxAttachments, federationList,
|
maxAttachments, federationList,
|
||||||
personCache, debug,
|
personCache, debug,
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
|
@ -4257,12 +4257,12 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
|
||||||
project_version, http_prefix,
|
project_version, http_prefix,
|
||||||
nickname, domain, 'outbox',
|
nickname, domain, 'outbox',
|
||||||
13863)
|
13863)
|
||||||
maxMentions = 99
|
max_mentions = 99
|
||||||
maxEmoji = 99
|
maxEmoji = 99
|
||||||
maxAttachments = 5
|
maxAttachments = 5
|
||||||
maxPosts = 64
|
maxPosts = 64
|
||||||
postDomains = \
|
postDomains = \
|
||||||
getPostDomains(session, personUrl, maxPosts, maxMentions, maxEmoji,
|
getPostDomains(session, personUrl, maxPosts, max_mentions, maxEmoji,
|
||||||
maxAttachments, federationList,
|
maxAttachments, federationList,
|
||||||
personCache, debug,
|
personCache, debug,
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
|
@ -4275,7 +4275,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
blockedPosts = \
|
blockedPosts = \
|
||||||
_getPostsForBlockedDomains(base_dir, session, personUrl, maxPosts,
|
_getPostsForBlockedDomains(base_dir, session, personUrl, maxPosts,
|
||||||
maxMentions,
|
max_mentions,
|
||||||
maxEmoji, maxAttachments,
|
maxEmoji, maxAttachments,
|
||||||
federationList,
|
federationList,
|
||||||
personCache,
|
personCache,
|
||||||
|
|
|
@ -34,7 +34,7 @@ def instancesGraph(base_dir: str, handles: str,
|
||||||
personCache = {}
|
personCache = {}
|
||||||
cachedWebfingers = {}
|
cachedWebfingers = {}
|
||||||
federationList = []
|
federationList = []
|
||||||
maxMentions = 99
|
max_mentions = 99
|
||||||
maxEmoji = 99
|
maxEmoji = 99
|
||||||
maxAttachments = 5
|
maxAttachments = 5
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ def instancesGraph(base_dir: str, handles: str,
|
||||||
27261)
|
27261)
|
||||||
wordFrequency = {}
|
wordFrequency = {}
|
||||||
postDomains = \
|
postDomains = \
|
||||||
getPostDomains(session, personUrl, 64, maxMentions, maxEmoji,
|
getPostDomains(session, personUrl, 64, max_mentions, maxEmoji,
|
||||||
maxAttachments, federationList,
|
maxAttachments, federationList,
|
||||||
personCache, debug,
|
personCache, debug,
|
||||||
project_version, http_prefix, domain,
|
project_version, http_prefix, domain,
|
||||||
|
|
16
tests.py
16
tests.py
|
@ -775,7 +775,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerAliceRunning
|
global testServerAliceRunning
|
||||||
testServerAliceRunning = True
|
testServerAliceRunning = True
|
||||||
maxMentions = 10
|
max_mentions = 10
|
||||||
maxEmoji = 10
|
maxEmoji = 10
|
||||||
onion_domain = None
|
onion_domain = None
|
||||||
i2p_domain = None
|
i2p_domain = None
|
||||||
|
@ -815,7 +815,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instance_id", False, path, domain,
|
"instance_id", False, path, domain,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
http_prefix, federationList, max_mentions, maxEmoji, False,
|
||||||
proxyType, maxReplies,
|
proxyType, maxReplies,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
|
@ -917,7 +917,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerBobRunning
|
global testServerBobRunning
|
||||||
testServerBobRunning = True
|
testServerBobRunning = True
|
||||||
maxMentions = 10
|
max_mentions = 10
|
||||||
maxEmoji = 10
|
maxEmoji = 10
|
||||||
onion_domain = None
|
onion_domain = None
|
||||||
i2p_domain = None
|
i2p_domain = None
|
||||||
|
@ -957,7 +957,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instance_id", False, path, domain,
|
"instance_id", False, path, domain,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
http_prefix, federationList, max_mentions, maxEmoji, False,
|
||||||
proxyType, maxReplies,
|
proxyType, maxReplies,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
|
@ -986,7 +986,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
||||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||||
global testServerEveRunning
|
global testServerEveRunning
|
||||||
testServerEveRunning = True
|
testServerEveRunning = True
|
||||||
maxMentions = 10
|
max_mentions = 10
|
||||||
maxEmoji = 10
|
maxEmoji = 10
|
||||||
onion_domain = None
|
onion_domain = None
|
||||||
i2p_domain = None
|
i2p_domain = None
|
||||||
|
@ -1027,7 +1027,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instance_id", False, path, domain,
|
"instance_id", False, path, domain,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
http_prefix, federationList, max_mentions, maxEmoji, False,
|
||||||
proxyType, maxReplies, allowDeletion, True, True, False,
|
proxyType, maxReplies, allowDeletion, True, True, False,
|
||||||
sendThreads, False)
|
sendThreads, False)
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
deleteAllPosts(path, nickname, domain, 'outbox')
|
deleteAllPosts(path, nickname, domain, 'outbox')
|
||||||
global testServerGroupRunning
|
global testServerGroupRunning
|
||||||
testServerGroupRunning = True
|
testServerGroupRunning = True
|
||||||
maxMentions = 10
|
max_mentions = 10
|
||||||
maxEmoji = 10
|
maxEmoji = 10
|
||||||
onion_domain = None
|
onion_domain = None
|
||||||
i2p_domain = None
|
i2p_domain = None
|
||||||
|
@ -1099,7 +1099,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instance_id", False, path, domain,
|
"instance_id", False, path, domain,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, maxMentions, maxEmoji, False,
|
http_prefix, federationList, max_mentions, maxEmoji, False,
|
||||||
proxyType, maxReplies,
|
proxyType, maxReplies,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
|
|
Loading…
Reference in New Issue