From dacc279f3bcdc6ae16c2ac39254065efe02050c1 Mon Sep 17 00:00:00 2001 From: Patrick Chatain Date: Sat, 30 Dec 2017 09:44:02 +0100 Subject: [PATCH 1/2] add screen on / off to support page --- client/src/components/help/Help.js | 12 ++++++++++++ locales/en.json | 7 +++++-- locales/fr.json | 7 +++++-- src/routes/post.js | 6 ++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/client/src/components/help/Help.js b/client/src/components/help/Help.js index 4188558..c3a01b0 100644 --- a/client/src/components/help/Help.js +++ b/client/src/components/help/Help.js @@ -78,6 +78,18 @@ const Help = ({ + + {t("Activer / désactiver l'écran")}}> + + {t('Allumer l\'écran')} + + + + {t('Eteindre l\'écran')} + {' '} + + ); diff --git a/locales/en.json b/locales/en.json index a72f65e..ea3adc9 100644 --- a/locales/en.json +++ b/locales/en.json @@ -212,5 +212,8 @@ "Voulez-vous vraiment supprimer toutes ces ROMs ?": "Do you really want to remove all these ROMs?", "Déposez ici les ROMs à uploader.": "Drop here the ROMs to upload.", "Supprimer les ROMs sélectionnées": "Delete selected ROMs", - "Nouvelle image": "New image" -} \ No newline at end of file + "Nouvelle image": "New image", + "Activer / désactiver l'écran": "Turn screen on/off", + "Allumer l'écran": "Turn screen on", + "Eteindre l'écran": "Turn screen off" +} diff --git a/locales/fr.json b/locales/fr.json index ae97484..66c924d 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -212,5 +212,8 @@ "Voulez-vous vraiment supprimer toutes ces ROMs ?": "Voulez-vous vraiment supprimer toutes ces ROMs ?", "Déposez ici les ROMs à uploader.": "Déposez ici les ROMs à uploader.", "Supprimer les ROMs sélectionnées": "Supprimer les ROMs sélectionnées", - "Nouvelle image": "Nouvelle image" -} \ No newline at end of file + "Nouvelle image": "Nouvelle image", + "Activer / désactiver l'écran": "Activer / désactiver l'écran", + "Allumer l'écran": "Allumer l'écran", + "Eteindre l'écran": "Eteindre l'écran" +} diff --git a/src/routes/post.js b/src/routes/post.js index 4c39dec..e1f4c59 100644 --- a/src/routes/post.js +++ b/src/routes/post.js @@ -74,6 +74,12 @@ router.post('/', async (req, res, next) => { // @todo What to do? The manager will become unreachable. spawn('shutdown', ['-h', 'now']); break; + case 'screen-on': + // @todo Wait for reboot. The manager will be unreachable for a while. + spawn('vcgencmd display_power 1'); + case 'screen-off': + // @todo Wait for reboot. The manager will be unreachable for a while. + spawn('vcgencmd display_power 0'); case 'deleteRom': deleteRom(body); From cf8979572fed0da05aa4565f1560ad80aab31468 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 30 Dec 2017 22:47:15 +0100 Subject: [PATCH 2/2] fix --- src/routes/post.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/post.js b/src/routes/post.js index e1f4c59..2c0e843 100644 --- a/src/routes/post.js +++ b/src/routes/post.js @@ -76,10 +76,14 @@ router.post('/', async (req, res, next) => { break; case 'screen-on': // @todo Wait for reboot. The manager will be unreachable for a while. - spawn('vcgencmd display_power 1'); + spawn('vcgencmd',['display_power 1']); + break; + case 'screen-off': // @todo Wait for reboot. The manager will be unreachable for a while. - spawn('vcgencmd display_power 0'); + spawn('vcgencmd',['display_power 0']); + break; + case 'deleteRom': deleteRom(body);