Commit Graph

1039 Commits

Author SHA1 Message Date
Adam Weeden 7a08a2d676
Enable TypeScript strict:true, and more typescript-eslint rules (#1223)
* Catch promise errors better

* Move subFunctions to bottom of createNewWindow

* Use parents when creating child BrowserWindow instances

* Some about:blank pages have an anchor (for some reason)

* Inject browserWindowOptions better

* Interim refactor to MainWindow object

* Split up the window functions/helpers/events some

* Further separate out window functions + tests

* Add a mock for unit testing functions that access electron

* Add unit tests for onWillPreventUnload

* Improve windowEvents tests

* Add the first test for windowHelpers

* Move WebRequest event handling to node

* insertCSS completely under test

* clearAppData completely under test

* Fix contextMenu require bug

* More tests + fixes

* Fix + add to createNewTab tests

* Convert createMainWindow back to func + work out gremlins

* Move setupWindow away from main since its shared

* Make sure contextMenu is handling promises

* Fix issues with fullscreen not working + menu refactor

* Run jest against app/dist so that we can hit app unit tests as well

* Requested PR changes

* Add strict typing; tests currently failing

* Fix failing unit tests

* Add some more eslint warnings and fixes

* More eslint fixes

* Strict typing on (still issues with the lib dir)

* Fix the package.json import/require

* Fix some funky test errors

* Warn -> Error for eslint rules

* @ts-ignore -> @ts-expect-error

* Add back the ext code I removed
2021-06-15 22:20:49 -04:00
Ronan Jouchet 7807bbb327 Update changelog for `v44.0.3` 2021-06-15 09:06:44 -04:00
Adam Weeden 113d8448c1
Fix CSS injection (#1227)
This fixes https://github.com/nativefier/nativefier/pull/1222#issuecomment-860913698 , where:

1. When it works (e.g. initial page load), CSS is slower to inject (you can see pages without injected CSS)
2. CSS isn't injected when navigating to a page

On both Windows & Linux, a `git revert 9a6c6f870d && npm run build` fixes the issue.

--

I'm still not 100% sure what went wrong, but I suspect that the new version of Electron may not be firing onHeadersReceived for the actual navigation events, and only its child requests. To counteract it, I'm now injecting at the navigation event as well. I was able to reproduce the issue and this does seem to fix it. Please let me know if it does for you as well..

Also I noticed some funkiness in your logs where we're trying to inject on font files. So I realized the method is probably not nearly as important as the content-type, so I've switched blacklist methods to blacklist content-types.
2021-06-15 09:02:57 -04:00
Ronan Jouchet 9d0a2f5b44 Bump default Electron to 12.0.11 2021-06-14 14:39:51 -04:00
Ronan Jouchet ea24a0fdeb Fix gitcloud 0.2.3 import 2021-06-14 14:39:43 -04:00
Adam Weeden 9a6c6f870d
Selective css injection (#1222)
* Don't inject CSS for unneeded responses

* Remove some non-injectable methods

* Actually check for CSS to inject + unit tests

* Update app/src/helpers/windowHelpers.ts

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-06-09 09:49:35 -04:00
Peter Lewis d67f533fa5
README: Update node & npm requirements (#1224)
Update required `node` and `npm` versions to match what's in package.json
2021-06-09 08:14:46 -04:00
Ronan Jouchet 437ae55d2e Update changelog for `v44.0.2` 2021-06-07 17:28:34 -04:00
Ronan Jouchet 4badf3dc70 manual-test: fix shellcheck nits, make tests structure more distinct 2021-06-07 17:27:23 -04:00
Adam Weeden 826625f4a4
Fix HTTP basic auth (fix #1219) (#1220)
Should resolve #1219, as well adds a manual test for basic auth as suggested.

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-06-07 17:09:24 -04:00
Adam Weeden 363fa966ee
Fix tabs opening twice (fix #1209) (#1221)
* Only add a new window handler to the main window

* Update app/src/components/mainWindow.ts

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-06-07 16:49:06 -04:00
Ronan Jouchet 460d70f915 Update changelog for `v44.0.1` 2021-06-07 09:38:53 -04:00
Ronan Jouchet 709557c7ab
macOS: fix crash on activating main window (fix #1212) (PR #1213)
```
Uncaught Exception:
TypeError: Cannot read property 'show' of undefined
at App.<anonymous> (/src/main.ts:177:18)
```

Seems like an oversight of the recent refactor.

* macOS: fix crash on activating main window (fix #1210)
* Eliminate need for global mainWindow, refactor widevine / non-widevine events (#1218)

Co-authored-by: Adam Weeden <adamweeden@gmail.com>
2021-06-07 09:35:27 -04:00
Adam Weeden cdc6fa79c2
Fix fullscreen not working + menu refactor (fix #1206) (#1210)
* Catch promise errors better

* Move subFunctions to bottom of createNewWindow

* Use parents when creating child BrowserWindow instances

* Some about:blank pages have an anchor (for some reason)

* Inject browserWindowOptions better

* Interim refactor to MainWindow object

* Split up the window functions/helpers/events some

* Further separate out window functions + tests

* Add a mock for unit testing functions that access electron

* Add unit tests for onWillPreventUnload

* Improve windowEvents tests

* Add the first test for windowHelpers

* Move WebRequest event handling to node

* insertCSS completely under test

* clearAppData completely under test

* Fix contextMenu require bug

* More tests + fixes

* Fix + add to createNewTab tests

* Convert createMainWindow back to func + work out gremlins

* Move setupWindow away from main since its shared

* Make sure contextMenu is handling promises

* Fix issues with fullscreen not working + menu refactor

* Run jest against app/dist so that we can hit app unit tests as well

* Requested PR changes
2021-06-07 08:55:17 -04:00
Ronan Jouchet 16cacb0915 CATALOG.md: Spotify: mention faking user agent may not be necessary 2021-06-04 18:53:38 -04:00
Ronan Jouchet 69bc3306f9 Update changelog for `v44.0.0` 2021-06-04 17:03:35 -04:00
Ronan Jouchet 5d67156deb API.md: cleanup 2021-06-04 16:53:35 -04:00
Ronan Jouchet c6b50e8d0a API.md: add "New in x.y.z" info for (most) flags 2021-06-04 16:45:05 -04:00
Ronan Jouchet 5673989117 Bump default Electron to 12.0.10 2021-06-04 16:18:34 -04:00
Adam Weeden 72de7b3fca
Refactor app window creation/events + add some unit tests; fix #1197 (#1203)
* Catch promise errors better

* Move subFunctions to bottom of createNewWindow

* Use parents when creating child BrowserWindow instances

* Some about:blank pages have an anchor (for some reason)

* Inject browserWindowOptions better

* Interim refactor to MainWindow object

* Split up the window functions/helpers/events some

* Further separate out window functions + tests

* Add a mock for unit testing functions that access electron

* Add unit tests for onWillPreventUnload

* Improve windowEvents tests

* Add the first test for windowHelpers

* Move WebRequest event handling to node

* insertCSS completely under test

* clearAppData completely under test

* Fix contextMenu require bug

* More tests + fixes

* Fix + add to createNewTab tests

* Convert createMainWindow back to func + work out gremlins

* Move setupWindow away from main since its shared

* Make sure contextMenu is handling promises
2021-06-02 15:18:32 -04:00
Ronan Jouchet ec12702359 HACKING.md: video doesn't embed, just link to it 2021-06-02 09:52:28 -04:00
Ronan Jouchet 1ceffb1a0d HACKING.md: embed video showing what a live-reload experience looks like
Also, a paragraph on limiting breaking changes
2021-06-02 09:48:57 -04:00
Ronan Jouchet 62ee24662c More test:watch fix: bring upgrade to Jest 27 from TheCleric' closed jest-ts PR
See https://github.com/nativefier/nativefier/pull/1204
2021-06-02 00:35:19 -04:00
Ronan Jouchet 6b09d1467f More test:watch fixes & usability
See https://github.com/nativefier/nativefier/pull/1204#issuecomment-852679403
2021-06-01 23:37:04 -04:00
Ronan Jouchet 9c5dba7f07 Fix test:watch requiring two saves to actually run the code/test you just changed
Will fix https://github.com/nativefier/nativefier/pull/1204#issuecomment-852155755
See package.json in comments for description
2021-06-01 20:43:46 -04:00
Adam Weeden 86a27d4f39
Allow non-ascii app names like 微信读书 (fix #1056) (#1207)
* Resolves #1056 Allow non-ascii app names like 微信读书

* Update src/utils/sanitizeFilename.ts

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Fix prettier

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-31 23:27:32 -04:00
Adam Weeden 6c55e1a9a1
Add login.microsoftonline.com to internal login pages (#1205)
* Add login.microsoftonline.com to internal login pages

* Update API.md

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Add extra messaging for adding to internalLoginPages

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-29 20:38:24 -04:00
Ronan Jouchet 8801ca5150 app/tsconfig.json: document when to bump compilerOptions, and rationale 2021-05-29 20:07:38 -04:00
Ronan Jouchet 2b780e6c67 Test watcher: warn that it's necessary to run build:watch for the test watcher to work
See https://github.com/nativefier/nativefier/pull/1204#issuecomment-850915981
2021-05-29 19:58:46 -04:00
Adam Weeden d6730f7022
Improve user agent handling/provide user agent "short" codes (#1198) 2021-05-21 23:41:13 -04:00
Ronan Jouchet 4f3b449218 Deps: bump ts-loader from 8 to 9, now that we require Node 12
See https://github.com/TypeStrong/ts-loader/releases
2021-05-21 19:44:53 -04:00
Ronan Jouchet 45db4e7ec6 README: whoopsie, bad rename of animation 2021-05-21 18:17:59 -04:00
Ronan Jouchet cc02b87de7
Get rid of "docs" folder (#1194)
It contains a weird mix of stuff and hides valuable files from view at the root of the repo. Better to have:
- Docs at the root
- Rest of the github/release-related hodgepodge (screenshots, scripts) in hidden folder .github
2021-05-21 18:16:59 -04:00
Adam Weeden 1a810e5ce5
Organize CLI flags into groups (for better --help usability) (#1191)
* Organize CLI options for better UX

* Fix some documentation

* Whoops. Stupid VS Code linter.

* Fix prettier issues

* Make paths less unixy in tests

* Update src/cli.test.ts

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Apply suggestions from code review

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Add example to reference CATALOG.md

* Make honest appear near user-agent

* Standardize descriptions

* Hide flash options

* Add explanation of parsed._

* Redo groups in yargs

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-18 22:02:55 -04:00
Adam Weeden b3c202fd33
Bump minimum required version: node>=12.9, npm>=6.9 (#1192)
* Move minimum supported version: node=12, npm=6.9

* Add missing bits and documentation for future bumping

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-15 13:32:54 -04:00
Ronan Jouchet 9225114e77 Update changelog for `v43.1.3` 2021-05-15 13:28:16 -04:00
Ronan Jouchet 3fd34549d6 Bump to Electron 12.0.7 2021-05-15 13:12:34 -04:00
Ronan Jouchet 0216d4f9c4 CATALOG.md: add HBO Max
From https://github.com/nativefier/nativefier/issues/1153#issuecomment-840697278
2021-05-13 22:51:08 -04:00
Knallli 668ca723dc
CATALOG.md: Add Spotify (PR #1187)
Co-authored-by: Knallli <41125802+Knallli@users.noreply.github.com>
Co-authored-by: Adam Weeden <adamweeden@gmail.com>
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-12 19:53:47 -04:00
Ronan Jouchet b9615b4cbd
CATALOG.md: cleanup & add Google apps section (#1188) 2021-05-12 18:39:52 -04:00
Ronan Jouchet d61a4e709a Make prettier happier 2021-05-10 10:23:56 -04:00
Ronan Jouchet 03325b45ce README: remove broken npm badge, and btw useless build status 2021-05-10 10:11:34 -04:00
Adam Weeden 5fbf14d35d
Only try to inject CSS for valid web requests (fix #939: crash on tab close, PR #1181) 2021-05-08 10:12:10 -04:00
RippiN 067327e863
linkIsInternal: consider shop.foo.com and blog.foo.com as internal (still without extra dep or SLD list) (PR #1171)
Domain-ish URL test now also covers considering internal URLs with different sub-domains like
- `https://listen.tidal.com`
- `https://login.tidal.com`

Co-authored-by: Daniel Fuchs <dfuchs@multamedio.de>
Co-authored-by: Adam Weeden <adamweeden@gmail.com>
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-03 13:22:44 -04:00
deciacco d6f0a28a90
CATALOG.md: build command library (fix #1166) (PR #1178) 2021-05-03 13:08:32 -04:00
Ronan Jouchet 6cf533c5ac Update changelog for `v43.1.2` 2021-05-03 11:19:30 -04:00
Ronan Jouchet 331fe8db39
Fix logging out users on upgrade / app recreate with same URL (fix #1176) (PR #1179)
This is a follow-up of https://github.com/nativefier/nativefier/pull/1162#discussion_r623766247

PR #1162 introduced a new `generateRandomSuffix` helper function,
used it for its needs (avoiding collisions of injected js/css).

But it also replaced existing appname normalizing logic with it,
introducing randomness in a place that used to be deterministic.

As a result, starting with dd6e15fb5 / v43.1.0, re-creating an app would cause
the app to use a different appName, thus a different appData folder, thus
losing user data including cookies.

This PR leaves the `--inject` fixes of #1176, but reverts the appName logic
to the pre-#1176 code.
2021-05-03 11:16:50 -04:00
Ronan Jouchet beae6e872b development.md: expand on why I'm such a bore with limiting extra deps 2021-05-02 18:29:05 -04:00
Ronan Jouchet d9670d6bb0 Update changelog for `v43.1.1` 2021-05-02 18:15:08 -04:00
Adam Weeden 14d95da079
Fix crash in preload.js due to 3rd-party 'loglevel' (fix #1175, fix #1176) (PR #1177)
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-05-02 18:12:08 -04:00