Fix return new instance list

This commit is contained in:
localhost_frssoft 2023-05-30 01:08:24 +03:00
parent ef88593f60
commit 8850ac2916

View file

@ -111,13 +111,16 @@ def get_new_funkwhale_servers():
} }
] ]
} }
try:
r = requests.post(public_server_api, json=request_public_servers) r = requests.post(public_server_api, json=request_public_servers)
results = r.json() results = r.json()
new_instances = [] new_instances = []
if results: if results:
new_instances_list = results['results']['A']['tables'][0]['rows'] new_instances_list = results['results']['A']['tables'][0]['rows']
for i in new_instances_list: exists_instances = get_config('public_list_instances')
if i[0] not in default_conf['public_list_instances'] and i[1]: for i in new_instances_list:
new_instances.append(i[0]) if i[0] not in exists_instances and i[1]:
return new_instances new_instances.append(i[0])
return new_instances
except: # If any errors then return empty list
return []