diff --git a/js/background.js b/js/background.js index a18d535e..e491d628 100644 --- a/js/background.js +++ b/js/background.js @@ -420,12 +420,12 @@ chrome.runtime.onMessage.addListener(function (Message, sender, sendResponse) { } // ffmpeg网页通信 if (Message.Message == "catCatchFFmpeg") { - const data = { ...Message, Message: "ffmpeg", tabId: Message.tabId ?? sender.tab.id, version: ffmpegConfig.version }; - chrome.tabs.query({ url: ffmpegConfig.url }, function (tabs) { + const data = { ...Message, Message: "ffmpeg", tabId: Message.tabId ?? sender.tab.id, version: G.ffmpegConfig.version }; + chrome.tabs.query({ url: G.ffmpegConfig.url }, function (tabs) { if (chrome.runtime.lastError || !tabs.length) { - chrome.tabs.create({ url: ffmpegConfig.url, active: Message.active ?? true }, function (tab) { - ffmpegConfig.tab = tab.id; - ffmpegConfig.data = data; + chrome.tabs.create({ url: G.ffmpegConfig.url, active: Message.active ?? true }, function (tab) { + G.ffmpegConfig.tab = tab.id; + G.ffmpegConfig.data = data; }); return true; } @@ -562,11 +562,11 @@ chrome.commands.onCommand.addListener(function (command) { }); chrome.webNavigation.onCompleted.addListener(function (details) { - if (ffmpegConfig.tab && details.tabId == ffmpegConfig.tab) { + if (G.ffmpegConfig.tab && details.tabId == G.ffmpegConfig.tab) { setTimeout(() => { - chrome.tabs.sendMessage(details.tabId, ffmpegConfig.data); - ffmpegConfig.data = undefined; - ffmpegConfig.tab = 0; + chrome.tabs.sendMessage(details.tabId, G.ffmpegConfig.data); + G.ffmpegConfig.data = undefined; + G.ffmpegConfig.tab = 0; }, 500); } }); diff --git a/js/download.js b/js/download.js index f74ad761..b4d27356 100644 --- a/js/download.js +++ b/js/download.js @@ -27,7 +27,7 @@ function start() { $("#downStream").prop("checked", G.downStream); $(``).appendTo("head"); // 流式下载服务端 - streamSaver.mitm = streamSaverConfig.url; + streamSaver.mitm = G.streamSaverConfig.url; chrome.tabs.getCurrent(function (tab) { startDownload(tab.id); @@ -239,7 +239,7 @@ function startDownload(tabId) { }); } function sendFile(action = "addFile") { - chrome.tabs.query({ url: ffmpegConfig.url }, function (tabs) { + chrome.tabs.query({ url: G.ffmpegConfig.url }, function (tabs) { if (tabs.length && tabs[0].status != "complete") { setTimeout(() => { sendFile(action); diff --git a/js/init.js b/js/init.js index a55713f6..94876aa8 100644 --- a/js/init.js +++ b/js/init.js @@ -147,13 +147,13 @@ G.scriptList.set("recorder2.js", { key: "recorder2", refresh: false, allFrames: G.scriptList.set("webrtc.js", { key: "webrtc", refresh: true, allFrames: true, world: "MAIN", name: i18n.recordWebRTC, off: i18n.closeRecording, i18n: true, tabId: new Set() }); // ffmpeg -const ffmpegConfig = { +G.ffmpegConfig = { tab: 0, version: 1, url: "https://ffmpeg.bmmmd.com/", } // streamSaver 边下边存 -const streamSaverConfig = { +G.streamSaverConfig = { url: "https://stream.bmmmd.com/mitm.html" } diff --git a/js/m3u8.js b/js/m3u8.js index 9e6fdb71..6b19bb96 100644 --- a/js/m3u8.js +++ b/js/m3u8.js @@ -1653,7 +1653,7 @@ function initDownload() { // 流式下载 function createStreamSaver(url) { - streamSaver.mitm = streamSaverConfig.url; + streamSaver.mitm = G.streamSaverConfig.url; const ext = $("#mp4").prop("checked") ? "mp4" : GetExt(url); return streamSaver.createWriteStream(`${GetFileName(url)}.${ext}`).getWriter(); } diff --git a/js/popup.js b/js/popup.js index 7e8d5ddb..328f8beb 100644 --- a/js/popup.js +++ b/js/popup.js @@ -559,7 +559,7 @@ if (G.isFirefox) { $("[go]").click(function () { let url = this.getAttribute("go"); if (url == "ffmpegURL") { - chrome.tabs.create({ url: ffmpegConfig.url }) + chrome.tabs.create({ url: G.ffmpegConfig.url }) return; } // isPopup ? chrome.tabs.update({ url: url }) : chrome.tabs.create({ url: url });