Refactor: Put popup related scripts in popup folder together

This commit is contained in:
FoxRefire 2024-10-13 07:19:34 +09:00
parent b5f06437b6
commit d38718d8f1
8 changed files with 20 additions and 20 deletions

View File

@ -75,13 +75,13 @@ chrome.runtime.onMessage.addListener(
chrome.browserAction.onClicked.addListener(tab => {
if(chrome.windows){
chrome.windows.create({
url: "popup.html",
url: "popup/main.html",
type: "popup",
width: 820,
height: 600
});
} else {
chrome.tabs.create({url: 'popup.html'})
chrome.tabs.create({url: 'popup/main.html'})
}
});

View File

@ -3,7 +3,7 @@
<meta charset="UTF-8">
<title>Widevine L3 Guessor 2024</title>
<link rel="stylesheet" href="style.css">
<script src="libs/pyodide/pyodide.js"></script>
<script src="/libs/pyodide/pyodide.js"></script>
</head>
<body>
<div id="toggleHistory">
@ -81,9 +81,9 @@
<a href="https://github.com/FoxRefire/wvg/archive/=HASH=.zip">Download</a>
</div>
</body>
<script src="popup.js" type="module"></script>
<script src="popup_drawList.js"></script>
<script src="libs/jsonview.js"></script>
<script src="popup_showHistory.js"></script>
<script src="popup_updateNotice.js"></script>
<script src="./main.js" type="module"></script>
<script src="./drawList.js"></script>
<script src="/libs/jsonview.js"></script>
<script src="./showHistory.js"></script>
<script src="./updateNotice.js"></script>
</html>

View File

@ -11,16 +11,16 @@ async function guess(){
//Init Pyodide
let pyodide = await loadPyodide();
await pyodide.loadPackage(["certifi-2024.2.2-py3-none-any.whl","charset_normalizer-3.3.2-py3-none-any.whl","construct-2.8.8-py2.py3-none-any.whl","idna-3.6-py3-none-any.whl","packaging-23.2-py3-none-any.whl","protobuf-4.24.4-cp312-cp312-emscripten_3_1_52_wasm32.whl","pycryptodome-3.20.0-cp35-abi3-emscripten_3_1_52_wasm32.whl","pymp4-1.4.0-py3-none-any.whl","pyodide_http-0.2.1-py3-none-any.whl","pywidevine-1.8.0-py3-none-any.whl","requests-2.31.0-py3-none-any.whl","urllib3-2.2.1-py3-none-any.whl"].map(e=>"libs/wheels/"+e))
await pyodide.loadPackage(["certifi-2024.2.2-py3-none-any.whl","charset_normalizer-3.3.2-py3-none-any.whl","construct-2.8.8-py2.py3-none-any.whl","idna-3.6-py3-none-any.whl","packaging-23.2-py3-none-any.whl","protobuf-4.24.4-cp312-cp312-emscripten_3_1_52_wasm32.whl","pycryptodome-3.20.0-cp35-abi3-emscripten_3_1_52_wasm32.whl","pymp4-1.4.0-py3-none-any.whl","pyodide_http-0.2.1-py3-none-any.whl","pywidevine-1.8.0-py3-none-any.whl","requests-2.31.0-py3-none-any.whl","urllib3-2.2.1-py3-none-any.whl"].map(e=>"/libs/wheels/"+e))
//Configure Guesser
pyodide.globals.set("pssh", document.getElementById('pssh').value);
pyodide.globals.set("licUrl", requests[userInputs['license']]['url']);
pyodide.globals.set("licHeaders", requests[userInputs['license']]['headers']);
pyodide.globals.set("licBody", requests[userInputs['license']]['body']);
let pre=await fetch('python/pre.py').then(res=>res.text())
let after=await fetch('python/after.py').then(res=>res.text())
let scheme=await fetch(`python/schemes/${document.getElementById("scheme").value}.py`).then(res=>res.text())
let pre=await fetch('/python/pre.py').then(res=>res.text())
let after=await fetch('/python/after.py').then(res=>res.text())
let scheme=await fetch(`/python/schemes/${document.getElementById("scheme").value}.py`).then(res=>res.text())
//Get result
let result = await pyodide.runPythonAsync([pre, scheme, after].join("\n"));
@ -52,7 +52,7 @@ window.corsFetch = (u, m, h, b) => {
}
async function autoSelect(){
let selectRules = await fetch("selectRules.conf").then((r)=>r.text());
let selectRules = await fetch("/selectRules.conf").then((r)=>r.text());
//Remove blank lines, comment-outs, and trailing spaces at the end of lines
selectRules = selectRules.replace(/\n^\s*$|\s*\/\/.*|\s*$/gm, "");
selectRules = selectRules.split("\n").map(row => row.split("$$"));

View File

@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', async function() {
cManifest=await fetch("manifest.json").then(r=>r.json());
cManifest=await fetch("/manifest.json").then(r=>r.json());
rManifest=await fetch("https://raw.githubusercontent.com/FoxRefire/wvg/next/manifest.json").then(r=>r.json());
if(cManifest.version < rManifest.version){
let notice = document.getElementById("updateNotice");

View File

@ -14,30 +14,30 @@ def blobsToDevice(cID, pKey):
async def loadCdm():
# Looking for device.wvd
try:
wvd = await (await pyfetch("device.wvd")).bytes()
wvd = await (await pyfetch("/device.wvd")).bytes()
return Cdm.from_device(Device.loads(wvd))
except:
pass
# Looking for device_client_id_blob + device_private_key
try:
cID=await (await pyfetch("device_client_id_blob")).bytes()
pKey=await (await pyfetch("device_private_key")).bytes()
cID=await (await pyfetch("/device_client_id_blob")).bytes()
pKey=await (await pyfetch("/device_private_key")).bytes()
return Cdm.from_device(blobsToDevice(cID, pKey))
except:
pass
# Looking for client_id.bin + private_key.pem
try:
cID=await (await pyfetch("client_id.bin")).bytes()
pKey=await (await pyfetch("private_key.pem")).bytes()
cID=await (await pyfetch("/client_id.bin")).bytes()
pKey=await (await pyfetch("/private_key.pem")).bytes()
return Cdm.from_device(blobsToDevice(cID, pKey))
except:
pass
# Looking for remote.json
try:
remote_conf=await (await pyfetch("remote.json")).json()
remote_conf=await (await pyfetch("/remote.json")).json()
return RemoteCdm(**remote_conf)
except Exception as e:
js.document.getElementById('result').value=f"No CDM key pair found! \n\n https://github.com/FoxRefire/wvg/wiki/Getting-started#2-put-cdm-key-pair-files"