ensure that section names do not include the protocol

This commit is contained in:
Tobias Diekershoff 2023-01-08 11:26:02 +01:00
parent 7c8294bf49
commit 350f6d6f66
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "brewserverblocklist"
version = "1.1.2"
version = "1.1.3"
description = "A python script to collect the server-wide blocklists from Friendica nodes to build a collection from trusted admin choice"
authors = ["Tobias Diekershoff"]
license = "GNU General Public License v3.0"

View File

@ -36,7 +36,11 @@ class BrewBlocklist():
config = configparser.RawConfigParser()
config.read(configfile)
for section in config.sections():
print(section)
section_values = dict(config.items(section))
if (section.find('http://') > -1) or (section.find('https://') > -1):
print('The section name in the config file must not contain the protocol ({})'.format(section))
sys.exit(1)
if not section == 'safe harbor':
if not 'type' in section_values.keys():
section_values['type'] = 'friendica'
@ -181,7 +185,7 @@ def main():
arg_auto_accept = not args.auto_accept_direction is None
if not exists(args.configfile):
print('The config file {} was not found.'.format(args.configfile))
sys.exit()
sys.exit(1)
brew = BrewBlocklist(args.configfile, args.outputfile, arg_auto_accept,
args.auto_accept_direction, args.confidence)
brew.collect_ingrediens()