Skip to content

Commit

Permalink
G
Browse files Browse the repository at this point in the history
  • Loading branch information
xifangczy committed Jul 17, 2024
1 parent b6f1844 commit 8a936aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
});
Expand Down
4 changes: 2 additions & 2 deletions js/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function start() {
$("#downStream").prop("checked", G.downStream);
$(`<style>${G.css}</style>`).appendTo("head");
// 流式下载服务端
streamSaver.mitm = streamSaverConfig.url;
streamSaver.mitm = G.streamSaverConfig.url;

chrome.tabs.getCurrent(function (tab) {
startDownload(tab.id);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion js/m3u8.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 8a936aa

Please sign in to comment.