Merge pull request 'rewrite' (#2) from rewrite into main
Reviewed-on: #2
This commit is contained in:
commit
bafe525510
@ -13,9 +13,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
const { type, data } = message;
|
||||
|
||||
switch (type) {
|
||||
case "INTERCEPTED_POST":
|
||||
console.log("Storing POST Request", data);
|
||||
chrome.storage.local.set({ latestLicenseRequest: data });
|
||||
case "DRM_TYPE":
|
||||
console.log("DRM Type:", data);
|
||||
chrome.storage.local.set({ drmType: data });
|
||||
break;
|
||||
|
||||
case "PSSH_DATA":
|
||||
@ -23,24 +23,14 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
chrome.storage.local.set({ latestPSSH: data });
|
||||
break;
|
||||
|
||||
case "LICENSE_DATA":
|
||||
console.log("Storing License Response:", data);
|
||||
chrome.storage.local.set({ latestLicenseResponse: data });
|
||||
break;
|
||||
|
||||
case "CERTIFICATE_DATA":
|
||||
console.log("Storing Service Certificate:", data);
|
||||
chrome.storage.local.set({ latestServiceCertificate: data });
|
||||
break;
|
||||
|
||||
case "KEYS_DATA":
|
||||
console.log("Storing Decryption Keys:", data);
|
||||
chrome.storage.local.set({ latestKeys: data });
|
||||
break;
|
||||
|
||||
case "DRM_TYPE":
|
||||
console.log("DRM Type:", data);
|
||||
chrome.storage.local.set({ drmType: data });
|
||||
|
||||
case "LICENSE_URL":
|
||||
console.log("Storling License URL " + data);
|
||||
chrome.storage.local.set({licenseURL: data});
|
||||
break;
|
||||
|
||||
default:
|
||||
|
23
content.js
23
content.js
@ -1,24 +1,18 @@
|
||||
// Inject `inject.js` into the page context
|
||||
(function injectScript() {
|
||||
function append() {
|
||||
const container = document.head || document.documentElement;
|
||||
if (!container) {
|
||||
return requestAnimationFrame(append); // Wait for DOM to exist
|
||||
}
|
||||
const script = document.createElement('script');
|
||||
script.src = chrome.runtime.getURL('inject.js');
|
||||
script.type = 'text/javascript';
|
||||
script.onload = () => script.remove(); // Clean up after injecting
|
||||
container.appendChild(script);
|
||||
}
|
||||
append();
|
||||
const script = document.createElement('script');
|
||||
script.src = chrome.runtime.getURL('inject.js');
|
||||
script.type = 'text/javascript';
|
||||
script.onload = () => script.remove(); // Clean up
|
||||
// Inject directly into <html> or <head>
|
||||
(document.documentElement || document.head || document.body).appendChild(script);
|
||||
})();
|
||||
|
||||
// Listen for messages from the injected script
|
||||
window.addEventListener("message", function(event) {
|
||||
if (event.source !== window) return;
|
||||
|
||||
if (["__INTERCEPTED_POST__", "__PSSH_DATA__", "__LICENSE_DATA__", "__CERTIFICATE_DATA__", "__KEYS_DATA__", "__DRM_TYPE__"].includes(event.data?.type)) {
|
||||
if (["__DRM_TYPE__", "__PSSH_DATA__", "__KEYS_DATA__", "__LICENSE_URL__"].includes(event.data?.type)) {
|
||||
chrome.runtime.sendMessage({
|
||||
type: event.data.type.replace("__", "").replace("__", ""),
|
||||
data: event.data.data
|
||||
@ -26,7 +20,6 @@ window.addEventListener("message", function(event) {
|
||||
}
|
||||
|
||||
if (event.data.type === "__GET_CDM_DEVICES__") {
|
||||
console.log("Received request for CDM devices");
|
||||
|
||||
chrome.storage.local.get(["widevine_device", "playready_device"], (result) => {
|
||||
const widevine_device = result.widevine_device || null;
|
||||
@ -44,7 +37,6 @@ window.addEventListener("message", function(event) {
|
||||
}
|
||||
|
||||
if (event.data.type === "__GET_INJECTION_TYPE__") {
|
||||
console.log("Received request for injection type");
|
||||
|
||||
chrome.storage.local.get("injection_type", (result) => {
|
||||
const injectionType = result.injection_type || "LICENSE";
|
||||
@ -59,7 +51,6 @@ window.addEventListener("message", function(event) {
|
||||
});
|
||||
}
|
||||
if (event.data.type === "__GET_DRM_OVERRIDE__") {
|
||||
console.log("Received request for DRM override");
|
||||
|
||||
chrome.storage.local.get("drm_override", (result) => {
|
||||
const drmOverride = result.drm_override || "DISABLED";
|
||||
|
52
frontend/dist/assets/index-BFZJq4X0.js
vendored
52
frontend/dist/assets/index-BFZJq4X0.js
vendored
File diff suppressed because one or more lines are too long
24
frontend/dist/index.html
vendored
24
frontend/dist/index.html
vendored
@ -1,13 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CDRM Decryption Extension</title>
|
||||
<script type="module" crossorigin src="./assets/index-CN3ssfBX.js"></script>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CDRM Decryption Extension</title>
|
||||
<script type="module" crossorigin src="./assets/index-ydPQKJSy.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-UaipKa9p.css">
|
||||
</head>
|
||||
<body class="min-w-full min-h-full w-full h-full">
|
||||
<div class="min-w-full min-h-full w-full h-full" id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
</head>
|
||||
<body class="min-w-full min-h-full w-full h-full">
|
||||
<div class="min-w-full min-h-full w-full h-full" id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,16 +4,21 @@ function Results() {
|
||||
const [drmType, setDrmType] = useState("");
|
||||
const [pssh, setPssh] = useState("");
|
||||
const [licenseUrl, setLicenseUrl] = useState("");
|
||||
const [keys, setKeys] = useState("");
|
||||
const [keys, setKeys] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
chrome.storage.local.get(
|
||||
["drmType", "latestPSSH", "latestLicenseRequest", "latestKeys"],
|
||||
[
|
||||
"drmType",
|
||||
"latestPSSH",
|
||||
"latestLicenseRequest",
|
||||
"latestKeys",
|
||||
"licenseURL",
|
||||
],
|
||||
(result) => {
|
||||
if (result.drmType) setDrmType(result.drmType);
|
||||
if (result.latestPSSH) setPssh(result.latestPSSH);
|
||||
if (result.latestLicenseRequest?.url)
|
||||
setLicenseUrl(result.latestLicenseRequest.url);
|
||||
if (result.licenseURL) setLicenseUrl(result.licenseURL);
|
||||
if (result.latestKeys) {
|
||||
try {
|
||||
const parsed = Array.isArray(result.latestKeys)
|
||||
@ -36,8 +41,8 @@ function Results() {
|
||||
if (changes.latestPSSH) {
|
||||
setPssh(changes.latestPSSH.newValue);
|
||||
}
|
||||
if (changes.latestLicenseRequest) {
|
||||
setLicenseUrl(changes.latestLicenseRequest.newValue.url);
|
||||
if (changes.licenseURL) {
|
||||
setLicenseUrl(changes.licenseURL.newValue);
|
||||
}
|
||||
if (changes.latestKeys) {
|
||||
setKeys(changes.latestKeys.newValue);
|
||||
@ -54,7 +59,7 @@ function Results() {
|
||||
chrome.storage.local.set({
|
||||
drmType: "None",
|
||||
latestPSSH: "None",
|
||||
latestLicenseRequest: { url: "None" },
|
||||
licenseURL: "None",
|
||||
latestKeys: [],
|
||||
});
|
||||
|
||||
|
@ -49,35 +49,6 @@ function TopNav({ onMenuClick }) {
|
||||
className="h-full w-16 p-2 flex items-center cursor-pointer"
|
||||
onClick={onMenuClick}
|
||||
/>
|
||||
<div className="flex flex-row h-full justify-center items-center ml-auto mr-2">
|
||||
<p className="text-white text-lg p-2 mr-2 border-r-2 border-r-white text-nowrap">
|
||||
DRM Override:
|
||||
</p>
|
||||
<button
|
||||
onClick={() => handleDrmOverrideChange("WIDEVINE")}
|
||||
className={`text-white text-lg p-2 rounded-md m-1 cursor-pointer ${
|
||||
drmOverride === "WIDEVINE" ? "bg-green-500/70" : "bg-black"
|
||||
}`}
|
||||
>
|
||||
Widevine
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleDrmOverrideChange("PLAYREADY")}
|
||||
className={`text-white text-lg p-2 rounded-md m-1 cursor-pointer ${
|
||||
drmOverride === "PLAYREADY" ? "bg-sky-500/70" : "bg-black"
|
||||
}`}
|
||||
>
|
||||
PlayReady
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleDrmOverrideChange("DISABLED")}
|
||||
className={`text-white text-lg p-2 rounded-md m-1 cursor-pointer ${
|
||||
drmOverride === "DISABLED" ? "bg-red-500/70" : "bg-black"
|
||||
}`}
|
||||
>
|
||||
Disabled
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-row h-full justify-center items-center ml-auto mr-2">
|
||||
<p className="text-white text-lg p-2 mr-2 border-r-2 border-r-white text-nowrap">
|
||||
Injection Type:
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,13 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CDRM Decryption Extension</title>
|
||||
<script type="module" crossorigin src="./assets/index-CN3ssfBX.js"></script>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CDRM Decryption Extension</title>
|
||||
<script type="module" crossorigin src="./assets/index-ydPQKJSy.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-UaipKa9p.css">
|
||||
</head>
|
||||
<body class="min-w-full min-h-full w-full h-full">
|
||||
<div class="min-w-full min-h-full w-full h-full" id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
</head>
|
||||
<body class="min-w-full min-h-full w-full h-full">
|
||||
<div class="min-w-full min-h-full w-full h-full" id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user