-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add default plugins to extension bundle (#93)
- Loading branch information
Showing
14 changed files
with
100 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
"redux-thunk": "^2.4.2", | ||
"tailwindcss": "^3.3.3", | ||
"tlsn-js": "0.1.0-alpha.6.2", | ||
"tlsn-jsV5.3": "npm:[email protected].3" | ||
"tlsn-js-v5": "npm:[email protected].4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.12", | ||
|
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
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
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,29 @@ | ||
import { addPlugin, addPluginConfig, addPluginMetadata } from '../db'; | ||
import { getPluginConfig } from '../../../utils/misc'; | ||
|
||
export async function installPlugin( | ||
urlOrBuffer: ArrayBuffer | string, | ||
origin = '', | ||
filePath = '', | ||
metadata: {[key: string]: string} = {}, | ||
) { | ||
let arrayBuffer; | ||
|
||
if (typeof urlOrBuffer === 'string') { | ||
const resp = await fetch(urlOrBuffer); | ||
arrayBuffer = await resp.arrayBuffer(); | ||
} else { | ||
arrayBuffer = urlOrBuffer; | ||
} | ||
|
||
const config = await getPluginConfig(arrayBuffer); | ||
const hex = Buffer.from(arrayBuffer).toString('hex'); | ||
const hash = await addPlugin(hex); | ||
await addPluginConfig(hash!, config); | ||
await addPluginMetadata(hash!, { | ||
...metadata, | ||
origin, | ||
filePath, | ||
}); | ||
return hash; | ||
} |
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
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