Commit Graph

88 Commits

Author SHA1 Message Date
otato.z ef13ff1e1d feat: proxy rules with `--proxy-rules` flag (#854)
See https://electronjs.org/docs/api/session?q=proxy#sessetproxyconfig-callback
2019-10-22 19:38:39 -04:00
Adrian DC 84f06e3e79 app: handle nativefier.json readonly access with options.maximize (#856)
**Resolves #855**

**Example result upon Terminal launch:**

`WARNING: Ignored nativefier.json rewrital (Error: EACCES: permission denied, open '/usr/lib/jupyter-remote-client/resources/app/nativefier.json')`

**Behaviour:**

+ Instead of crashing, the application properly opens and is always maximized.

+ When permissions are R/W, the application is maximized on first launch and the closing states are remembered by the OS throughout launches.
2019-10-22 19:36:40 -04:00
shun e00f08e5d6 Fix filter exception when injecting CSS (PR #837)
When injecting CSS, an `onBeforeRequest paramater 'filter' must have property 'urls'` error is thrown.

![image](https://user-images.githubusercontent.com/599164/63574823-a3dd6180-c5c3-11e9-89c0-a9debdd4f696.png)

This is caused by [Electron PR #19337: Throw on invalid webRequest filters](https://github.com/electron/electron/pull/19337).

So, pass filter argument properly, like Electron expects it strictly.
2019-08-28 07:28:18 -04:00
FabulousCupcake d0a0614ba3 Add --browserwindow-options to completely expose Electron options (PR #835)
This adds a new flag `--browserwindow-options`, taking a stringified JSON object as input.  
It will be inserted directly into the options when BrowserConfig is initialized.

This allows total configurability of the electron BrowserWindow configuration via nativefier.

An example use case is added to the documentation, which modifies the default font family in the browser.

#### References

- https://github.com/electron/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions
  - See the following for electron v3.1.7
  - https://github.com/electron/electron/blob/v3.1.7/docs/api/browser-window.md#new-browserwindowoptions
2019-08-22 21:37:49 +02:00
Umair Ahmed 81c422d4e0 Support setting background color (fixes #795) (PR #819)
Adds a `--background-color` flag for the background of the window when the app isn't loaded.
2019-08-22 21:25:58 +02:00
Adrian DC 5b6cc89f22 Fix #316: Add --clear-cache flag to cleanup session on start/exit ("incognito" mode) (PR #747)
- Add a new `clearCache` option and `--clear-cache` parameter
  to trigger session cleanups upon window launch and close

- Covers the feature request from issue #316 

- Use case example: Forcing authentification / login between sessions without limiting cache size
2019-02-08 10:03:29 -05:00
Dominic Hopton e064f765cb Fix CSS & JavaScript injection (Fixes #703, Fixes #731, PR #732)
* Fix for CSS Injection not working (#703)

Issue:
When using `onHeadersReceived`, the code was passing `null` for the filters.
This appears to trigger behaviour that matches _no_ urls at all.
This results in it never being called to inject the CSS.

Fix:
Pass an empty array instead. Now it's called for all URLs.

Tests pass & linting is clean

* Fix JavaScript injection (#731)

Issue:
It appears that on low endd evices (Core m3 MacBook), the attachment to
`DOMContentLoaded` happens _after_ the event has been raised, so does
not have a chance to inject the script.

Fix:
Move the attachment to the top of the file -- before the imports. This
triggers a bunch of linting erros, so also added disablement inplace.

Additional:
Clarified when the injected JS gets loaded, and what it can assume about
the DOM.
2019-01-01 23:38:45 -05:00
Felix Eckhofer 8600c78d1a Add --start-in-tray CLI flag to let app start in background (PR #564, Fixes #522) 2018-12-01 14:04:55 -05:00
Luccas Clezar 114b4a9724 Fix CSS injection broken with Electron 3 (PR #709, Fixes #703)
See Electron 3.0 breaking API changes:
https://electronjs.org/blog/electron-3-0#breaking-api-changes

  [#12477] https://github.com/electron/electron/pull/12477
           refactor: removed `did-get-response-details` and `did-get-redirect-request events`
2018-11-30 21:14:20 -05:00
Sascha Ißbrücker 27ea3fc4a3 Show application window on notification click (#640) 2018-08-22 16:06:44 -04:00
Ronan Jouchet 19561e9ad6 Make eslint happy 2018-07-21 09:16:02 -04:00
David Kramer c065cad01a Fix #633 - "Copy Current URL" causing TypeError(#634)
When the `getCurrentUrl` function was refactored to make use of the `withFocusedWindow` function in ac99c6424d, it stopped returning a value and broke the "Copy Current URL" feature (#633).

This change restores the original behavior of the getCurrentURL function and makes the "Copy Current URL" feature functional again.
2018-06-14 08:06:30 -04:00
Khai Nguyen b8c1d35ba4 Add --title-bar-style flag (macOS only) (PR#627) 2018-05-31 08:05:12 -04:00
David Kramer 9e587e5fe3 Fix #610 - Make the counter regexp allow punctuation (#626)
When using an app such as Gmail, the unread count is included in the title, and the --counter feature displays that number on the dock icon. However, when the number is larger than 999, it includes commas in the number (e.g. "1,000"), and the number is no longer displayed on the dock icon, because the regular expression used to detect the counter value does not permit punctuation. This change modifies the regular expression used to match the counter value to permit "." and ",".
2018-05-28 08:14:54 -04:00
David Kramer aa243b6f80 Fix sites that use about:blank redirect technique (#623)
* Fix sites that use about:blank redirect technique

When you open some links with Google Calendar, instead of opening the link directly, the site opens a new window with the location 'about:blank' and then sets the new window's document content to include a refresh directive to open the actual link. This change causes the 'about:blank' links to be handled internally so that the technique can actually work.

* Hide 'about:blank' windows while they perform the redirect

After a new window is created for an 'about:blank' link, the redirect occurs, which causes another window to be opened. This change causes the 'about:blank' to be created hidden, and then closed entirely once the redirect finishes.

* Add tests for `linkIsInternal`

* Refactor onNewWindow to make it testable
2018-05-27 17:18:59 -04:00
David Kramer bde4ea68fd Force all external links to be opened externally (#624) 2018-05-27 14:04:08 -04:00
David Kramer 1afc480923 Fix #621 - Always open external links externally (#622)
The tab feature introduced by #579 included a change that checks the `disposition` parameter and conditionally creates tabs, and that check was placed prior to the check to see if the URL is internal. This change moves the `linkIsInternal()` check earlier so that external links are always opened externally, regardless of disposition.
2018-05-27 14:02:23 -04:00
David Kramer 587d615085 Fix #616 - Only override the default window opening behavior when necessary (#620)
As part of #591, all window creation was routed through a createNewWindow function.  That change introduced the regression reported in #616 in which popup windows could not communicate with their parent windows. This change reverts that behavior for windows opened via JavaScript (that aren't being opened as tabs and aren't being opened in external browsers), thereby fixing the reported regression.
2018-05-26 22:50:36 -04:00
Goh Jia Hao 95fc46d38d Integrate prettier 2018-05-24 00:02:44 -07:00
David Kramer 69a5b2cbbe Fix Gmail complaining window creation was prevented by a popup blocker (PR #603)
By changing incorrect window `guest` property to `newGuest`. See
https://github.com/electron/electron/blob/master/docs/api/web-contents.md#event-new-window

> Calling `event.preventDefault()` will prevent Electron from 
> automatically creating a new BrowserWindow. If you call
> `event.preventDefault()` and manually create a new BrowserWindow
> then you must set `event.newGuest` to reference the new BrowserWindow
> instance, failing to do so may result in unexpected behavior.
2018-05-10 23:54:34 -04:00
David Kramer ac99c6424d macOS: Add native tabs (PR #579)
Electron supports using native tabs on macOS (API added in Electron 1.8.1). This change adds a context menu item on platforms that support it (macOS for now) to open links in new tabs, and also adds support for {command,middle}-clicking links to open them in a new tab.

Maintainer (@ronjouch) note: this feature is macOS-only. Windows/Linux patches welcome 🙂.
2018-05-01 19:24:35 -04:00
David Kramer 0848143096 Fix #590, Fix #439 - Ensure children windows have the same behavior as the mainWindow (PR #591) 2018-04-30 21:36:45 -04:00
David Kramer ec1023d7ef Fix #95, #384 - Use electron-context-menu, supporting cut/copy/paste (PR #588)
The electron-context-menu package uses the context-menu event emitted by WebContents (API added in Electron 1.0.2) to add a general context menu supporting generic actions (e.g. cut/copy/paste) that can be customized. This change replaces the existing context menu, which relies on adding an event listener in preload.js, with one built using the new package.
2018-04-22 19:48:56 -04:00
David Kramer 454ab1e7bd Fix #474: Remember custom zoom level (PR #582)
... by using setZoomFactor instead of sending change-zoom event.
2018-04-22 15:54:29 -04:00
Matt Rose 574205ab0d macOS: Add --bounce option for dock counter (PR #570) 2018-04-14 17:17:25 -04:00
sgroh 46d381481c Fix #549: Add --always-on-top build flag (PR #551) 2018-03-16 18:15:44 -04:00
Matt Harris 28dca8c647 Fix #325 - Add --x and --y window position flags (PR #515) 2017-12-26 13:00:39 -05:00
omouren 1c8d04e532 Fix #486 : --tray flag crashes nativefied app under Windows (PR #495) 2017-11-25 23:27:19 -05:00
Ronan Jouchet 6fb3b92eb8
Upgrade dependencies and default to latest Electron 1.7.9 (PR #483)
* Update deps except eslint
* Update eslint and lint:fix (WIP, needs manual fixing for remaining 44 problems)
* Manually fix remaining eslint errors
* Document deprecation of `version-string` as of electron-packager 9.0.0
* Upgrade to Electron 1.7.9 (chrome-58, node-7.9.0, v8-5.8)
* npm: Disable generation of package-lock.json and gitignore it
  --Trying this, package-lock is a pain in PRs. May not be a good idea
  (obviously we lose deps pinning), will revert if necessary.--
* npm tasks: add dev-up-win for Windows developers,
  and e2e for end-to-end tests. Update docs.
* Move normalizeUrl test to a jest unit test, makes no sense to be in the mocha e2e tests
* Switch from babel-preset-es2015 to babel-preset-env,
  with target.node=4.0. Seem like it's today's most convenient
  way to support the latest ES and let babel transpile to what
  makes sense for our currently minimal node version
2017-11-14 08:05:01 -05:00
omouren 885790bc22 Fix #304 - Add --tray CLI flag to let app running in background on window close. Supports in-title counter. (#457) 2017-10-05 19:32:48 -04:00
Lukas Kurucz 094cac23bc Make title counter regex match '+' after number, used by certain sites (#424) 2017-08-13 21:22:15 -04:00
Brian Blakely 1f07f148c6 Force fullscreen when options.fullScreen is true (#403)
Fixes #402, as electron-window-state does not appear to remember fullscreen in all cases.
2017-08-06 20:01:34 -04:00
Jia Hao Goh 8f78dd03af Update eslint and use Airbnb style
- Add `npm run lint:fix` command
- Cleanup inferIcon.js logic slightly
2017-04-29 22:52:12 +08:00
Ronan Jouchet bbce1e88d4 Fix #253 - Better honor --zoom option. (#347)
* When zooming in/out, start from the options zoom, not 1 (don't jump)
* Add 'Zoom Reset' feature bound to Ctrl+0, with indicative label for non-100% zoom value
2017-04-19 07:47:54 -04:00
Blake Thomson f3293502a7 Fix badge notifications 2016-09-07 17:44:59 -07:00
Lex Neva 9243f6689f add "copy link location" and "--internal-urls <regex>" features (#230)
* add arg to specify pattern for urls to be considered internal

* add 'copy link location' to context menu

* fix lint
2016-08-07 02:03:53 +08:00
Mats Högberg a407b9ea52 Added a --zoom option for setting default zoom (#218)
* Added a --zoom option for setting initial zoom

* Added information about --zoom to documentation
2016-07-12 09:32:40 +08:00
Jia Hao 612da8ce36 Fix/performance issues with FOUC (#214)
Fix/performance issues with FOUC #191
2016-06-16 15:28:36 +08:00
Goh Jia Hao a70433959b Refactor to use ES6 imports for electron modules 2016-05-26 22:50:15 +08:00
Goh Jia Hao 1de9eec356 Implement disabling of developer tools
- Partially addresses #194
2016-05-26 18:02:43 +08:00
Goh Jia Hao 537dc01fd1 Fix linting errors 2016-05-26 18:01:33 +08:00
Goh Jia Hao c3ae29a0ea Fix FOUC #159 2016-05-26 17:41:25 +08:00
Goh Jia Hao 7945f7802e Implement min/max window width and height
Fixes #82
2016-05-26 17:11:51 +08:00
Goh Jia Hao fcab2a9a95 Update browserWindow options to follow new electron api
- Use camel casing instead
2016-05-26 16:52:26 +08:00
Jia Hao 9f3dfdc315 Merge pull request #202 from lexelby/fix-slowdown
Fix deteriorated responsiveness #191 and polluted console #172
2016-05-08 14:26:40 +08:00
Lex Neva 52f7ea511d Revert "Fix FOUC with inject CSS files"
This reverts commit eeb661b6cd.

This was causing CSS to pile up over and over each time javascript did an HTTP request, which resulted in massive slowdown over time.
2016-05-06 09:22:43 -04:00
matthewdias 49ab72352e merge upstream, reverse default 2016-04-25 17:09:01 -05:00
Alexandr Priezzhev f5d6980bfe Merge with upstream/development 2016-04-17 23:33:08 +02:00
Alexandr Priezzhev f7240fb748 Update mainWindow.js 2016-04-17 01:32:52 +02:00
Alexandr Priezzhev 2f769bdb82 Add an option to hide window frame 2016-04-17 00:56:40 +02:00