Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thisssky committed Nov 25, 2020
1 parent 8792cbf commit f8ba56b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
20 changes: 17 additions & 3 deletions background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ function blockJS(requestDetails) {
//初始化广告js
var blockjs=[];
async function initBlockJS(){
//blockjs.push("https://www.zxzj.me/");//禁止访问
//blockjs.push("https://www.zxzj.me/slade1.js");//top
//blockjs.push("https://3193.dlads.cn/alikes.php?id=6001");//right

var ad="ad";
await browser.storage.local.get(ad).then(results => {
Expand Down Expand Up @@ -53,11 +50,28 @@ function changeBlockJS(){
blockjs.length=0;
initBlockJS();
}
/*
启动,连接原生应用
*/
var port="";
//接收ad变化消息
function getMessage(msg){
console.log("bget");
if(msg.type=="change"){
changeBlockJS();
}
if(msg.type=="download"){
if(""==port){
port = browser.runtime.connectNative("m3u8");
port.onMessage.addListener((res) => {
if(res.type=="app"){
port.disconnect();
port="";
}
});
}
port.postMessage({"type":"download","url":msg.url});
}
}
browser.runtime.onMessage.addListener(getMessage);

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "HLS",
"description": "HLS",
"version": "0.0.4",
"version": "0.0.5",
"developer": {
"name": "qq1217268470",
"url": "https://github.com/1217268470/webextensions-hls"
Expand Down
12 changes: 2 additions & 10 deletions record/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,10 @@ function quickSort(A, p = 0, r) {
return A;
}


/*
启动,连接原生应用
*/
var port="";

//给background.js通信
function downloadOpt(obj){
if(""==port){
port = browser.runtime.connectNative("m3u8");
}
var url=obj.getAttribute("url");
port.postMessage({"type":"download","url":url});
browser.runtime.sendMessage({"type":"download","url":url});
}

function updateRowIndex(obj) {
Expand Down

0 comments on commit f8ba56b

Please sign in to comment.