Skip to content

Instantly share code, notes, and snippets.

@arcolife
Created June 28, 2022 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arcolife/84e3a4bac6b4df4331990b6cec7283eb to your computer and use it in GitHub Desktop.
Save arcolife/84e3a4bac6b4df4331990b6cec7283eb to your computer and use it in GitHub Desktop.
PSI browser extension V2 old
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.browserAction.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": {
"persistent": false,
"scripts": [ "js/main.js" ]
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"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"
},
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhw7L48HJnEKX34vO/5rTOeJaga8al5aGP9624rvMGYrQ6vbUjPO+dsONrcw6yIT+nGznSQixDiKyq90inPpO/hu1+TyqvIKcXCuul1hv3G85l4RSzm04KaJUY2gjUx0HbN8WpTZAts2bTLfJ7XQj0sYbME53LHHUHStHXv88/K8jrmcDFvJtk6flpTYyWPckLY1uSxxP3H/JAVPsllXKqOqTfhFB5IG9Q75hcYO3qCH0Ke9XPm729t1UK8RwE7AuZTdt1/OLFTW0cdn84KBC7i3gWcfFe3R9vuGV2G6s/qTasoFF661iW6J284QljjYiYWTOV7DHGpS85u245SazlQIDAQAB",
"manifest_version": 2,
"name": "Innovative Exams Screensharing",
"permissions": [ "tabs", "desktopCapture", "contextMenus" ],
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "1.7",
"web_accessible_resources": [ "img/icon-64.png", "img/icon-16.png", "img/video.png" ]
}
@arcolife
Copy link
Author

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

dir tree

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