Commit Graph

67 Commits

Author SHA1 Message Date
Fabian Wolf cf8e51e7ab
macOS: Fix crash when using --tray (fix #527), and invisible icon (fix #942, fix #668) (#1156)
This fixes:

1. A startup crash on macOS when using the `--tray` option; see #527.
  ![image](https://user-images.githubusercontent.com/22625791/115987741-99544600-a5b6-11eb-866a-dadb5640eecb.png)
2. Invisible tray icon on macOS; see #942 and #668.  
   ![image](https://user-images.githubusercontent.com/22625791/115988276-24364000-a5b9-11eb-80c3-561a8a646754.png)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-04-28 20:25:15 -04:00
Adam Weeden 12c8c9f4cb
API doc: Move misplaced macOS shortcuts doc (PR #1158)
When I added this documentation originally, I guess I placed it in the wrong location.
2021-04-26 12:25:47 -04:00
Chris Dzombak b4ddd6865c
Support defining a custom bookmarks menu (fix #1065) (PR #1155)
This PR adds an optional, customizable menu of predefined bookmarks. In addition to containing a list of bookmarks, this file customizes the name of the menu and (optionally) allows assigning keyboard shortcuts to bookmarks. It adds a new command-line flag, `--bookmarks-menu <string>`, which can be set as the path to a JSON file containing configuration for the bookmarks menu.

Example of such a JSON file:

```json
{
    "menuLabel": "Music",
    "bookmarks": [
        {
            "title": "lofi.cafe",
            "url": "https://lofi.cafe/",
            "type": "link",
            "shortcut": "Cmd+1"
        },
        {
            "title": "beats to relax/study to",
            "url": "https://www.youtube.com/watch?v=5qap5aO4i9A",
            "type": "link",
            "shortcut": "Cmd+2"
        },
        {
            "type": "separator"
        },
        {
            "title": "RÜFÜS DU SOL Live from Joshua Tree",
            "type": "link",
            "url": "https://www.youtube.com/watch?v=Zy4KtD98S2c"
        }
    ]
}
```

## Checks
- [x] `npm run ci` passes

## Notes

Compared to the fork linked in #1065, this PR:
- adds no dependencies
- doesn't currently support submenus (this should be easy enough to add, but I didn't need it)

## Screenshot

<img width="853" alt="screenshot" src="https://user-images.githubusercontent.com/102904/115882015-5493a800-a41a-11eb-85ef-a190f3dbfe76.png">
2021-04-23 21:46:34 -04:00
Adam Weeden 50ce2f81dd
Add a `session-interaction` event to allow injected js to interact with apps Electron `session` object (PR #1132)
As discussed in #283 this PR will allow injected JS to do SOME interaction with the Electron session.

There is a full explanation of what this feature can, and cannot do, with examples in the api.md documentation.

This will provide a path for resolving many of our issues where users may "self-service" the solution by injecting JS that performs the task needed to meet their objectives.

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-03-13 21:24:48 -05:00
Ronan Jouchet 554c70c12d API.md: document Flash deprecation 2021-03-10 23:02:51 -05:00
Ronan Jouchet 12373b620e Doc/API: update outdated --internal-urls "second-level-domain" stuff
See https://github.com/nativefier/nativefier/pull/1126
and c0a6604676
2021-03-10 19:49:22 -05:00
Ronan Jouchet 74a7d3375d App: revert addition of extra flag --internal-login-pages
See discussion at https://github.com/nativefier/nativefier/pull/1124#issuecomment-794751514 :

> @TheCleric I was about to merge this, then reconsidered one little thing (yes I wrote "little", I'm not reconsidering this whole thing 😅).
>
> I'm re-considering having the extra flag. I'm not so sure this will harm a lot of use cases. I'd like to 1. merge this PR, 2. immediately follow up with a small commit removing the flag & adjusting api.md, 3. release with the change well-documented / asking for feedback if this is problematic to anyone. (I'm not asking you any extra work, and like leaving an in-tree commit trace of considering the flag). If people complain with a valid reason, we'll restore the flag with a quick revert, else we're happy with one less flag and a reasonably-handled breaking change.
>
> Thoughts / objections?

Answered by:

> That seems reasonable to me.
>
> [discussion on an extra structured way to pass flags]
2021-03-10 19:36:20 -05:00
Adam Weeden 6f7e80bafd
App: Automatically consider known login pages as internal (fix #706) (PR #1124)
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-03-10 19:20:53 -05:00
Ronan Jouchet c0a6604676
Fix considering "same domain-ish" URLs as internal (PR #1126)
In 6b266b7815, as I got rid of deprecated dep `wurl`, I wrote:

> This one may be problematic, as it used to do TLD stuff:
> https://github.com/websanova/node-url/blob/7982a613bc/wurl.js#L4
>
> So, the new WHATWG-URL-based implementation will consider
> `asana.com` to be "external" to `app.asana.com`, contrarily to before.
> Given the nature of Nativefier, I think it's actually what to expect,
> that in this case you're "out of the app", and in e.g. asana's landing
> page, which you'd expect to see in your browser.

Turns out it's even more problematic: @TheCleric notices in https://github.com/nativefier/nativefier/pull/1124#issuecomment-790279403
that this breaks app `https://evernote.com` doing its login in `www.evernote.com`

The present change fixes this, by behaving mostly similarly to before,
but without re-introducing `wurl` or another dep needing a TLD/SLD list.
2021-03-04 10:00:53 -05:00
Adam Weeden 8f9135312b
Docker: fix Windows builds (fix #997), line endings, switch to Alpine (PR #1122)
- Docker builds for Windows are fixed (fixes #997)
- Switched over to use Alpine (as was indicated as desired in https://github.com/nativefier/nativefier/issues/375#issuecomment-304247033) - which may mean #375 is fixed as well.
- Fixed bug where Docker has the wrong line endings when copying from a Windows host
- Fixed the invalid `arm` arch to `armv7l`
- Add `npm t` to the docker build to ensure tests pass before we start trying to do builds
- Add a message to help the user when trying to build Mac apps on Windows as a non-Admin (currently an unhelpful exception)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-03-02 00:16:30 -05:00
C. Mangla cbb4380583
Icon conversion: support GraphicsMagick in addition to ImageMagick (PR #1002)
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-02-28 14:21:28 -05:00
Adam Weeden adcf21a3df
macOS: Prompt for accessibility permissions if needed by Global Shortcuts using Media Keys (Fix #1120) (PR #1121)
When setting a media key (play, pause, next/previous track) as global shortcut in Mac OS 10.14+, accessibility permissions must be given to the app for it to work (see https://www.electronjs.org/docs/api/global-shortcut?q=MediaPlayPause#globalshortcutregisteraccelerator-callback).

This PR will accomplish the following on generated app launch:
- Check if global shortcuts are being setup
- Check if the host OS is Mac OS
- Check if the global shortcuts were one of the media keys
- If the above are true, check if the app has accessibility permissions
- If the app does not have the accessibility permissions it will ask the user if they would like to be prompted for these permissions, and then ask Mac OS to prompt for accessibility permissions.

~~As well, a new command line flag is added (`--no-accessibility-prompt`) to preventatively suppress these prompts if desired.~~

Screenshots of the new behavior:
![Screen Shot 2021-02-26 at 2 41 21 PM](https://user-images.githubusercontent.com/547567/109356260-76bfde00-784e-11eb-8c36-3a51b911b780.png)
![Screen Shot 2021-02-26 at 2 41 28 PM](https://user-images.githubusercontent.com/547567/109356266-79223800-784e-11eb-94eb-66437c05fd10.png)
![Screen Shot 2021-02-26 at 2 41 50 PM](https://user-images.githubusercontent.com/547567/109356270-7aebfb80-784e-11eb-9e90-e09bb49752c6.png)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-02-28 10:24:14 -05:00
Arseny 380c98b23d
API.md: fix typo in option "-v" (#1114) 2021-02-16 08:02:21 -05:00
Jia Hao 6316d23762 Move to nativefier organization 2021-01-30 04:49:52 +00:00
Matthew Ruzzi e8d3530b43
Warn on old Electron/Chrome (fix #556) (PR #1076)
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2020-11-30 21:45:35 -05:00
erythros bbd51ad988
Support using a Widevine-enabled Electron for DRM playback (fix #435) (PR #1073) 2020-11-21 09:39:07 -05:00
Ronan Jouchet 06369f1213 api.md: document arm64 arch 2020-08-29 16:16:25 -04:00
Joe Skeen 8e8cd24e0d
Add `--block-external-urls` flag to forbid external navigation attempts (Fix #978 - PR#1012)
Fixes #978 

Adds a `--block-external-urls` option (default: `false`) that prevents opening external links (as classified by the `--internal-urls` option).

Documentation and tests updated.


Example:
```
nativefier --internal-urls "classroom\.google\.com" --block-external-urls
```
![image](https://user-images.githubusercontent.com/12286274/88739501-f12d5180-d0f7-11ea-9821-86f3e9bfa070.png)
![image](https://user-images.githubusercontent.com/12286274/88739512-fab6b980-d0f7-11ea-877c-7bd565352a93.png)
2020-08-02 14:31:47 -04:00
lockwiser 18813776ca Doc: Clarify background-color arguments (#891) 2020-01-14 13:52:49 -05:00
Darío Hereñú 2edbf799c1 Fixed duplicate word in doc for `-bounce` (#883) 2019-12-13 18:40:24 -05:00
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
Clement Fradet Normand 99b1808dde Improve doc for --internal-urls (PR #833) 2019-08-22 21:46:20 +02: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
Nate Woolls 5433569921 Support macOS 10.4+ Dark Mode, default to Electron 5.x (#796)
Introduces a `--darwin-dark-mode-support` flag. 
(I kept the same flag used by Electron Packager.)
This required bumping Electron and Electron Packager.

Addresses:

- https://github.com/jiahaog/nativefier/issues/733
- https://github.com/jiahaog/nativefier/issues/727
2019-08-22 21:05:39 +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
Ronan Jouchet 85aacaaa52
Doc for squirrel installers 2019-02-08 09:59:20 -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
Benedikt Rötsch 3029cba01f Support global shortcuts that trigger input events (PR #698, Fixes #15)
This adds a new flag, allowing the user to define global shortcuts that trigger input events within the main window.

That way, I could easily wrap SoundCloud and Deezer to create a native app which reacts on my keyboard media buttons.
2018-11-04 21:03:52 -05:00
Kevin Jalbert c974014465 Remove mention to older badge option in docs (#693)
The `--counter` option mentioned a _badge option_, which doesn't appear in the docs. This change removes this as it is not relevant in the context.
2018-10-02 14:15:29 -04:00
André Werlang ad2f47df9c Update docs about icon requirements on Windows (#663)
On Windows, the supplied icon needs to be in .ico format
2018-08-22 16:18:46 -04:00
Khai Nguyen b8c1d35ba4 Add --title-bar-style flag (macOS only) (PR#627) 2018-05-31 08:05:12 -04:00
David Kramer bbb513d420 Fix #364 - Add --disable-gpu flag to disable hardware acceleration (PR #584) 2018-04-22 15:56:10 -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
C. Bess 7270f7d295 Document internal-urls option (PR #465) 2018-02-06 17:19:39 -05:00
David Ollerhead e1909bf5c8 Support Mac App Store (--mas) builds (PR #532) 2018-02-02 08:06:29 -05:00
Bob Roth cec9c4b819 Fix #499: Add options to control file download behavior (PR #526) 2018-01-26 09:59:58 -05:00
Matt Harris 28dca8c647 Fix #325 - Add --x and --y window position flags (PR #515) 2017-12-26 13:00:39 -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
Devin Buhl 4c581f9067 Fix #275 - Add HTTP --basic-auth-{username,password} CLI flags (#444) 2017-10-05 18:44:03 -04:00
Bob Roth c9d2040327 Allow nativefier to set process.env variables (#419) 2017-08-16 10:20:43 -04:00
Bob Roth fc7a213a87 Fix #226 - Added support for app-copyright, app-version, build-version, version-string and win32metadata (#244) 2017-08-15 14:18:44 -04:00
David Pacheco 38825e8b71 Add options (--ignore-gpu-blacklist and --enable-es3-apis) to allow for WebGl apps to work on legacy or unsupported graphics cards by Chrome (#410) 2017-07-13 12:23:07 -04:00
romo-dw ab435ee5a6 Add support for --disk-cache-size Electron flag (PR #400) 2017-07-05 09:07:31 -04:00
Matt Harris 10eaa53b26 Add ARM build support (#360) 2017-05-06 15:11:51 -04:00
Alex Ryan fc4cfc51bd Add entry for hide-window-frame to Table of Contents in api.md (#357) 2017-05-03 07:33:22 -04:00
Krzysztof Zbiciński da637ebf73 Add --single-instance switch (#323) 2017-04-09 22:02:49 -04:00