mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
5aa2e2f7c3
commit
73a88716d6
|
@ -18477,7 +18477,7 @@ def runDaemon(content_license_url: str,
|
||||||
max_mentions: int = 10, max_emoji: int = 10,
|
max_mentions: int = 10, max_emoji: int = 10,
|
||||||
secure_mode: bool = False,
|
secure_mode: bool = False,
|
||||||
proxy_type: str = None, max_replies: int = 64,
|
proxy_type: str = None, max_replies: int = 64,
|
||||||
domainMaxPostsPerDay: int = 8640,
|
domain_max_posts_per_day: int = 8640,
|
||||||
accountMaxPostsPerDay: int = 864,
|
accountMaxPostsPerDay: int = 864,
|
||||||
allowDeletion: bool = False,
|
allowDeletion: bool = False,
|
||||||
debug: bool = False, unitTest: bool = False,
|
debug: bool = False, unitTest: bool = False,
|
||||||
|
@ -18928,7 +18928,7 @@ def runDaemon(content_license_url: str,
|
||||||
port, proxy_type,
|
port, proxy_type,
|
||||||
httpd.federationList,
|
httpd.federationList,
|
||||||
max_replies,
|
max_replies,
|
||||||
domainMaxPostsPerDay,
|
domain_max_posts_per_day,
|
||||||
accountMaxPostsPerDay,
|
accountMaxPostsPerDay,
|
||||||
allowDeletion, debug,
|
allowDeletion, debug,
|
||||||
max_mentions, max_emoji,
|
max_mentions, max_emoji,
|
||||||
|
|
|
@ -591,7 +591,7 @@ parser.add_argument('--filter', dest='filterStr', type=str, default=None,
|
||||||
'cause a message to be ignored')
|
'cause a message to be ignored')
|
||||||
parser.add_argument('--unfilter', dest='unfilterStr', type=str, default=None,
|
parser.add_argument('--unfilter', dest='unfilterStr', type=str, default=None,
|
||||||
help='Remove a filter on a particular word or phrase')
|
help='Remove a filter on a particular word or phrase')
|
||||||
parser.add_argument('--domainmax', dest='domainMaxPostsPerDay', type=int,
|
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')
|
||||||
|
@ -3254,7 +3254,7 @@ if __name__ == "__main__":
|
||||||
federationList, args.max_mentions,
|
federationList, args.max_mentions,
|
||||||
args.max_emoji, args.secure_mode,
|
args.max_emoji, args.secure_mode,
|
||||||
proxy_type, args.max_replies,
|
proxy_type, args.max_replies,
|
||||||
args.domainMaxPostsPerDay,
|
args.domain_max_posts_per_day,
|
||||||
args.accountMaxPostsPerDay,
|
args.accountMaxPostsPerDay,
|
||||||
args.allowdeletion, debug, False,
|
args.allowdeletion, debug, False,
|
||||||
args.instanceOnlySkillsSearch, [],
|
args.instanceOnlySkillsSearch, [],
|
||||||
|
|
16
inbox.py
16
inbox.py
|
@ -3683,7 +3683,7 @@ def runInboxQueueWatchdog(project_version: str, httpd) -> None:
|
||||||
|
|
||||||
def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
queueJson: {}, quotasDaily: {}, quotasPerMin: {},
|
queueJson: {}, quotasDaily: {}, quotasPerMin: {},
|
||||||
domainMaxPostsPerDay: int,
|
domain_max_posts_per_day: int,
|
||||||
accountMaxPostsPerDay: int,
|
accountMaxPostsPerDay: 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
|
||||||
|
@ -3692,13 +3692,13 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
if not postDomain:
|
if not postDomain:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if domainMaxPostsPerDay > 0:
|
if domain_max_posts_per_day > 0:
|
||||||
if quotasDaily['domains'].get(postDomain):
|
if quotasDaily['domains'].get(postDomain):
|
||||||
if quotasDaily['domains'][postDomain] > \
|
if quotasDaily['domains'][postDomain] > \
|
||||||
domainMaxPostsPerDay:
|
domain_max_posts_per_day:
|
||||||
print('Queue: Quota per day - Maximum posts for ' +
|
print('Queue: Quota per day - Maximum posts for ' +
|
||||||
postDomain + ' reached (' +
|
postDomain + ' reached (' +
|
||||||
str(domainMaxPostsPerDay) + ')')
|
str(domain_max_posts_per_day) + ')')
|
||||||
if len(queue) > 0:
|
if len(queue) > 0:
|
||||||
try:
|
try:
|
||||||
os.remove(queueFilename)
|
os.remove(queueFilename)
|
||||||
|
@ -3713,7 +3713,7 @@ def _inboxQuotaExceeded(queue: {}, queueFilename: str,
|
||||||
|
|
||||||
if quotasPerMin['domains'].get(postDomain):
|
if quotasPerMin['domains'].get(postDomain):
|
||||||
domainMaxPostsPerMin = \
|
domainMaxPostsPerMin = \
|
||||||
int(domainMaxPostsPerDay / (24 * 60))
|
int(domain_max_posts_per_day / (24 * 60))
|
||||||
if domainMaxPostsPerMin < 5:
|
if domainMaxPostsPerMin < 5:
|
||||||
domainMaxPostsPerMin = 5
|
domainMaxPostsPerMin = 5
|
||||||
if quotasPerMin['domains'][postDomain] > \
|
if quotasPerMin['domains'][postDomain] > \
|
||||||
|
@ -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 domainMaxPostsPerDay > 0:
|
if accountMaxPostsPerDay > 0 or domain_max_posts_per_day > 0:
|
||||||
pprint(quotasDaily)
|
pprint(quotasDaily)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -4068,7 +4068,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
onion_domain: str, i2p_domain: str,
|
onion_domain: str, i2p_domain: str,
|
||||||
port: int, proxy_type: str,
|
port: int, proxy_type: str,
|
||||||
federationList: [], max_replies: int,
|
federationList: [], max_replies: int,
|
||||||
domainMaxPostsPerDay: int,
|
domain_max_posts_per_day: int,
|
||||||
accountMaxPostsPerDay: int,
|
accountMaxPostsPerDay: 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,
|
||||||
|
@ -4205,7 +4205,7 @@ def runInboxQueue(recentPostsCache: {}, max_recent_posts: int,
|
||||||
|
|
||||||
if _inboxQuotaExceeded(queue, queueFilename,
|
if _inboxQuotaExceeded(queue, queueFilename,
|
||||||
queueJson, quotasDaily, quotasPerMin,
|
queueJson, quotasDaily, quotasPerMin,
|
||||||
domainMaxPostsPerDay,
|
domain_max_posts_per_day,
|
||||||
accountMaxPostsPerDay, debug):
|
accountMaxPostsPerDay, debug):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
12
tests.py
12
tests.py
|
@ -694,7 +694,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
proxy_type = None
|
proxy_type = None
|
||||||
password = 'alicepass'
|
password = 'alicepass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domainMaxPostsPerDay = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
accountMaxPostsPerDay = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
low_bandwidth = True
|
low_bandwidth = True
|
||||||
|
@ -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,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domain_max_posts_per_day, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
password = 'bobpass'
|
password = 'bobpass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domainMaxPostsPerDay = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
accountMaxPostsPerDay = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
low_bandwidth = True
|
low_bandwidth = True
|
||||||
|
@ -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,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domain_max_posts_per_day, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
proxy_type = None
|
proxy_type = None
|
||||||
password = 'testgrouppass'
|
password = 'testgrouppass'
|
||||||
max_replies = 64
|
max_replies = 64
|
||||||
domainMaxPostsPerDay = 1000
|
domain_max_posts_per_day = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
accountMaxPostsPerDay = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
|
@ -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,
|
||||||
domainMaxPostsPerDay, accountMaxPostsPerDay,
|
domain_max_posts_per_day, accountMaxPostsPerDay,
|
||||||
allowDeletion, True, True, False, sendThreads,
|
allowDeletion, True, True, False, sendThreads,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue