feat: disabled enabledOrigins handling and clean up unused code in webrtc-internals-exporter
This commit is contained in:
@@ -15,11 +15,7 @@ const DEFAULT_OPTIONS = {
|
|||||||
updateInterval: 2,
|
updateInterval: 2,
|
||||||
gzip: false,
|
gzip: false,
|
||||||
job: "webrtc-internals-exporter",
|
job: "webrtc-internals-exporter",
|
||||||
enabledOrigins: {
|
enabledOrigins: { },
|
||||||
"http://*/*": true,
|
|
||||||
"https://*/*": true,
|
|
||||||
"https://tube.kobim.cloud": true,
|
|
||||||
},
|
|
||||||
enabledStats: ["data-channel", "local-candidate", "remote-candidate"]
|
enabledStats: ["data-channel", "local-candidate", "remote-candidate"]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +44,7 @@ async function updateTabInfo(tab) {
|
|||||||
const tabId = tab.id;
|
const tabId = tab.id;
|
||||||
const origin = new URL(tab.url || tab.pendingUrl).origin;
|
const origin = new URL(tab.url || tab.pendingUrl).origin;
|
||||||
|
|
||||||
if (options.enabledOrigins && options.enabledOrigins[origin] === true) {
|
if (options.enabledOrigins) {
|
||||||
const { peerConnectionsPerOrigin } = await chrome.storage.local.get(
|
const { peerConnectionsPerOrigin } = await chrome.storage.local.get(
|
||||||
"peerConnectionsPerOrigin",
|
"peerConnectionsPerOrigin",
|
||||||
);
|
);
|
||||||
|
@@ -46,8 +46,7 @@ if (window.location.protocol.startsWith("http")) {
|
|||||||
log(`options loaded:`, ret);
|
log(`options loaded:`, ret);
|
||||||
options.url = ret.url || "";
|
options.url = ret.url || "";
|
||||||
options.enabled =
|
options.enabled =
|
||||||
ret.enabledOrigins &&
|
ret.enabledOrigins;
|
||||||
ret.enabledOrigins[window.location.origin] === true;
|
|
||||||
options.updateInterval = (ret.updateInterval || 2) * 1000;
|
options.updateInterval = (ret.updateInterval || 2) * 1000;
|
||||||
options.enabledStats = Object.values(ret.enabledStats || {});
|
options.enabledStats = Object.values(ret.enabledStats || {});
|
||||||
sendOptions();
|
sendOptions();
|
||||||
|
@@ -65,7 +65,6 @@ class WebrtcInternalExporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (stats.length !== 0) {
|
|
||||||
window.postMessage(
|
window.postMessage(
|
||||||
{
|
{
|
||||||
event: "webrtc-internal-exporter:peer-connections-stats",
|
event: "webrtc-internal-exporter:peer-connections-stats",
|
||||||
@@ -75,7 +74,6 @@ class WebrtcInternalExporter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
log(`Stats collected:`, stats);
|
log(`Stats collected:`, stats);
|
||||||
//}
|
|
||||||
|
|
||||||
setTimeout(this.collectAllStats.bind(this), this.updateInterval);
|
setTimeout(this.collectAllStats.bind(this), this.updateInterval);
|
||||||
return stats;
|
return stats;
|
||||||
|
Reference in New Issue
Block a user