mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 17:09:20 +02:00
Fix header and add brotli, deflate
This commit is contained in:
parent
1e3972d009
commit
10ccbecd9e
|
@ -18,6 +18,7 @@ Dependencies:
|
||||||
|
|
||||||
Python dependencies:
|
Python dependencies:
|
||||||
```pip install -r requirements.txt```
|
```pip install -r requirements.txt```
|
||||||
|
Optional: brotli
|
||||||
|
|
||||||
Also, tnx Inex for his FunkWhale instance (set by default instance)
|
Also, tnx Inex for his FunkWhale instance (set by default instance)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ else:
|
||||||
|
|
||||||
class current_instance:
|
class current_instance:
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
|
s.headers.update({"Accept-encoding": 'gzip, br, deflate'})
|
||||||
instance = get_config('instance')
|
instance = get_config('instance')
|
||||||
token = auth.get(instance)
|
token = auth.get(instance)
|
||||||
listen_token = None
|
listen_token = None
|
||||||
|
@ -40,25 +41,17 @@ class current_instance:
|
||||||
with open(auth_file, 'rt') as f:
|
with open(auth_file, 'rt') as f:
|
||||||
auth = json.loads(f.read())
|
auth = json.loads(f.read())
|
||||||
new_token = auth.get(current_instance.instance)
|
new_token = auth.get(current_instance.instance)
|
||||||
current_instance.s.headers.update({"Authorization": None,
|
current_instance.s.headers.update({"Authorization": None})
|
||||||
"Accept-encoding": 'gzip'})
|
|
||||||
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:
|
||||||
s.get(f'https://{current_instance.instance}')
|
s.get(f'https://{current_instance.instance}')
|
||||||
s.headers.update({
|
s.headers.update({"Authorization": "Bearer " + new_token})
|
||||||
"Authorization": "Bearer " + new_token,
|
|
||||||
"Accept-encoding": 'gzip'
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
if current_instance.token:
|
if current_instance.token:
|
||||||
current_instance.s.headers.update({
|
current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token})
|
||||||
"Authorization": "Bearer " + current_instance.token,
|
|
||||||
"Accept-encoding": 'gzip'
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
current_instance.s.headers.update({"Accept-encoding": 'gzip'})
|
|
||||||
# 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}/')
|
current_instance.s.get(f'https://{current_instance.instance}/')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue