From 9d82e8d8cffdb3da2fd82dfac8cae87c4aff9a33 Mon Sep 17 00:00:00 2001 From: dergelm <59627708+dergelm@users.noreply.github.com> Date: Mon, 12 Jul 2021 21:44:16 +0200 Subject: [PATCH 1/7] Update api.js --- src/routes/api.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/routes/api.js b/src/routes/api.js index e3c137f..99753ff 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -236,6 +236,10 @@ router.post('/devices/mass_action', async (req, res) => { logger('dcm').info('Received restart by config mass action'); endpoint = 'restart'; break; + case 'brightness': + logger('dcm').info('Received brightness mass action'); + endpoint = 'brightness?value=0'; + break; default: res.send('Error Occurred'); } @@ -740,6 +744,7 @@ router.get('/utilities/clear_device_ips', async (req, res) => { const get = async (uuid, url) => { const isScreen = url.includes('/screen'); + const isBrightness = url.includes('/brightness'); if (isScreen) { const screenshotFile = path.resolve(__dirname, '../../screenshots/' + uuid + '.png'); const fileStream = fs.createWriteStream(screenshotFile); @@ -749,6 +754,14 @@ const get = async (uuid, url) => { logger('dcm').error(`Failed to get screenshot for ${uuid} at ${url}. Are you sure the device is up? ${err.code}`); }) .pipe(fileStream); + }else if (isBrightness){ + request.post(url, (err) => { + if (err) { + logger('dcm').error(`Error: ${err}`); + } + }).on('error', (err) => { + logger('dcm').error(`Error occurred: ${err}`); + }); } else { request.get(url, (err) => { if (err) { From e2f40c5ab8bd50edc41cc324346245bc2e3b6630 Mon Sep 17 00:00:00 2001 From: dergelm <59627708+dergelm@users.noreply.github.com> Date: Mon, 12 Jul 2021 21:46:46 +0200 Subject: [PATCH 2/7] Update devices.mustache --- src/views/devices.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/devices.mustache b/src/views/devices.mustache index ed500cc..675df6e 100644 --- a/src/views/devices.mustache +++ b/src/views/devices.mustache @@ -21,6 +21,7 @@ +
From 3d17c642588727813b0cfbb60aeaf70f42dcea60 Mon Sep 17 00:00:00 2001 From: dergelm <59627708+dergelm@users.noreply.github.com> Date: Fri, 16 Jul 2021 00:46:05 +0200 Subject: [PATCH 3/7] Update en.json --- static/locales/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/locales/en.json b/static/locales/en.json index 847ff4e..cacd41e 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -144,5 +144,6 @@ "Timezone": "Timezone", "Clear Device IP Addresses": "Clear Device IP Addresses", "Model": "Model", - "Exclude From Reboots": "Exclude From Reboots" + "Exclude From Reboots": "Exclude From Reboots", + "Dimm All Devices": "Dimm All Devices" } From 19e6ae81fe33d3368848355b49ebdb592e5b7e70 Mon Sep 17 00:00:00 2001 From: dergelm <59627708+dergelm@users.noreply.github.com> Date: Fri, 16 Jul 2021 00:46:32 +0200 Subject: [PATCH 4/7] Update de.json --- static/locales/de.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/locales/de.json b/static/locales/de.json index ff2f2f1..466512c 100644 --- a/static/locales/de.json +++ b/static/locales/de.json @@ -144,5 +144,6 @@ "Timezone": "Timezone", "Clear Device IP Addresses": "Clear Device IP Addresses", "Model": "Model", - "Exclude From Reboots": "Exclude From Reboots" + "Exclude From Reboots": "Exclude From Reboots", + "Dimm All Devices": "Dimm All Devices" } From 490cc99571ccb2bbabd86678159c065ce225d061 Mon Sep 17 00:00:00 2001 From: dergelm <59627708+dergelm@users.noreply.github.com> Date: Fri, 16 Jul 2021 00:46:57 +0200 Subject: [PATCH 5/7] Update es.json --- static/locales/es.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/locales/es.json b/static/locales/es.json index 4fa64a0..e5b8e63 100644 --- a/static/locales/es.json +++ b/static/locales/es.json @@ -142,5 +142,6 @@ "Timezone": "Timezone", "Clear Device IP Addresses": "Clear Device IP Addresses", "Model": "Model", - "Exclude From Reboots": "Exclude From Reboots" + "Exclude From Reboots": "Exclude From Reboots", + "Dimm All Devices": "Dimm All Devices" } From fbebe6dfcec9d8e24e1cb5ecda2236d5505c1e0b Mon Sep 17 00:00:00 2001 From: versx Date: Thu, 15 Jul 2021 15:53:42 -0700 Subject: [PATCH 6/7] Fix indentation --- src/routes/api.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes/api.js b/src/routes/api.js index 99753ff..f750d33 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -754,14 +754,14 @@ const get = async (uuid, url) => { logger('dcm').error(`Failed to get screenshot for ${uuid} at ${url}. Are you sure the device is up? ${err.code}`); }) .pipe(fileStream); - }else if (isBrightness){ - request.post(url, (err) => { - if (err) { - logger('dcm').error(`Error: ${err}`); - } - }).on('error', (err) => { - logger('dcm').error(`Error occurred: ${err}`); - }); +} else if (isBrightness) { + request.post(url, (err) => { + if (err) { + logger('dcm').error(`Error: ${err}`); + } + }).on('error', (err) => { + logger('dcm').error(`Error occurred: ${err}`); + }); } else { request.get(url, (err) => { if (err) { From a0adb375b557ae664ba0fc7a49b9542531ec0e78 Mon Sep 17 00:00:00 2001 From: versx Date: Thu, 15 Jul 2021 15:55:34 -0700 Subject: [PATCH 7/7] Fix indentation again... --- src/routes/api.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes/api.js b/src/routes/api.js index f750d33..63a1517 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -754,14 +754,14 @@ const get = async (uuid, url) => { logger('dcm').error(`Failed to get screenshot for ${uuid} at ${url}. Are you sure the device is up? ${err.code}`); }) .pipe(fileStream); -} else if (isBrightness) { - request.post(url, (err) => { - if (err) { - logger('dcm').error(`Error: ${err}`); - } - }).on('error', (err) => { - logger('dcm').error(`Error occurred: ${err}`); - }); + } else if (isBrightness) { + request.post(url, (err) => { + if (err) { + logger('dcm').error(`Error: ${err}`); + } + }).on('error', (err) => { + logger('dcm').error(`Error occurred: ${err}`); + }); } else { request.get(url, (err) => { if (err) {