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