Files
Vineless/message_proxy.js
Ingan121 4912da3def * Fix long domains looking ugly
* Update panel icon more frequently
* Misc security improvements by preventing potential (low possibility?) xss in the panel, and blocking panel only messages sent from the content script
* Tried to add mobile browser support but turns out most of them lacks CK support
  * Added feature to download and import remotely hosted CDM files, for browsers with borked file pickers
2025-08-12 23:52:37 +09:00

24 lines
723 B
JavaScript

async function processMessage(detail) {
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({
type: detail.type,
body: detail.body,
from: "content"
}, (response) => {
if (chrome.runtime.lastError) {
return reject(chrome.runtime.lastError);
}
resolve(response);
});
})
}
document.addEventListener('response', async (event) => {
const { detail } = event;
const responseData = await processMessage(detail);
const responseEvent = new CustomEvent('responseReceived', {
detail: detail.requestId.concat(responseData)
});
document.dispatchEvent(responseEvent);
});