initial commit

This commit is contained in:
Sam
2023-03-26 17:31:42 -04:00
commit e3b5b090fb
51 changed files with 4222 additions and 0 deletions

12
extension/background.js Normal file
View File

@ -0,0 +1,12 @@
let port = null;
browser.runtime.onMessage.addListener(message => {
if (port == null || port.error) {
port = browser.runtime.connectNative('cheetah');
}
try {
port.postMessage(message);
} catch (error) {
port = null;
}
});

23
extension/cheetah.js Normal file
View File

@ -0,0 +1,23 @@
let updateFrequency = 1000;
function update() {
let editor = window.wrappedJSObject.editor;
if (!editor) {
return;
}
let modeId = document.querySelector('.react-monaco-editor-react')?.dataset.modeId;
let fileUri = document.querySelector('.monaco-editor[role="code"]')?.dataset.uri;
let terminal = document.querySelector('.terminal .xterm-accessibility')?.innerText.trim();
let message = {
mode: modeId,
files: { [fileUri]: editor.getValue() },
logs: { terminal }
};
message.navigationStart = performance.timing.navigationStart;
browser.runtime.sendMessage(message);
}
setInterval(update, updateFrequency);

BIN
extension/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

35
extension/manifest.json Normal file
View File

@ -0,0 +1,35 @@
{
"description": "Cheetah browser extension",
"manifest_version": 2,
"name": "Cheetah",
"version": "1.0",
"homepage_url": "https://phrack.org",
"icons": {
"48": "icon.png"
},
"content_scripts": [
{
"matches": [
"*://localhost/*",
"https://app.coderpad.io/*"
],
"js": [
"cheetah.js"
]
}
],
"browser_specific_settings": {
"gecko": {
"id": "cheetah@phrack.org",
"strict_min_version": "50.0"
}
},
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"nativeMessaging"
]
}