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,
|
||||
proxy_type: str = None, max_replies: int = 64,
|
||||
domain_max_posts_per_day: int = 8640,
|
||||
accountMaxPostsPerDay: int = 864,
|
||||
account_max_posts_per_day: int = 864,
|
||||
allowDeletion: bool = False,
|
||||
debug: bool = False, unitTest: bool = False,
|
||||
instanceOnlySkillsSearch: bool = False,
|
||||
|
@ -18929,7 +18929,7 @@ def runDaemon(content_license_url: str,
|
|||
httpd.federationList,
|
||||
max_replies,
|
||||
domain_max_posts_per_day,
|
||||
accountMaxPostsPerDay,
|
||||
account_max_posts_per_day,
|
||||
allowDeletion, debug,
|
||||
max_mentions, max_emoji,
|
||||
httpd.translate, unitTest,
|
||||
|
|
|
@ -595,7 +595,7 @@ parser.add_argument('--domainmax', dest='domain_max_posts_per_day', type=int,
|
|||
default=8640,
|
||||
help='Maximum number of received posts ' +
|
||||
'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,
|
||||
help='Maximum number of received posts ' +
|
||||
'from an account per day')
|
||||
|
@ -3255,7 +3255,7 @@ if __name__ == "__main__":
|
|||
args.max_emoji, args.secure_mode,
|
||||
proxy_type, args.max_replies,
|
||||
args.domain_max_posts_per_day,
|
||||
args.accountMaxPostsPerDay,
|
||||
args.account_max_posts_per_day,
|
||||
args.allowdeletion, debug, False,
|
||||
args.instanceOnlySkillsSearch, [],
|
||||
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,
|
||||
queueJson: {}, quotasDaily: {}, quotasPerMin: {},
|
||||
domain_max_posts_per_day: int,
|
||||
accountMaxPostsPerDay: int,
|
||||
account_max_posts_per_day: int,
|
||||
debug: bool) -> bool:
|
||||
"""limit the number of posts which can arrive per domain per day
|
||||
"""
|
||||
|
@ -3733,15 +3733,15 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
|||
else:
|
||||
quotasPerMin['domains'][postDomain] = 1
|
||||
|
||||
if accountMaxPostsPerDay > 0:
|
||||
if account_max_posts_per_day > 0:
|
||||
postHandle = queueJson['postNickname'] + '@' + postDomain
|
||||
if quotasDaily['accounts'].get(postHandle):
|
||||
if quotasDaily['accounts'][postHandle] > \
|
||||
accountMaxPostsPerDay:
|
||||
account_max_posts_per_day:
|
||||
print('Queue: Quota account posts per day -' +
|
||||
' Maximum posts for ' +
|
||||
postHandle + ' reached (' +
|
||||
str(accountMaxPostsPerDay) + ')')
|
||||
str(account_max_posts_per_day) + ')')
|
||||
if len(queue) > 0:
|
||||
try:
|
||||
os.remove(queueFilename)
|
||||
|
@ -3756,7 +3756,7 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
|||
|
||||
if quotasPerMin['accounts'].get(postHandle):
|
||||
accountMaxPostsPerMin = \
|
||||
int(accountMaxPostsPerDay / (24 * 60))
|
||||
int(account_max_posts_per_day / (24 * 60))
|
||||
if accountMaxPostsPerMin < 5:
|
||||
accountMaxPostsPerMin = 5
|
||||
if quotasPerMin['accounts'][postHandle] > \
|
||||
|
@ -3778,7 +3778,7 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
|||
quotasPerMin['accounts'][postHandle] = 1
|
||||
|
||||
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)
|
||||
return False
|
||||
|
||||
|
@ -4069,7 +4069,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
port: int, proxy_type: str,
|
||||
federationList: [], max_replies: int,
|
||||
domain_max_posts_per_day: int,
|
||||
accountMaxPostsPerDay: int,
|
||||
account_max_posts_per_day: int,
|
||||
allowDeletion: bool, debug: bool, max_mentions: int,
|
||||
max_emoji: int, translate: {}, unitTest: bool,
|
||||
yt_replace_domain: str,
|
||||
|
@ -4206,7 +4206,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
|||
if _inboxQuotaExceeded(queue, queueFilename,
|
||||
queueJson, quotasDaily, quotasPerMin,
|
||||
domain_max_posts_per_day,
|
||||
accountMaxPostsPerDay, debug):
|
||||
account_max_posts_per_day, debug):
|
||||
continue
|
||||
|
||||
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'
|
||||
max_replies = 64
|
||||
domain_max_posts_per_day = 1000
|
||||
accountMaxPostsPerDay = 1000
|
||||
account_max_posts_per_day = 1000
|
||||
allowDeletion = True
|
||||
low_bandwidth = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
|
@ -817,7 +817,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
onion_domain, i2p_domain, None, None, port, port,
|
||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||
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,
|
||||
False)
|
||||
|
||||
|
@ -840,7 +840,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
password = 'bobpass'
|
||||
max_replies = 64
|
||||
domain_max_posts_per_day = 1000
|
||||
accountMaxPostsPerDay = 1000
|
||||
account_max_posts_per_day = 1000
|
||||
allowDeletion = True
|
||||
low_bandwidth = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
|
@ -959,7 +959,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
onion_domain, i2p_domain, None, None, port, port,
|
||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||
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,
|
||||
False)
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
|||
password = 'testgrouppass'
|
||||
max_replies = 64
|
||||
domain_max_posts_per_day = 1000
|
||||
accountMaxPostsPerDay = 1000
|
||||
account_max_posts_per_day = 1000
|
||||
allowDeletion = True
|
||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||
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,
|
||||
http_prefix, federationList, max_mentions, max_emoji, False,
|
||||
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,
|
||||
False)
|
||||
|
||||
|
|
Loading…
Reference in New Issue