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