519 Commits

Author SHA1 Message Date
Thomas Hirschberger
b9b7d2c95d
Add option to remove "x-frame-options" and "content-security-policy" response headers (#2963)
Many users like me do have the problem that they want to embed other
sites to their mirror by "iframe".
As some developers set the "x-frame-options" and
"content-security-policy" for security reasons these sites can not be
embedded.
Electron provides the "webview" element additionally to "iframe" which
allows to embed these sites although. The main difference is that a new
process is started which handles the "webview" element.
BUT: As the "webview" process needs to be started and is isolated
"webview" is slower and the elements can not be accessed from the
embedding website.

As an alternative i implemented a small callback function in electron.js
which removes the response headers that forbid the embedding.

The removing can be controlled with the new config options:
* ignoreXOriginHeader
* ignoreContentSecurityPolicy
2022-11-07 07:42:27 +01:00
veeck
0b01e9dbe0 Fix jsdoc error 2022-11-06 17:51:15 +01:00
Magnus
4d47c0837f
Support HTTP headers with CORS-method (#2957)
Adds support for sending and receiving HTTP-headers when using the
CORS-method.

This change is required for the Yr weather-provider introduced in
https://github.com/MichMich/MagicMirror/pull/2948.

To make it easier to add unit tests I moved the server-functions into a
separate file.
2022-10-30 18:14:02 +01:00
Veeck
3879949f58
Switch back to third party fetch lib for all node versions (#2961)
As discussed in https://github.com/MichMich/MagicMirror/pull/2952

Co-authored-by: veeck <michael@veeck.de>
2022-10-29 23:10:25 +02:00
buxxi
f25abfd2f8
Make the e2e tests wait for the app to start and close before running next test (#2952)
When trying to debug why the tests broke for
https://github.com/MichMich/MagicMirror/pull/2946 I found that the tests
does not wait for the app to start and close. So if the startup isn't
blocking that would fail.

So I added a callback for `close()` too and converted them to promises
for the `startApplication()` and `stopApplication()` and updated all the
e2e tests to await both. Will try to refactor all these callbacks to
promises in a later PR.
2022-10-29 22:34:17 +02:00
Veeck
64ed5a54cb
Add error handling to node_helper startup sequence (#2945)
Fixes https://github.com/MichMich/MagicMirror/issues/2944

Also splits the Server js into a constrcutor and an open call to remove
one callback parameter :-)

Co-authored-by: veeck <michael@veeck.de>
2022-10-19 21:40:43 +02:00
Veeck
7bbf8c19db
Wait till all node_helper are started before finishing startup (#2928)
In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <michael@veeck.de>
2022-10-13 21:38:04 +02:00
Veeck
a328ce537f
Cleanup test directory (#2937)
Moves files around and renames some so that the structure is cleaner and
more consistent
2022-10-07 12:16:37 -05:00
Veeck
d5e855dd6d
Use fetch instead of XMLHttpRequest in weatherprovider (#2935)
small update to the fetchData method to use the fetch helper instead of
the old XCMLHttpRequest.
Also fixes some typos :-)

Co-authored-by: veeck <michael@veeck.de>
2022-10-06 19:44:16 +02:00
veeck
cde0adc28e Update nodehelper docs 2022-08-08 10:30:23 +02:00
Karsten Hassel
0023c64d59 use internal fetch function of node instead external node-fetch library if node version >= v18 2022-05-27 19:46:28 +02:00
Karsten Hassel
3b55886c45 added a new config option httpHeaders used by helmet 2022-05-13 22:29:43 +02:00
Rohith Dharavath
288a008e72
Update electron.js
corrected spelling mistake
2022-04-21 01:53:22 +05:30
Karsten Hassel
88f7570caf add comments in electron.js 2022-03-29 21:24:17 +02:00
Karsten Hassel
00a7c6b5be added new env var ELECTRON_DISABLE_GPU which disable gpu under electron if set (fixes #2831). 2022-03-29 20:41:36 +02:00
Kristjan ESPERANTO
e234d2379b
Fix log output
Before:
```
MMM-OlympicGames - Load translationfalse: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation  fallback: translations/en.json
```

After:
```
MMM-OlympicGames - Load translation: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation fallback: translations/en.json
```
2022-02-20 02:24:22 +01:00
Michael Teeuw
da90412cea
Merge pull request #2798 from khassel/cors 2022-01-28 11:22:43 +01:00
Kristjan SCHMIDT
6f27e5ae07 MagicMirror -> MagicMirror² 2022-01-26 23:47:51 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Karsten Hassel
c622db918b working version, use corsUrl in weather providers 2022-01-25 23:42:42 +01:00
Karsten Hassel
7cfc7b9d74 first cors approach 2022-01-25 00:43:57 +01:00
Karsten Hassel
480c10b239 fix helmet, use defaults from v4 2022-01-14 00:05:08 +01:00
Karsten Hassel
14a22efae1 Merge branch 'develop' into helmet 2022-01-12 20:07:20 +01:00
Karsten Hassel
9604c3a187 helmet upgrade to v5 2022-01-11 21:51:09 +01:00
Tom Hirschberger
1ba4213910 set the hidden class by classList features instead of string manipulation now 2022-01-11 15:54:45 +01:00
Tom Hirschberger
b3dd531abb removed adding of shown class 2022-01-11 15:52:00 +01:00
Tom Hirschberger
4325fcdca2 automatically add/remove a hidden/shown class to the module wrappers if they get hidden or shown 2022-01-11 15:20:33 +01:00
Sam Detweiler
28d866c001 enable useHTTP for full electron version 2021-12-26 17:43:27 +01:00
Karsten Hassel
c67320f185 fix logger.js 2021-09-28 22:08:21 +02:00
Karsten Hassel
c0ce52abe3 change getDocument, delay needed, now 2 tests moved 2021-09-25 00:01:41 +02:00
Karsten Hassel
a1c7f20990 fix logger.js, move jsdom in startApplication 2021-09-24 21:30:51 +02:00
Karsten Hassel
0ef6f89d44 fix server.close() issue 2021-09-24 00:30:00 +02:00
karsten13
b4350278a0 first tests 2021-09-21 23:48:29 +02:00
Karsten Hassel
9969fede35 refactor e2e 2021-09-16 23:02:17 +02:00
Karsten Hassel
c15b31b374 close server 2021-09-15 21:23:43 +02:00
Karsten Hassel
236bf6e0fc silence logger for tests, use modulePaths for e2e 2021-09-13 23:55:41 +02:00
Karsten Hassel
d7c70dc021 fix logger.js 2021-09-09 23:30:36 +02:00
Karsten Hassel
53c789bff9 again logger.js due to problem with e2e test 2021-09-09 21:54:20 +02:00
Karsten Hassel
2b147bb98b do logger mocking in logger.js, remove sandbox stuff from unit tests 2021-09-09 20:50:35 +02:00
Seongnoh Sean Yi
17637fb1f6
Merge branch 'develop' into develop 2021-08-31 10:50:05 +02:00
Karsten Hassel
fbc886b21c run prettier ... 2021-08-30 19:55:26 +02:00
Karsten Hassel
8879fb55de disable black cursor on start 2021-08-30 19:47:26 +02:00
eouia
dbdff38d2e Add custom switches for electron mainWindow 2021-08-30 11:32:24 +02:00
rejas
6b17f6aa28 Final var conversions 2021-07-14 15:06:23 +02:00
rejas
2619f92d09 More var -> let/const conversions 2021-07-14 10:41:29 +02:00
rejas
af5d132410 Rename global version variable 2021-07-14 10:41:29 +02:00
karsten13
f945d50c0d run prettier 2021-07-04 19:21:17 +02:00
Karsten Hassel
ad13de3588 update electron to v13 2021-07-04 17:46:22 +02:00
Karsten Hassel
cfc0bcd5ad workaround for dev_console test using getWindowCount 2021-06-18 21:39:55 +02:00
Karsten Hassel
d9edaffd9c reset changes on js/logger.js, mock logger.js in global_vars tests, workaround for failing dev_console test 2021-06-17 22:50:26 +02:00