Enabled lists set from commandline

main
Bob Mottram 2021-10-21 15:06:25 +01:00
parent 142a68a97c
commit 0c0cbf9485
3 changed files with 27 additions and 7 deletions

View File

@ -16864,7 +16864,8 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None:
break
def runDaemon(defaultReplyIntervalHours: int,
def runDaemon(listsEnabled: str,
defaultReplyIntervalHours: int,
lowBandwidth: bool,
maxLikeCount: int,
sharedItemsFederatedDomains: [],
@ -17219,7 +17220,10 @@ def runDaemon(defaultReplyIntervalHours: int,
createNewsInbox(baseDir, domain, port, httpPrefix)
setConfigParam(baseDir, "listsEnabled", "Murdoch press")
httpd.listsEnabled = getConfigParam(baseDir, "listsEnabled")
if listsEnabled:
httpd.listsEnabled = listsEnabled
else:
httpd.listsEnabled = getConfigParam(baseDir, "listsEnabled")
httpd.CWlists = loadCWLists(baseDir, True, httpd.listsEnabled)
# set the avatar for the news account

View File

@ -112,6 +112,10 @@ def str2bool(v) -> bool:
parser = argparse.ArgumentParser(description='ActivityPub Server')
parser.add_argument('--listsEnabled', type=str,
default=None,
help='Names of content warning lists enabled. ' +
'See the cwlists directory')
parser.add_argument('--userAgentBlocks', type=str,
default=None,
help='List of blocked user agents, separated by commas')
@ -3011,6 +3015,13 @@ if userAgentsBlockedStr:
for agentBlockStr in agentBlocksList:
userAgentsBlocked.append(agentBlockStr.strip())
listsEnabled = ''
if args.listsEnabled:
listsEnabled = args.listsEnabled
setConfigParam(baseDir, 'listsEnabled', listsEnabled)
else:
listsEnabled = getConfigParam(baseDir, 'listsEnabled')
city = \
getConfigParam(baseDir, 'city')
if city is not None:
@ -3064,7 +3075,8 @@ if args.defaultCurrency:
print('Default currency set to ' + args.defaultCurrency)
if __name__ == "__main__":
runDaemon(args.defaultReplyIntervalHours,
runDaemon(listsEnabled,
args.defaultReplyIntervalHours,
args.lowBandwidth, args.maxLikeCount,
sharedItemsFederatedDomains,
userAgentsBlocked,

View File

@ -817,8 +817,9 @@ def createServerAlice(path: str, domain: str, port: int,
userAgentsBlocked = []
maxLikeCount = 10
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
print('Server running: Alice')
runDaemon(defaultReplyIntervalHours,
runDaemon(listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
userAgentsBlocked,
@ -955,8 +956,9 @@ def createServerBob(path: str, domain: str, port: int,
userAgentsBlocked = []
maxLikeCount = 10
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
print('Server running: Bob')
runDaemon(defaultReplyIntervalHours,
runDaemon(listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
userAgentsBlocked,
@ -1022,8 +1024,9 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
maxLikeCount = 10
lowBandwidth = True
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
print('Server running: Eve')
runDaemon(defaultReplyIntervalHours,
runDaemon(listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
userAgentsBlocked,
@ -1091,8 +1094,9 @@ def createServerGroup(path: str, domain: str, port: int,
maxLikeCount = 10
lowBandwidth = True
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
print('Server running: Group')
runDaemon(defaultReplyIntervalHours,
runDaemon(listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
userAgentsBlocked,