-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRITICAL UPDATE CHANGES - reconstructred recordmanager, removed elect…
…ron dependency, implemented websocket communication between chrome extension and server in order recorder work properly, added module to pack chrome extension, refactoring, fixed bugs and added comments
- Loading branch information
Showing
29 changed files
with
1,676 additions
and
2,456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const ChromeExtension = require("crx"); | ||
const crypto = require("node:crypto"); | ||
const path = require("node:path"); | ||
const fs = require("node:fs"); | ||
|
||
try { | ||
const private_key_path = path.resolve( | ||
__dirname, | ||
"src", | ||
"recorder", | ||
"extension", | ||
"key.pem" | ||
); | ||
|
||
const private_key = crypto.generateKeyPairSync("rsa", { | ||
modulusLength: 2048, | ||
privateKeyEncoding: { | ||
type: "pkcs8", | ||
format: "pem", | ||
}, | ||
}).privateKey; | ||
|
||
fs.writeFileSync(private_key_path, private_key); | ||
|
||
const crx = new ChromeExtension({ | ||
codebase: "http://localhost:8000/recorder_extension.crx", | ||
privateKey: fs.readFileSync(private_key_path), | ||
}); | ||
|
||
const source_crx_path = path.resolve( | ||
__dirname, | ||
"src", | ||
"recorder", | ||
"extension/" | ||
); | ||
const output_crx_path = path.resolve( | ||
__dirname, | ||
"dist", | ||
"recorder_extension", | ||
"recorder.crx" | ||
); | ||
|
||
console.log(`packing extension from ${source_crx_path}...`); | ||
crx | ||
.load(source_crx_path) | ||
.then((crx) => crx.pack()) | ||
.then((crxBuffer) => { | ||
fs.writeFileSync(output_crx_path, crxBuffer); | ||
}) | ||
.catch((err) => { | ||
throw err; | ||
}); | ||
} catch (err) { | ||
console.log("Failed to pack recorder extension: ", err.message); | ||
process.exit(1); | ||
} |
Oops, something went wrong.