Auto-detect licenseURL and scheme

This commit is contained in:
FoxRefire
2024-04-28 11:50:53 +09:00
parent 7a3df8a64b
commit 60e5e46a0f
2 changed files with 26 additions and 3 deletions

View File

@@ -43,6 +43,26 @@ window.corsFetch = (u, m, h, b) => {
})
}
async function autoSelect(){
let selectRules = await fetch("selectRules.conf").then((r)=>r.text());
selectRules = selectRules.replace(/\n^$/gm, "");
selectRules=selectRules.split("\n").map(function(row){return row.split("$$");});
for(var item of selectRules){
let search = requests.map(r => r['url']).findIndex(e => e.includes(item[0]));
if(search>=0){
if(item[1]) document.getElementById("scheme").value = item[1];
requestList.children[search].click();
break;
}
}
if(psshs.length==1){
document.getElementById('pssh').value=psshs[0];
}
if(requests.length==1){
requestList.children[0].click();
}
}
if(psshs.length!=0){
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('noEME').style.display='none';
@@ -51,8 +71,6 @@ if(psshs.length!=0){
document.getElementById('result').addEventListener("click", copyResult);
drawList(psshs,'psshSearch','psshList','pssh');
drawList(requests.map(r => r['url']),'requestSearch','requestList','license');
if(psshs.length==1){
document.getElementById('pssh').value=psshs[0];
}
autoSelect();
});
}

5
selectRules.conf Normal file
View File

@@ -0,0 +1,5 @@
cwip-shaka-proxy
c4.eme.lp.aws.redbee$$RedBee
lic.staging.drmtoday$$DRMToday
license-ap
licenseManager.do