From 16fd2047436c77bfd14ce1170ebe108e739dfe01 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 10 Sep 2022 21:53:14 +0100 Subject: [PATCH] Serve: Properly enforce privacy mode --- pywidevine/serve.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pywidevine/serve.py b/pywidevine/serve.py index 3217f82..91e2a44 100644 --- a/pywidevine/serve.py +++ b/pywidevine/serve.py @@ -251,11 +251,13 @@ async def get_license_challenge(request: web.Request) -> web.Response: }, status=400) # enforce service certificate (opt-in) - if request.app["config"].get("force_privacy_mode") and not cdm.get_service_certificate(session_id): - return web.json_response({ - "status": 403, - "message": "No Service Certificate set but Privacy Mode is Enforced." - }, status=403) + if request.app["config"].get("force_privacy_mode"): + privacy_mode = True + if not cdm.get_service_certificate(session_id): + return web.json_response({ + "status": 403, + "message": "No Service Certificate set but Privacy Mode is Enforced." + }, status=403) # get init data init_data = PSSH(body["init_data"])