From 8850ac2916d7621b9e704e0fc29d802844ec96ea Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Tue, 30 May 2023 01:08:24 +0300 Subject: [PATCH] Fix return new instance list --- src/settings.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/settings.py b/src/settings.py index 583e134..e52de66 100644 --- a/src/settings.py +++ b/src/settings.py @@ -111,13 +111,16 @@ def get_new_funkwhale_servers(): } ] } - - r = requests.post(public_server_api, json=request_public_servers) - results = r.json() - new_instances = [] - if results: - new_instances_list = results['results']['A']['tables'][0]['rows'] - for i in new_instances_list: - if i[0] not in default_conf['public_list_instances'] and i[1]: - new_instances.append(i[0]) - return new_instances + try: + r = requests.post(public_server_api, json=request_public_servers) + results = r.json() + new_instances = [] + if results: + new_instances_list = results['results']['A']['tables'][0]['rows'] + exists_instances = get_config('public_list_instances') + for i in new_instances_list: + if i[0] not in exists_instances and i[1]: + new_instances.append(i[0]) + return new_instances + except: # If any errors then return empty list + return []