-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
11 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |