26 Commits

Author SHA1 Message Date
Kristjan ESPERANTO
6501aabd2d
[linter] Enable ESLint rule no-console (#3810)
In PR #3806 I noticed that ESLint did not complain about the use of
`console`. Then I realised that the rule `no-console` was not activated.
I have now changed this and replaced a few places where `console` was
used.

We can't apply the rule to all .js files because not all of them use our
logger. Therefore I had to add an extra config block for it.
2025-06-09 16:43:45 +02:00
Kristjan ESPERANTO
a7f814d76b
Optimize systeminformation calls and output string (#3689)
Since we don't use the `raspberry` information, calling it in `si.get`
is useless.

I also made the string construction in the code a bit more readable. The
output remains the same.
2025-01-12 23:27:31 +01:00
Kristjan ESPERANTO
143dfd6b67
Add some ESLint rules + minor changes (#3665)
Main point was to enable ESLint `dot-notation` and `no-unneeded-ternary`
rules for more code consistency.

I took the occasion to add two minor commits:
- Fix a problem found by running `test:spelling
- Minor dependency update

It wouldn't be a problem if the PR didn't arrive in the next release,
the changes are cosmetic.
2024-12-30 12:24:51 +01:00
sam detweiler
93a0c24c22
fix #3662 line parse on windows with linux line ends (#3663)
line parse used os.EOL, which failed with linux line ends in index.html,
change to '\n'
2024-12-28 18:57:39 +01:00
sam detweiler
24d9b70c4c
fix access denied fault error writing js/positions.js (#3652)
if the MagicMirror js folder is not writable (synology nas created by
different user than docker container) there is an uncaught throw

```
[ERROR] EACCES: permission denied, open 'js/positions.js' 
```

add try/catch, output new message, console.error
```text
unable to write js/positions.js with the discovered module positions
make the MagicMirror/js folder writeable by the user starting MagicMirror 
```

MM will start, but no modules will show, as no positions were discovered
this file is used to pass the list from the server side to the browser
side

fixes #3651
2024-12-18 17:37:51 +01:00
sam detweiler
d9eefff066
fix double load of positions now that check:config at startup is active (#3565)
after adding check:config to the MM startup process, #3450, we
accidentally discover module positions more than once, and write the
file each time..

add a check to see if we have done this work already
2024-09-28 15:52:09 +02:00
Kristjan ESPERANTO
d9f9f41e98
Add spell check (#3544)
I felt like adding a spell checker, but it's okay if you find it
superfluous. At least then we could fix the found spell issues.

What is still missing is an automatic integration so that the spell
checker does not have to be called manually. Would it perhaps make sense
to always do it before a release?
2024-09-18 07:37:09 +02:00
sam detweiler
2b97e0d26e
add support for custom regions, by detecting what is used in index.html (#3518)
read index.html to discover the regions used, make them the list checked
by app.js and check:config test

fixes #3504   supercedes #3506 

no config.js param required
2024-08-27 22:52:59 +02:00
Karsten Hassel
76d8f98969
allow custom module positions by setting allowCustomModulePositions… (#3506)
… in `config.js`

fixes #3504, related to
https://github.com/MagicMirrorOrg/MagicMirror/pull/3445
2024-08-01 21:24:16 +02:00
Karsten Hassel
d22d0e1f87
remove raspberry object from systeminformation (#3507)
fixes #3505
2024-07-29 12:22:59 +02:00
Bugsounet - Cédric
e95c144c3e
Fix crash possibility if module: <name> is not defined and on mistake position: <position> (#3445)
Fix #3442
2024-06-24 21:51:54 +02:00
Karsten Hassel
27f3c86c41
remove all useless header comments (#3363)
see #3358

used command: `find ./ -type f -exec perl -i -0pe
's/\/\*\s*magicmirror.*?\*\/\s*//si' {} \;`

This is a first draft, I think we should preserve some of the comments.
2024-01-24 21:39:06 +01:00
Kristjan ESPERANTO
6dbacbb773
Rework logging colors (#3350)
- Replacing old package `colors` by drop-in replacement `ansis`
- Rework `console-stamp` config to show all Log outputs in same color
(errors = red, warnings = yellow, debug = blue background (only for the
label), info = blue)
- This also fixes `npm run config:check` (broken since
6097547c103be1bc89c572e5bd2be50b342967fa)

Feel free to let me know if the PR is too big and you want me to do
individual PRs for the changes.

Before:

![before](https://github.com/MagicMirrorOrg/MagicMirror/assets/35647502/88e48ec3-102c-40f3-9e9b-5d14fe446a43)

After:

![after](https://github.com/MagicMirrorOrg/MagicMirror/assets/35647502/4c8c4bad-08c9-46a3-92c9-14b996c13a7d)

---------

Co-authored-by: Veeck <github@veeck.de>
2024-01-16 21:54:55 +01:00
Kristjan ESPERANTO
58bc14e8c0
Request only required information instead of all (#3338)
Hopefully this solves the problem with arm64 (reported in PR #3337).
2024-01-14 09:15:30 +01:00
Kristjan ESPERANTO
4bbd35fa6a
Use node prefix for build-in modules (#3340)
It is basically a cosmetic thing, but has the following advantages:

1. Consistency with the official node documentation. The prefix is used
there.
2. It is easier to recognize the build-in modules.
2024-01-08 17:45:54 +01:00
Kristjan ESPERANTO
407072d12d
Update system information (#3337)
- Add ELECTRON_ENABLE_GPU
- Remove docker version
- Differentiation between installed and used node version
- Highlight "Ready to go!" for server mode (Since we display system
information in the console, it is easy to overlook this important line.)

## Electron mode

### Before

```bash
[07.01.2024 16:37.30.591] [INFO]  System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
 ### VERSIONS: electron: 27.2.0; node: 18.17.1; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ### OTHER:    timeZone: Europe/Berlin
```

### After

```bash
[07.01.2024 16:39.04.736] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: 27.2.0; used node: 18.17.1; installed node: 21.1.0; npm: 10.2.4; pm2: 5.3.0
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined
```

## server mode

### Before

```bash
[07.01.2024 16:36.49.106] [LOG]   
Ready to go! Please point your browser to: http://localhost:8080
[07.01.2024 16:36.49.287] [INFO]  System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
 ### VERSIONS: electron: undefined; node: 21.1.0; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ### OTHER:    timeZone: Europe/Berlin
```

### After

```bash
[2024-01-07 16:33:53.804] [INFO]  
>>>   Ready to go! Please point your browser to: http://localhost:8080   <<< 
[2024-01-07 16:33:53.997] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: undefined; used node: 21.1.0; installed node: 21.1.0; npm: 10.2.4; pm2: 5.3.0
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined 
```
2024-01-07 17:28:17 +01:00
Kristjan ESPERANTO
6097547c10
Add systeminfo (#3331)
This is a first attempt to bring additional system information into the
console (see #3328). It's certainly not yet perfect, but with the PR we
have a better basis for discussion.

I tried to keep the output small so that we get as much information as
possible in screenshots.

This is how it looks on my development system.

```bash
[03.01.2024 00:50.19.226] [INFO] System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12
 ### VERSIONS: MagicMirror: 2.27.0-develop; electron: 27.2.0; kernel: 5.10.0-20-amd64; node: 21.1.0; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ```
 
 Why is it still a draft:
- [x] I have doubts that utils.js is the right place for the function. What do you think?
=> Update: As long as there is no better idea, it stays there.
- [x] Instead of working through all wishes you expressed in the issue #3328, I only implemented what was easy to achieve. And wanted to hear what you think about this approach.
=> Update: Some added. Of course, more information could be added later, as soon as experience has been gained in productive use.
- [x] I don't quite like the introductory line ("The following lines provide information..."). Should I perhaps simply replace it with "System information:"?
=> Update: Changed to "System information:"
 
 [Here](https://github.com/sebhildebrandt/systeminformation#function-reference-and-os-support) you can see what information we could easily add with the systeminformation package.
 
 It would be interesting how the raspberry field is filled on a raspi system and with docker there should be another line, but I can't easily test that now.
2024-01-04 22:38:53 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Felix Wiedenbach
d22064c6f4 clean up utils 2021-01-05 18:37:01 +01:00
rejas
66609428a2 Remove thrown Errors and add some color to the ouput 2020-08-08 22:16:27 +02:00
Veeck
abb5dc5739 Run prettier over ALL files once
No other changes done in this commit
2020-05-11 22:22:32 +02:00
rejas
c04fa496bf Second round of undef fixes 2020-05-03 18:59:26 +02:00
rejas
d08bd4e866 Fix lots of warnings 2020-04-21 12:23:50 +02:00
Rodrigo Ramírez Norambuena
f89f704a69 Add task to check configuration file syntax. 2017-03-18 09:45:32 -03:00
Rodrigo Ramírez Norambuena
1e3b866c8b Use color red for error when the configuration file is not found. 2017-03-05 22:20:35 -03:00
Rodrigo Ramírez Norambuena
ddff2b2982 Move colors into utils file 2017-02-28 01:41:21 -03:00