lint src files

This commit is contained in:
2022-12-12 14:58:54 -06:00
parent b754eece0d
commit 8df019aee4
4 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ function registerDevice(newDevice) {
devices[id].plugin = PLUGINS.all[newDevice.type];
if (
Object.keys(devices[id].fields).length == 0 &&
Object.keys(devices[id].fields).length === 0 &&
PLUGINS.all[newDevice.type].config.fields
) {
PLUGINS.all[newDevice.type].config.fields.forEach((field) => {
@@ -206,7 +206,7 @@ function initDeviceConnection(id) {
device.send = (data) => {};
}
//device.plugin = plugins[type];
// device.plugin = plugins[type];
return true;
}
+3 -3
View File
@@ -10,7 +10,7 @@ const allPlugins = {};
module.exports.all = allPlugins;
module.exports.init = function init(callback) {
let pluginDirectoryPath = path.normalize(path.join(__dirname, `../plugins`));
const pluginDirectoryPath = path.normalize(path.join(__dirname, `../plugins`));
console.log(`Loading plugin files... ${pluginDirectoryPath}`);
@@ -48,13 +48,13 @@ module.exports.init = function init(callback) {
)
);
//if (p.heartbeatTimeout === undefined || p.heartbeatTimeout < 50) {
// if (p.heartbeatTimeout === undefined || p.heartbeatTimeout < 50) {
if (p.config.heartbeatTimeout) {
p.heartbeatTimeout = p.config.heartbeatInterval * 1.5;
} else {
p.heartbeatTimeout = 10000;
}
//}
// }
if (p.config.heartbeatInterval) {
p.heartbeatInterval = Math.max(50, p.config.heartbeatInterval);
+1 -1
View File
@@ -24,7 +24,7 @@ function getServers() {
if (
address.family === 'IPv4' &&
!address.internal &&
address.address.substring(0, 3) != '169'
address.address.substring(0, 3) !== '169'
) {
const subnet = ip.subnet(address.address, address.netmask);
let current = ip.toLong(subnet.firstAddress);
+5 -5
View File
@@ -214,21 +214,21 @@ function switchDevice(id) {
document.getElementById('device-settings-fields').innerHTML = '';
if (activeDevice.plugin.config.fields) {
let fields = activeDevice.plugin.config.fields;
const fields = activeDevice.plugin.config.fields;
fields.forEach((field) => {
let $elem = document.createElement('input');
const $elem = document.createElement('input');
$elem.type = 'text';
$elem.value = activeDevice.fields[field.key]; // || field.value;
$elem.name = field.key;
$elem.onchange = function (e) {
$elem.onchange = function onchange(e) {
activeDevice.fields[field.key] = $elem.value;
field.action(activeDevice);
saveAll();
};
if (field.type == 'textinput') {
let rowHTML = `<tr><th>${field.label}:</th><td colspan="3" id="${field.key}"></td></tr>`;
if (field.type === 'textinput') {
const rowHTML = `<tr><th>${field.label}:</th><td colspan="3" id="${field.key}"></td></tr>`;
document
.getElementById('device-settings-fields')
.insertAdjacentHTML('beforeend', rowHTML);