getstation / electron-chrome-extension Goto Github PK
View Code? Open in Web Editor NEWImplementation of Chrome extension APIs for Electron
Implementation of Chrome extension APIs for Electron
I don't have the stack-trace at the time of writing, but please complete with it. The issue seem to come from CSP problematics.
Gmelius use the content_security_policy
key in its manifest: see here.
I think this issue is linked: electron/electron#10180
I realized that started working on this and let let hanging. I committed as it (don't remember if it worked) and push on this branch: add-web-frame-add-origin-access-whitelist-entry
.
This should be used on used in the electron-chrome-extension
pacakage to support the content_security_policy
key.
Related: #4
I was wondering if you can use this to load a local extension (like one not on the webstore). Right now I am trying but I get this error:
(node:13020) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'scanInstalledExtensions' of undefined
at ECx.<anonymous> (C:\path\electron-chrome-extension\lib\browser\engine\api.js:30:36)
at Generator.next (<anonymous>)
at C:\path\node_modules\tslib\tslib.js:110:75
at new Promise (<anonymous>)
at Object.__awaiter (C:\Users\BakedPotato\Desktop\surviv-bot\my-app\node_modules\tslib\tslib.js:106:16)
at ECx.load (C:\path\node_modules\electron-chrome-extension\lib\browser\engine\api.js:28:24)
at App.createWindow (C:\path\src\index.js:12:6)
at App.emit (events.js:199:15)
(node:13020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit
code.
Hi there!
Do you guys have a particular license for this product? Was interested in using it, but wanted to make sure it was okay! 🤓
A
Hello, thanks for you great job I just installed the extension but seems I cannot have it working while my new tab page is on another extension, any solution for this?
Trying to import ECx, I have import ECx from 'electron-chrome-extension';
at the top of my main.js and I get a SyntaxError: Cannot use import statement outside a module
. I think I'm not doing something correctly but unfortunately I can't figure out what I'm doing wrong.
Thank you!
Extension id: ndnaehgpjlnokgebbaldlmgkapkpjkkb
Chrome Webstore
Extension id: kgjfgplpablkjnlkjmjdecgdpfankdle
Chrome webstore
Hi there. Recently found this and decided to try it out. Ran the application and I got this error. @electron/internal/browser/ipc-main-internal
, I then tried to npm i
it, however got this error Could not install from "@electron\internal\browser\ipc-main-internal" as it does not contain a package.json file.
chrome-extension.js
is a big, but ugly, file that holds big parts of logic. If we want to make the lib more easy to work on, we should refactor this file.
chrome-extension.js
expose 2 public APIs:
addExtension(extensionId, srcDirectory)
removeExtension(extensionId)
addExtension
is responsible for:
manifest.json
ChromeAPIHandler
for storage
, webRequest
, windows
ChromeAPIHandler
) for runtime
, tabs
, web navigation
(others ?)chrome.devtools
APIschrome-extension.js
): serve chrome-extension://*
in engine/protocol
These responsibilities could be split into several modules.
Extension id: gkjnkapjmjfpipfcccnjbjcbgdnahpjp
Chrome Webstore
Extension id: mdanidgdpmkimeiiojknlnekblgmpdll
Chrome Webstore
Implementation notes:
Mixmax is using
chrome.storage.onChanged.addListener
, but looks like using a shim is enough.
Overide user-agent to remove any mention of Electron:session.setUserAgent(userAgent.replace(/Electron\/\S*\s/, ''))
I had to dummy-implement various APIs:
chrome.storage.onChanged.addListener
chrome.tabs.query
chrome.browserAction
(no real sense in context of electron)chrome.notifications
chrome.webRequest
=> not sure how it impactcs the execution of the app but seems to work
Extension id: oiiaigjnkhngdbnoookogelabohpglmd
Chrome Webstore
Extension id: hgmhmanijnjhaffoampdlllchpolkdnj
Chrome Webstore
Extension id: mdanidgdpmkimeiiojknlnekblgmpdll
Chrome Webstore
Extension id: pnnfemgpilpdaojpnkjdgfgbnnjojfik
Chrome Webstore
shihong@shihongdeMacBook-Pro ~/Work/github/electron-chrome-extension master ● npm start
> [email protected] prestart /Users/shihong/Work/github/electron-chrome-extension
> rm -rf ./lib/ && tsc -p .
node_modules/[email protected]@p-queue/index.d.ts:79:47 - error TS2344: Type 'DefaultAddOptions' does not satisfy the constraint 'QueueAddOptions'.
Index signature is missing in type 'DefaultAddOptions'.
79 EnqueueOptionsType extends QueueAddOptions = DefaultAddOptions
so what's wrong with me? @hugomano
After installing tslib which is a dependency and running npm start, it gets me the error below.
I used const ECx = require("electron-chrome-extension").default;
import didn't work for me any possible way this is a mistake on my end?
App threw an error during load TypeError: process.electronBinding is not a function at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/chrome-extension.js:2:39) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/engine/api.js:5:28) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) A JavaScript error occurred in the main process Uncaught Exception: TypeError: process.electronBinding is not a function at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/chrome-extension.js:2:39) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/engine/api.js:5:28) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) (node:23165) UnhandledPromiseRejectionWarning: TypeError: process.electronBinding is not a function at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/chrome-extension.js:2:39) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/john/Desktop/genericsoundcloudclient/node_modules/electron-chrome-extension/lib/browser/engine/protocol.js:12:28) at Module._compile (node:internal/modules/cjs/loader:1118:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at c._load (node:electron/js2c/asar_bundle:5:13343) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) (Use
electron --trace-warnings ...to show where the warning was created) (node:23165) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Replicated here, just yarn install
and yarn start
Node version v13.0.1, MacOS 10.14.5
This is a barebones Electron app that does zilch else; only yarn install electron-chrome-extension
. Adding this module breaks yarn start
with the following error on console:
$ yarn start
yarn run v1.17.3
warning package.json: No license field
$ electron .
App threw an error during load
Error: Cannot find module 'tslib'
Require stack:
- ./electron-hello-world/node_modules/electron-chrome-extension/lib/browser/index.js
- ./electron-hello-world/node_modules/electron-chrome-extension/index.js
- ./electron-hello-world/main.js
- ./electron-hello-world/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:717:15)
at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7615:16)
at Module._load (internal/modules/cjs/loader.js:622:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/Users/nickbarone/ecosystems/comake/electron-hello-world/node_modules/electron-chrome-extension/lib/browser/index.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
Implementation notes:
Rapportive is loading external content from
https://rapportive.com/load/launchpad
that are whiltlisted in manifest'spermissions
.
However, we don't supportpermissions
.
The dangerous trick is to disablewebSecurity
.
Extension id: hpfmedbkgaakgagknibnonpkimkibkla
Chrome Webstore
Extension id: fdkgjhmihbfpjgodmbmmmgmgnmemokda
Chrome Webstore
Stack trace:
at session.webRequest.onBeforeSendHeaders.origin (./electron-hello-world/node_modules/electron-chrome-extension/lib/browser/engine/webRequest.js:86:32)
at ./electron-hello-world/node_modules/electron-better-web-request/lib/electron-better-web-request.js:177:17
at new Promise (<anonymous>)
at Object.apply (./electron-hello-world/node_modules/electron-better-web-request/lib/electron-better-web-request.js:175:22)
at defaultResolver (./electron-hello-world/node_modules/electron-better-web-request/lib/electron-better-web-request.js:9:17)
at BetterWebRequest.<anonymous> (./electron-hello-world/node_modules/electron-better-web-request/lib/electron-better-web-request.js:151:40)
at Generator.next (<anonymous>)
at ./electron-hello-world/node_modules/tslib/tslib.js:110:75
at new Promise (<anonymous>)
at Object.__awaiter (./electron-hello-world/node_modules/tslib/tslib.js:106:16)
Which is here (I think), and you can find the reproducing project here, electron-chrome-extension branch.
It looks like ECX is expecting headers to be set, but it's not clear to me why it's expecting that, or where that's supposed to happen either in this library or in the usage code.
Happens w/ Slack
Mixmax injects content_scrips
on <all_urls>
and it use jQuery. Since we do not run content scripts in isolated world, it overrides jQuery version of other applications and make them fail.
Fix coming in electron/electron#10404
Extension id: dpdmhfocilnekecfjgimjdeckachfbec
Chrome Webstore
Extension id: kbfnbcaeplbcioakkpcpgfkobkghlhen
Chrome Webstore
Extension id: jpbnpbfpgjkblmejlgkfkekajajhjcid
Chrome Webstore
Replicated here; yarn install
$ yarn start
yarn run v1.17.3
$ electron .
(node:58020) ProtocolDeprecateCallback: The callback argument of protocol module APIs is no longer needed.
(node:58020) ProtocolDeprecateCallback: The callback argument of protocol module APIs is no longer needed.
(node:58020) UnhandledPromiseRejectionWarning: TypeError: ECx.load is not a function
at App.createWindow (./electron-hello-world/main.js:23:13)
at App.emit (events.js:208:15)
Extension id: lmcngpkjkplipamgflhioabnhnopeabf
Chrome Webstore
Hello,
Unable to request this extension via AppImage, so am opening this PR.
Thanks in advance!
https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en-US
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.