Skip to content

Instantly share code, notes, and snippets.

@arcolife
Created June 28, 2022 06:54
Show Gist options
  • Save arcolife/4d2c5a557549a7e9066eebb8c5ceabec to your computer and use it in GitHub Desktop.
Save arcolife/4d2c5a557549a7e9066eebb8c5ceabec to your computer and use it in GitHub Desktop.
PSI browser extension V3 new modified
var ports = {};
var listeners = {
};
var contextMenuID = '4353455656';
var currentPort;
chrome.contextMenus.create({
title: 'Share window,tab or desktop',
id: contextMenuID
}, function () {
chrome.contextMenus.onClicked.addListener(captureDesktop);
chrome.action.onClicked.addListener(captureDesktop);
});
function captureDesktop(portId) {
currentPort = portId;
chrome.tabs.query({ active: true }, function (t) {
chrome.desktopCapture.chooseDesktopMedia(["screen"], t[0], onApproved);
});
}
function onApproved(desktopId) {
if (!desktopId) {
return;
}
if (listeners.hasOwnProperty("postDesktopId"))
listeners["postDesktopId"](desktopId);
}
chrome.runtime.onConnectExternal.addListener(function (port) {
var portId_ = port.portId_;
ports[portId_] = port;
port.onDisconnect.addListener(function () {
delete ports[portId_];
});
port.onMessage.addListener(function (message, sender) {
captureDesktop();
listeners["postDesktopId"] = function (a) {
ports[port.portId_].postMessage({ desktopId: a });
};
});
});
{
"background": {
"service_worker": "main.js"
},
"description": "Video/Audio screen sharing extension for InnovativeExams.com",
"externally_connectable": {
"matches": [ "*://localhost:*/*", "*://*.innexam.com/*", "*://*.xamhub.com/*", "*://*.exambooth.com/*", "*://*.examslocal.com/*" ]
},
"icons": {
"128": "img/icon-128.png"
},
"manifest_version": 3,
"name": "ExamsLocal modified",
"permissions": [ "tabs", "desktopCapture", "contextMenus" ],
"version": "2.0",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhw7L48HJnEKX34vO/5rTOeJaga8al5aGP9624rvMGYrQ6vbUjPO+dsONrcw6yIT+nGznSQixDiKyq90inPpO/hu1+TyqvIKcXCuul1hv3G85l4RSzm04KaJUY2gjUx0HbN8WpTZAts2bTLfJ7XQj0sYbME53LHHUHStHXv88/K8jrmcDFvJtk6flpTYyWPckLY1uSxxP3H/JAVPsllXKqOqTfhFB5IG9Q75hcYO3qCH0Ke9XPm729t1UK8RwE7AuZTdt1/OLFTW0cdn84KBC7i3gWcfFe3R9vuGV2G6s/qTasoFF661iW6J284QljjYiYWTOV7DHGpS85u245SazlQIDAQAB",
"web_accessible_resources": [{
"resources":[ "img/icon-64.png", "img/icon-16.png", "img/video.png" ],
"matches": [ "*://localhost:*/*", "*://*.innexam.com/*", "*://*.xamhub.com/*", "*://*.exambooth.com/*", "*://*.examslocal.com/*" ]
}]
}
@arcolife
Copy link
Author

dir tree

│   ├── img
│   │   ├── icon-128.png
│   │   ├── icon-16.png
│   │   ├── icon-64.png
│   │   ├── icon-72.png
│   │   └── video.png
│   ├── main.js
│   └── manifest.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment