Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
electron-chrome-extension
Advanced tools
Readme
Tested with Electron v4.0.4
- Node v8.9.0
- NPM v5.5.1
require('electron-chrome-extension/preload');
For some reasons the navigator user agent is not inherited from the session so you will need
to redefine the user agent via the Object.defineProperty
method after the import
import ECx from 'electron-chrome-extension';
app.on('ready', async () => {
createWindow();
// Load Grammarly
await ECx.load('kbfnbcaeplbcioakkpcpgfkobkghlhen');
});
Extensions react to browser events for trigger their own logic. ECx send inner webContents events to extensions subscribers but external events like creating new window, changing tab focus etc should be triggered on your side like this:
// main.js
ipcMain.on('YOUR_EVENT', (...) =>
ECx.sendEvent({
channel: 'tabs.onActivated',
payload: [{ tabId, windowId }],
})
);
⚠️ electron-chrome-extension
will break Electron's support for Devtools extensions.
If you wish to use devtools extensions, make sure to add the prelaod on the Session
itself:
if (isDev) {
app.on('session-created', session => {
session.setPreloads([path.join(__dirname, 'node_modules/electron-chrome-extension/preload')]
});
}
It is not recommended to have the preload added to Sessions
outside developement environnement because it can lead to have extension's code run in priviledged contexts (BrowserWindows
with nodeIntegration
for instance).
Then install Chrome DevTools extensions with electron-chrome-extension
:
import ECx from 'electron-chrome-extension';
// load React Dev Tools
ECx.load('jdkknkkbebbapilgoeccciglkfbmbnfm');
ECx.load(extensionId: IExtension['id']): Promise<IExtension>
ECx.unload(extensionId: IExtension['id']): void
ECx.setConfiguration(configuration: Configuration = {}): Promise<ECx>
ECx.isLoaded(extensionId: IExtension['id']): boolean
ECx.isUpToDate(extensionId: IExtension['id']): Promise<boolean>
ECx.get(extensionId: IExtension['id']): Promise<IExtension>
ECx.sendEvent(event: ExtensionEventMessage): void
$ npm start
You can tweak the playground files at your convenience and extensions would automatically downloaded and clean app data with $ npm run playground:reset
$ npm test
We use electron-mocha for run our test suit. Warning (because not explained in the lib): test assertions lives in the renderer, the main remains accessible for IPC calls and Electron Main API calls.
$ npm publish
as of 05/29/19 with their Chrome WebStore ID
FAQs
Chrome Extensions Engine for Electron
The npm package electron-chrome-extension receives a total of 60 weekly downloads. As such, electron-chrome-extension popularity was classified as not popular.
We found that electron-chrome-extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.