Refactor: Use corsFetch for all schemes
Currently corsFetch is very stable and does not need to be used differently from pyfetch depending on whether the license server values the Origin header. Nested await is no longer necessary and the code is more concise. It is expected to be less confusing for debugging and for people creating new schemes.
This commit is contained in:
parent
7ec8ad83ea
commit
5c56da872a
@ -1,7 +1,4 @@
|
||||
res = await (await pyfetch(licUrl,
|
||||
method="POST",
|
||||
headers=licHeaders,
|
||||
body=challenge
|
||||
)).json()
|
||||
res = await corsFetch(licUrl, "POST", licHeaders, challenge, "json")
|
||||
|
||||
licence = res['license']
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
payload = loadBody("json")
|
||||
challengeArr = list(challenge)
|
||||
payload['license_request_data']=challengeArr
|
||||
licence = await (await pyfetch(licUrl,
|
||||
method="POST",
|
||||
headers=licHeaders,
|
||||
body=json.dumps(payload)
|
||||
)).bytes()
|
||||
|
||||
licence = await corsFetch(licUrl, "POST", licHeaders, payload, "blob")
|
||||
|
@ -1,7 +1,4 @@
|
||||
b64challenge = base64.b64encode(challenge).decode()
|
||||
res = await (await pyfetch(licUrl,
|
||||
method="POST",
|
||||
headers=licHeaders,
|
||||
body=json.dumps({"challenge": b64challenge})
|
||||
)).json()
|
||||
res = await corsFetch(licUrl, "POST", licHeaders, {"challenge": b64challenge}, "json")
|
||||
|
||||
licence = res["license"][0]
|
||||
|
@ -1,9 +1,6 @@
|
||||
payload = loadBody("json")
|
||||
challengeB64 = base64.b64encode(challenge).decode()
|
||||
payload['params']['object'] = challengeB64
|
||||
licence = await (await pyfetch(licUrl,
|
||||
method="POST",
|
||||
headers=licHeaders,
|
||||
body=json.dumps(payload)
|
||||
)).json()
|
||||
licence = licence['result']['object']['license']
|
||||
res = await corsFetch(licUrl, "POST", licHeaders, payload, "json")
|
||||
|
||||
licence = res['result']['object']['license']
|
||||
|
@ -1,9 +1,6 @@
|
||||
payload = loadBody("json")
|
||||
b64challenge = base64.b64encode(challenge).decode()
|
||||
payload["getWidevineLicense"]["widevineChallenge"]=b64challenge
|
||||
res = await (await pyfetch(licUrl,
|
||||
method="POST",
|
||||
headers=licHeaders,
|
||||
body=json.dumps(payload)
|
||||
)).json()
|
||||
res = await corsFetch(licUrl, "POST", licHeaders, payload, "json")
|
||||
|
||||
licence = res["getWidevineLicenseResponse"]["license"]
|
||||
|
Loading…
Reference in New Issue
Block a user