mirror of
https://github.com/Ingan121/Vineless.git
synced 2026-04-03 11:09:41 +00:00
* 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
24 lines
723 B
JavaScript
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);
|
|
});
|