Option for disable/enable fetching new instances

This commit is contained in:
localhost_frssoft 2023-06-25 14:58:22 +03:00
parent aa79802bf8
commit 50e8a30852
2 changed files with 8 additions and 3 deletions

View file

@ -91,13 +91,17 @@ def main():
if selected == 'Switch instance': if selected == 'Switch instance':
with open('config.json', 'rt') as f: with open('config.json', 'rt') as f:
conf = json.loads(f.read()) conf = json.loads(f.read())
public_server_list_instances = settings.get_new_funkwhale_servers() if conf.get('automatic_fetch_new_instances'):
new_ins_count = len(settings.get_new_funkwhale_servers()) public_server_list_instances = settings.get_new_funkwhale_servers()
new_ins_count = len(settings.get_new_funkwhale_servers())
else:
public_server_list_instances = []
new_ins_count = 'Disabled'
list_instances = conf.get( list_instances = conf.get(
'public_list_instances') + public_server_list_instances 'public_list_instances') + public_server_list_instances
settings.set_config('public_list_instances', list_instances) settings.set_config('public_list_instances', list_instances)
instance = fzf.prompt(list_instances, instance = fzf.prompt(list_instances,
'--header='+quote(f'Select instance\nServer instances: +{new_ins_count}')) '--header='+quote(f'Select instance\nNew instances: {new_ins_count}'))
if instance == []: if instance == []:
continue continue
else: else:

View file

@ -40,6 +40,7 @@ default_conf = {
"funkwhale.gegeweb.eu", "funkwhale.gegeweb.eu",
"shitnoise.monster" "shitnoise.monster"
], ],
'automatic_fetch_new_instances': True,
'enable_server_transcoding': False, 'enable_server_transcoding': False,
'external_transcoder_http_proxy_path': "", 'external_transcoder_http_proxy_path': "",
'track_activity_history': False, 'track_activity_history': False,