mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
73a88716d6
commit
bf8bf79620
|
@ -18478,7 +18478,7 @@ def runDaemon(content_license_url: str,
|
||||||
secure_mode: bool = False,
|
secure_mode: bool = False,
|
||||||
proxy_type: str = None, max_replies: int = 64,
|
proxy_type: str = None, max_replies: int = 64,
|
||||||
domain_max_posts_per_day: int = 8640,
|
domain_max_posts_per_day: int = 8640,
|
||||||
accountMaxPostsPerDay: int = 864,
|
account_max_posts_per_day: int = 864,
|
||||||
allowDeletion: bool = False,
|
allowDeletion: bool = False,
|
||||||
debug: bool = False, unitTest: bool = False,
|
debug: bool = False, unitTest: bool = False,
|
||||||
instanceOnlySkillsSearch: bool = False,
|
instanceOnlySkillsSearch: bool = False,
|
||||||
|
@ -18929,7 +18929,7 @@ def runDaemon(content_license_url: str,
|
||||||
httpd.federationList,
|
httpd.federationList,
|
||||||
max_replies,
|
max_replies,
|
||||||
domain_max_posts_per_day,
|
domain_max_posts_per_day,
|
||||||
accountMaxPostsPerDay,
|
account_max_posts_per_day,
|
||||||
allowDeletion, debug,
|
allowDeletion, debug,
|
||||||
max_mentions, max_emoji,
|
max_mentions, max_emoji,
|
||||||
httpd.translate, unitTest,
|
httpd.translate, unitTest,
|
||||||
|
|
|
@ -595,7 +595,7 @@ parser.add_argument('--domainmax', dest='domain_max_posts_per_day', type=int,
|
||||||
default=8640,
|
default=8640,
|
||||||
help='Maximum number of received posts ' +
|
help='Maximum number of received posts ' +
|
||||||
'from a domain per day')
|
'from a domain per day')
|
||||||
parser.add_argument('--accountmax', dest='accountMaxPostsPerDay', type=int,
|
parser.add_argument('--accountmax', dest='account_max_posts_per_day', type=int,
|
||||||
default=8640,
|
default=8640,
|
||||||
help='Maximum number of received posts ' +
|
help='Maximum number of received posts ' +
|
||||||
'from an account per day')
|
'from an account per day')
|
||||||
|
@ -3255,7 +3255,7 @@ if __name__ == "__main__":
|
||||||
args.max_emoji, args.secure_mode,
|
args.max_emoji, args.secure_mode,
|
||||||
proxy_type, args.max_replies,
|
proxy_type, args.max_replies,
|
||||||
args.domain_max_posts_per_day,
|
args.domain_max_posts_per_day,
|
||||||
args.accountMaxPostsPerDay,
|
args.account_max_posts_per_day,
|
||||||
args.allowdeletion, debug, False,
|
args.allowdeletion, debug, False,
|
||||||
args.instanceOnlySkillsSearch, [],
|
args.instanceOnlySkillsSearch, [],
|
||||||
not args.noapproval)
|
not args.noapproval)
|
||||||
|
|
16
inbox.py
16
inbox.py
|
@ -3684,7 +3684,7 @@ def runInboxQueueWatchdog(project_version: str, httpd) -> None:
|
||||||
def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
queueJson: {}, quotasDaily: {}, quotasPerMin: {},
|
queueJson: {}, quotasDaily: {}, quotasPerMin: {},
|
||||||
domain_max_posts_per_day: int,
|
domain_max_posts_per_day: int,
|
||||||
accountMaxPostsPerDay: int,
|
account_max_posts_per_day: int,
|
||||||
debug: bool) -> bool:
|
debug: bool) -> bool:
|
||||||
"""limit the number of posts which can arrive per domain per day
|
"""limit the number of posts which can arrive per domain per day
|
||||||
"""
|
"""
|
||||||
|
@ -3733,15 +3733,15 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
else:
|
else:
|
||||||
quotasPerMin['domains'][postDomain] = 1
|
quotasPerMin['domains'][postDomain] = 1
|
||||||
|
|
||||||
if accountMaxPostsPerDay > 0:
|
if account_max_posts_per_day > 0:
|
||||||
postHandle = queueJson['postNickname'] + '@' + postDomain
|
postHandle = queueJson['postNickname'] + '@' + postDomain
|
||||||
if quotasDaily['accounts'].get(postHandle):
|
if quotasDaily['accounts'].get(postHandle):
|
||||||
if quotasDaily['accounts'][postHandle] > \
|
if quotasDaily['accounts'][postHandle] > \
|
||||||
accountMaxPostsPerDay:
|
account_max_posts_per_day:
|
||||||
print('Queue: Quota account posts per day -' +
|
print('Queue: Quota account posts per day -' +
|
||||||
' Maximum posts for ' +
|
' Maximum posts for ' +
|
||||||
postHandle + ' reached (' +
|
postHandle + ' reached (' +
|
||||||
str(accountMaxPostsPerDay) + ')')
|
str(account_max_posts_per_day) + ')')
|
||||||
if len(queue) > 0:
|
if len(queue) > 0:
|
||||||
try:
|
try:
|
||||||
os.remove(queueFilename)
|
os.remove(queueFilename)
|
||||||
|
@ -3756,7 +3756,7 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
|
|
||||||
if quotasPerMin['accounts'].get(postHandle):
|
if quotasPerMin['accounts'].get(postHandle):
|
||||||
accountMaxPostsPerMin = \
|
accountMaxPostsPerMin = \
|
||||||
int(accountMaxPostsPerDay / (24 * 60))
|
int(account_max_posts_per_day / (24 * 60))
|
||||||
if accountMaxPostsPerMin < 5:
|
if accountMaxPostsPerMin < 5:
|
||||||
accountMaxPostsPerMin = 5
|
accountMaxPostsPerMin = 5
|
||||||
if quotasPerMin['accounts'][postHandle] > \
|
if quotasPerMin['accounts'][postHandle] > \
|
||||||
|
@ -3778,7 +3778,7 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
quotasPerMin['accounts'][postHandle] = 1
|
quotasPerMin['accounts'][postHandle] = 1
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
if accountMaxPostsPerDay > 0 or domain_max_posts_per_day > 0:
|
if account_max_posts_per_day > 0 or domain_max_posts_per_day > 0:
|
||||||
pprint(quotasDaily)
|
pprint(quotasDaily)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -4069,7 +4069,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
port: int, proxy_type: str,
|
port: int, proxy_type: str,
|
||||||
federationList: [], max_replies: int,
|
federationList: [], max_replies: int,
|
||||||
domain_max_posts_per_day: int,
|
domain_max_posts_per_day: int,
|
||||||
accountMaxPostsPerDay: int,
|
account_max_posts_per_day: int,
|
||||||
allowDeletion: bool, debug: bool, max_mentions: int,
|
allowDeletion: bool, debug: bool, max_mentions: int,
|
||||||
max_emoji: int, translate: {}, unitTest: bool,
|
max_emoji: int, translate: {}, unitTest: bool,
|
||||||
yt_replace_domain: str,
|
yt_replace_domain: str,
|
||||||
|
@ -4206,7 +4206,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
if _inboxQuotaExceeded(queue, queueFilename,
|
if _inboxQuotaExceeded(queue, queueFilename,
|
||||||
queueJson, quotasDaily, quotasPerMin,
|
queueJson, quotasDaily, quotasPerMin,
|
||||||
domain_max_posts_per_day,
|
domain_max_posts_per_day,
|
||||||
accountMaxPostsPerDay, debug):
|
account_max_posts_per_day, debug):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if debug and queueJson.get('actor'):
|
if debug and queueJson.get('actor'):
|
||||||
|
|
12
tests.py
12
tests.py
|
@ -695,7 +695,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
password = 'alicepass'
|
password = 'alicepass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domain_max_posts_per_day = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
account_max_posts_per_day = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
low_bandwidth = True
|
low_bandwidth = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
|
@ -817,7 +817,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||||
proxy_type, max_replies,
|
proxy_type, max_replies,
|
||||||
domain_max_posts_per_day, accountMaxPostsPerDay,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
@ -840,7 +840,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
password = 'bobpass'
|
password = 'bobpass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domain_max_posts_per_day = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
account_max_posts_per_day = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
low_bandwidth = True
|
low_bandwidth = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
|
@ -959,7 +959,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||||
proxy_type, max_replies,
|
proxy_type, max_replies,
|
||||||
domain_max_posts_per_day, accountMaxPostsPerDay,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
password = 'testgrouppass'
|
password = 'testgrouppass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domain_max_posts_per_day = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
account_max_posts_per_day = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
createGroup(path, nickname, domain, port, http_prefix, True,
|
createGroup(path, nickname, domain, port, http_prefix, True,
|
||||||
|
@ -1101,7 +1101,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
onion_domain, i2p_domain, None, None, port, port,
|
onion_domain, i2p_domain, None, None, port, port,
|
||||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||||
proxy_type, max_replies,
|
proxy_type, max_replies,
|
||||||
domain_max_posts_per_day, accountMaxPostsPerDay,
|
domain_max_posts_per_day, account_max_posts_per_day,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue