wvg/popup.js

48 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-04-12 21:05:09 +00:00
import CommonWV from './schemes/CommonWV.js';
2024-04-12 21:20:33 +00:00
import DRMToday from './schemes/DRMToday.js';
2024-04-12 21:05:09 +00:00
2024-04-08 22:58:09 +00:00
let psshs=chrome.extension.getBackgroundPage().getPsshs();
let requests=chrome.extension.getBackgroundPage().getRequests();
function selectPssh(){
document.getElementById('home').style.display='none';
document.getElementById('selectPssh').style.display='block';
}
function selectRequest(){
document.getElementById('home').style.display='none';
document.getElementById('selectRequest').style.display='block';
}
2024-04-09 15:04:17 +00:00
async function guess(){
2024-04-12 21:20:33 +00:00
let WVScheme;
switch (document.getElementById('scheme').value) {
case "CommonWV":
WVScheme=CommonWV;
break;
case "DRMToday":
WVScheme=DRMToday;
break;
}
const result=await WVScheme(document.getElementById('guessr').value,
document.getElementById('pssh').value,
2024-04-09 15:25:35 +00:00
requests[userInputs['license']]['url'],
requests[userInputs['license']]['headers'])
2024-04-09 15:04:17 +00:00
document.getElementById('result').value=result;
2024-04-08 22:58:09 +00:00
}
if(psshs.length!=0){
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('noEME').style.display='none';
document.getElementById('home').style.display='block';
document.getElementById('psshButton').addEventListener("click", selectPssh);
document.getElementById('licenseButton').addEventListener("click", selectRequest);
document.getElementById('guess').addEventListener("click", guess);
drawList(psshs,'psshSearch','psshList','pssh');
drawList(requests.map(r => r['url']),'requestSearch','requestList','license');
if(psshs.length==1){
document.getElementById('pssh').value=psshs[0];
}
2024-04-08 22:58:09 +00:00
});
}