Compare commits

..

No commits in common. "da86e366a9229be63bc67b3eba15e2006f73a917" and "aa79802bf82527af35657c1650ddb2c58b7c3ca0" have entirely different histories.

3 changed files with 6 additions and 12 deletions

View File

@ -91,17 +91,13 @@ 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())
if conf.get('automatic_fetch_new_instances'):
public_server_list_instances = settings.get_new_funkwhale_servers() public_server_list_instances = settings.get_new_funkwhale_servers()
new_ins_count = len(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\nNew instances: {new_ins_count}')) '--header='+quote(f'Select instance\nServer instances: +{new_ins_count}'))
if instance == []: if instance == []:
continue continue
else: else:

View File

@ -48,7 +48,7 @@ class current_instance:
current_instance.token = new_token current_instance.token = new_token
current_instance.listen_token = None current_instance.listen_token = None
if new_token: if new_token:
current_instance.s.get(f'https://{current_instance.instance}', timeout=30) current_instance.s.get(f'https://{current_instance.instance}')
current_instance.s.headers.update({"Authorization": "Bearer " + new_token}) current_instance.s.headers.update({"Authorization": "Bearer " + new_token})
@ -56,7 +56,7 @@ if current_instance.token:
current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token}) current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token})
else: else:
# Get cookies from unauthorized instance for working some functionality (radios) # Get cookies from unauthorized instance for working some functionality (radios)
current_instance.s.get(f'https://{current_instance.instance}/', timeout=30) current_instance.s.get(f'https://{current_instance.instance}/')
@logger.catch @logger.catch
@ -79,8 +79,7 @@ def get_instance_settings():
def get_node_info(): def get_node_info():
r = current_instance.s.get( r = current_instance.s.get(
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/', f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/')
timeout=30)
r.raise_for_status() r.raise_for_status()
return r.json() return r.json()

View File

@ -40,7 +40,6 @@ 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,