Fix ogServer deletion from the configuration file

Otherwise, users can not remove from the web a server declared in the
deprecated way.
async-tree
Javier Sánchez Parra 2022-09-22 17:42:33 +02:00
parent 328ead9168
commit 4f3c66f04a
1 changed files with 6 additions and 1 deletions

View File

@ -1534,7 +1534,12 @@ def delete_server(server):
with open(filename, 'r+') as file:
config = json.load(file)
config['SERVERS'].remove(server_dict)
try:
config['SERVERS'].remove(server_dict)
except (KeyError, ValueError):
config.pop('IP')
config.pop('PORT')
config.pop('API_TOKEN')
file.seek(0)
json.dump(config, file, indent='\t')