Commit Graph

973 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
Ben Curtis 41b208fcb7
Support opening URLs passed as arg to Nativefied application (fix #405) (PR #1154)
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-04-28 20:18:12 -04:00
Ronan Jouchet 9286fc8086
README: use quotes in example, to divert users from shell globbing pitfalls
Follow-up of https://github.com/nativefier/nativefier/issues/1159#issuecomment-827184112
2021-04-27 18:12:02 -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
Ronan Jouchet 9f561c0091 CI: run less node versions, oldest supported / latest is enough 2021-04-23 21:52:03 -04:00
Ronan Jouchet 09accbd28a CI: run in node 16, stop node 15 2021-04-23 21:47:54 -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
Ronan Jouchet fa9bd2aba5 Update changelog for `v43.0.2` 2021-04-13 21:53:05 -04:00
Ronan Jouchet 83b1c10269 Bump to Electron 12.0.4 with Chrome 89.0.4389.114
With recent security fixes.
See https://github.com/electron/electron/releases/tag/v12.0.4
and https://github.com/electron/electron/releases/tag/v12.0.3
2021-04-13 21:49:31 -04:00
Ronan Jouchet f64c05f735 Update changelog for `v43.0.1` 2021-04-11 20:58:20 -04:00
Ronan Jouchet ecfb5e92bb Old build detection: doc 2021-04-11 20:54:44 -04:00
Ronan Jouchet 1474ebc8bc Bump to Electron 12.0.2 with Chrome 89.0.4389.90
See https://github.com/electron/electron/releases/tag/v12.0.2
2021-04-11 20:47:16 -04:00
Ronan Jouchet da06d933df Old build detection: bump to 90 days, let packagers customize message 2021-04-11 20:40:41 -04:00
Alec Mev d0ab749bd6
Add Apple ID to automatically-internal login pages (#1146)
Used by Notion, for example. TLDs other than `.com` don't appear to exist.
2021-04-01 18:03:07 -04:00
Evan Anderson 4298d2da06
Automatically-internal login URLs: add GitHub 2FA pages (PR #1140)
I have 2FA (FIDO/Yubikey) set up for GitHub, and the session login was redirecting to my browser. Looking at the redirect path, it appears that github.com/session is involved, so adding that to internal login details.

With this patched, I'm able to login in to https://octobox.io/ in nativefier.
2021-03-17 07:39:24 -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 da007305de dev.md: typo 2021-03-11 20:28:28 -05:00
Ronan Jouchet 3c2e84a752
Dev.md: guidelines (PR #1133)
An attempt to a few important things to newcomers, to reduce the risk
of contributors being disappointed / contradicted late at PR time.
2021-03-11 20:27:21 -05:00
Ronan Jouchet eaa9d8471b Old build detection: simpler error message 2021-03-11 09:37:33 -05:00
Ronan Jouchet 554c70c12d API.md: document Flash deprecation 2021-03-10 23:02:51 -05:00
Ronan Jouchet 96f3ab4ec7 Update changelog for `v43.0.0` 2021-03-10 20:37:37 -05:00
Ronan Jouchet dcadfb0bca Bump to Electron 12.0.1 with Chrome 89.0.4389.82 2021-03-10 20:25:33 -05:00
Ronan Jouchet 1521a28f45 Docker: fix build 2021-03-10 20:06:39 -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 ffa421eb8e Docker: attempt to fix build
See https://hub.docker.com/api/audit/v1/action/05620acd-9984-4e10-9053-3a7edc0c8558/ :

```
The command '/bin/sh -c npm link && npm test && rm -rf /tmp/nativefier* ~/.npm/_cacache ~/.cache/electron && chmod +x $NPM_PACKAGES/bin/nativefier' returned a non-zero code: 243
```

Culprit could be `rm -rf /tmp/nativefier*` : at this point /tmp/nativefier
doesn't exist, so `sh` cannot evaluate glob `/tmp/nativefier*`, and exits 1
2021-03-10 19:44:44 -05:00
Ronan Jouchet 21665cac5f Bump deps 2021-03-10 19:41:02 -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
Adam Weeden e9ccb35825
Docker: slim down image size, by removing temp/cache files (PR #1128)
Per the [note](https://github.com/nativefier/nativefier/pull/1122#discussion_r588922780) by @SuperSandro2000 in #1122 Docker will still cache files in intermediate layers if you delete them, so they'll still be part of the image.

Only solution seems to be to delete them as you create them so they don't cache:
Per https://stackoverflow.com/questions/53998310/docker-remove-file-from-intermediate-layer

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-03-10 18:54:33 -05:00
Ronan Jouchet 9b455670c4 generate-changelog: integrate doc, creating tag, remind about smoke test 2021-03-04 21:27:13 -05:00
Ronan Jouchet 7ee2f97599 Update changelog for `v42.4.0` 2021-03-04 12:46:10 -05:00
Ronan Jouchet e59e056f59 Bump deps 2021-03-04 12:37:11 -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
Ronan Jouchet 75aa10382b Move some tooling config (eslintignore, prettierrc) to package.json
To limit amount of dotfiles at repo root
2021-02-27 22:31:59 -05:00
Ronan Jouchet 5129dbafe1 Deps: bump gitcloud to 0.2 and page-icon to 0.4 2021-02-27 01:15:26 -05:00
Ronan Jouchet 519e65e7da TSConfig: bump to target/lib es2018, since we require node10 2021-02-26 22:50:59 -05:00
Ronan Jouchet d90d9f3d7f Scripts: get rid of `dev-up` and `dev-up-win` scripts
They used to be necessary when we did OS-specific stuff in here, but
we're no longer, and `foo && bar` is supported by both *nixes and Windows
2021-02-26 22:41:00 -05:00
Ronan Jouchet 292ac39328 CI: avoid npm funding messages 2021-02-26 22:19:45 -05:00
Ronan Jouchet e03e07e4bd Speed up CI by avoiding repeated npm install & build already done with "prepare" hook 2021-02-26 22:15:56 -05:00
Ronan Jouchet 0aa8276922 Update changelog for `v42.3.0` 2021-02-25 19:49:22 -05:00
Ronan Jouchet 17231d707f Bump eslint-config-prettier from ^7.2.0 to ^8.1.0 2021-02-25 19:10:11 -05:00
Ronan Jouchet 1a5d79ecf8 Bump commander from ^4.1.1 to ^7.1.0
Looked at https://github.com/tj/commander.js/blob/master/CHANGELOG.md
and tested a bit, seems like no change is needed
2021-02-25 19:08:37 -05:00
Ronan Jouchet 6b266b7815 (Attempt to) get rid of deprecated app dep `wurl`
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 your "out of the app", and in e.g. asana landing's page,
which you'd expect to see in your browser.

Let's see if users disagree with that.
2021-02-25 18:55:28 -05:00
Ronan Jouchet fe79fd622d Doc extra electron update stuff 2021-02-25 18:46:27 -05:00
Ronan Jouchet f4a0479a11 Bump default Electron to 11.3.0 with the icon fix (with Chromium 87.0.4280.141) 2021-02-25 18:28:29 -05:00
Ronan Jouchet 5ea4638aea Fix lint 2021-02-25 18:19:30 -05:00
Ronan Jouchet 9b52f210db Get rid of dependency "shelljs"
We don't need a fancy _"portable (Windows/Linux/macOS) implementation
of Unix shell commands on top of the Node.js API"_, we just want to run
a simple script. Replacing with using stdlib `child_process.spawnSync`.
2021-02-25 18:15:24 -05:00