Giter Club home page Giter Club logo

electron-chrome-extension's People

Contributors

alexstrat avatar dependabot[bot] avatar hugomano avatar magne4000 avatar nacryn avatar v-zhzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-chrome-extension's Issues

Gmelius not working

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.

Local Extension Path?

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.

License Question

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

SyntaxError: Cannot use import statement outside a module

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!

Missing module '@electron/internal/browser/ipc-main-internal'

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.

Refactoring chrome-extension.js

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:

  • reading and interpreting manifest.json
  • starting background pages
  • instantiating API handlers via (fairly recent) ChromeAPIHandler for storage, webRequest, windows
  • defining some API handlers (legacy, to be moved to ChromeAPIHandler) for runtime, tabs, web navigation (others ?)
  • doing content scrips injection
  • doing content-security injection (?): seems very hacky
  • load devtools extension: hacky, needs to be done via support of chrome.devtools APIs
  • (outside chrome-extension.js): serve chrome-extension://* in engine/protocol

These responsibilities could be split into several modules.

Mixmax

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

Related issues: #2 #3

Bug: npm start

 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

TypeError: process.electronBinding is not a function

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)

Bug: Error: Cannot find module 'tslib'

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)

Rapportive

Implementation notes:

Rapportive is loading external content from https://rapportive.com/load/launchpad that are whiltlisted in manifest's permissions.
However, we don't support permissions.
The dangerous trick is to disable webSecurity.

see electron/electron#10180

Cannot read property 'origin' of undefined

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.

TypeError: ECx.load is not a function

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.