@frangoteam/fuxa-min 1.2.11 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/auth/index.js +141 -3
- package/api/command/index.js +1 -1
- package/api/index.js +21 -2
- package/api/jwt-helper.js +3 -1
- package/api/resources/index.js +19 -2
- package/api/scripts/index.js +7 -3
- package/dist/3rdpartylicenses.txt +139 -7
- package/dist/assets/i18n/de.json +10 -0
- package/dist/assets/i18n/en.json +21 -3
- package/dist/assets/i18n/es.json +12 -0
- package/dist/assets/i18n/fr.json +11 -0
- package/dist/assets/i18n/ja.json +16 -6
- package/dist/assets/i18n/ko.json +12 -0
- package/dist/assets/i18n/pt.json +9 -2
- package/dist/assets/i18n/ru.json +11 -0
- package/dist/assets/i18n/sv.json +11 -1
- package/dist/assets/i18n/tr.json +8 -1
- package/dist/assets/i18n/ua.json +9 -2
- package/dist/assets/i18n/zh-cn.json +11 -0
- package/dist/assets/i18n/zh-tw.json +12 -1
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +17 -23
- package/dist/index.html +2 -2
- package/dist/main.72bdfed42c527918.js +329 -0
- package/dist/polyfills.d7de05f9af2fb559.js +1 -0
- package/dist/{runtime.8ef63094e52a66ba.js → runtime.9136a61a9b98f987.js} +1 -1
- package/dist/{scripts.40b60f02658462e4.js → scripts.d9e6ee984bf6f3b7.js} +1 -1
- package/dist/styles.545e37beb3e671ba.css +1 -0
- package/docs/openapi.yaml +3 -0
- package/integrations/node-red/index.js +4 -5
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-daq.html +56 -5
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-daq.js +8 -2
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag-change.html +56 -5
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag-change.js +12 -12
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag-daq-settings.html +56 -5
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag-daq-settings.js +14 -10
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag.html +69 -14
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag.js +44 -12
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-set-tag-daq-settings.html +56 -5
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-set-tag-daq-settings.js +24 -20
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-set-tag.html +72 -13
- package/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-set-tag.js +33 -7
- package/main.js +38 -17
- package/package.json +10 -5
- package/runtime/alarms/alarmstorage.js +45 -30
- package/runtime/apikeys/apiKeysStorage.js +34 -22
- package/runtime/devices/adsclient/index.js +1 -1
- package/runtime/devices/ethernetip/index.js +1 -1
- package/runtime/devices/gpio/index.js +1 -1
- package/runtime/devices/odbc/index.js +14 -9
- package/runtime/devices/s7/index.js +2 -2
- package/runtime/devices/template/index.js +14 -14
- package/runtime/notificator/notifystorage.js +34 -23
- package/runtime/project/index.js +16 -0
- package/runtime/project/prjstorage.js +78 -40
- package/runtime/scripts/index.js +6 -2
- package/runtime/storage/calculator.js +17 -13
- package/runtime/storage/daqstorage.js +28 -2
- package/runtime/storage/influxdb/index.js +8 -3
- package/runtime/storage/questdb/index.js +224 -0
- package/runtime/storage/sqlite/index.js +11 -8
- package/runtime/storage/tdengine/index.js +24 -9
- package/runtime/users/usrstorage.js +65 -61
- package/runtime/utils.js +5 -0
- package/settings.default.js +8 -2
- package/dist/main.92522279642ef880.js +0 -329
- package/dist/polyfills.c8e7db9850a3ad8b.js +0 -1
- package/dist/styles.03cc550382689976.css +0 -1
|
@@ -15,6 +15,18 @@ var settings // Application settings
|
|
|
15
15
|
var logger; // Application logger
|
|
16
16
|
var db_usr; // Database of users
|
|
17
17
|
|
|
18
|
+
function _run(sql, params = []) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
db_usr.run(sql, params, function (err) {
|
|
21
|
+
if (err) {
|
|
22
|
+
reject(err);
|
|
23
|
+
} else {
|
|
24
|
+
resolve(this);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
/**
|
|
19
31
|
* Init and bind the database resource
|
|
20
32
|
* @param {*} _settings
|
|
@@ -96,16 +108,13 @@ function _checkUpdate(columnsToAdd) {
|
|
|
96
108
|
*/
|
|
97
109
|
function setDefault() {
|
|
98
110
|
return new Promise(function (resolve, reject) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
sql
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
resolve();
|
|
108
|
-
}
|
|
111
|
+
const sql = "INSERT OR REPLACE INTO users (username, fullname, password, groups) VALUES(?, ?, ?, ?)";
|
|
112
|
+
const params = ['admin', 'Administrator Account', bcrypt.hashSync('123456', 10), -1];
|
|
113
|
+
_run(sql, params).then(() => {
|
|
114
|
+
resolve();
|
|
115
|
+
}).catch((err) => {
|
|
116
|
+
logger.error(`usrstorage.set failed! ${err}`);
|
|
117
|
+
reject();
|
|
109
118
|
});
|
|
110
119
|
});
|
|
111
120
|
}
|
|
@@ -136,33 +145,33 @@ function getUsers(user) {
|
|
|
136
145
|
*/
|
|
137
146
|
function setUser(usr, fullname, pwd, groups, info) {
|
|
138
147
|
return new Promise(function (resolve, reject) {
|
|
139
|
-
// prepare query
|
|
140
|
-
var exist = false;
|
|
141
148
|
getUsers({ username: usr }).then(function (data) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var sql = "";
|
|
149
|
+
const exist = data && data.length;
|
|
150
|
+
let sql = '';
|
|
151
|
+
let params = [];
|
|
146
152
|
if (pwd) {
|
|
147
|
-
|
|
153
|
+
const hashedPwd = bcrypt.hashSync(pwd, 10);
|
|
148
154
|
if (exist) {
|
|
149
|
-
sql = "UPDATE users SET password =
|
|
155
|
+
sql = "UPDATE users SET password = ?, info = ?, groups = ?, fullname = ? WHERE username = ?";
|
|
156
|
+
params = [hashedPwd, info, groups, fullname, usr];
|
|
157
|
+
} else {
|
|
158
|
+
sql = "INSERT OR REPLACE INTO users (username, fullname, password, groups, info) VALUES(?, ?, ?, ?, ?)";
|
|
159
|
+
params = [usr, fullname, hashedPwd, groups, info];
|
|
150
160
|
}
|
|
161
|
+
} else if (exist) {
|
|
162
|
+
sql = "UPDATE users SET groups = ?, info = ?, fullname = ? WHERE username = ?";
|
|
163
|
+
params = [groups, info, fullname, usr];
|
|
151
164
|
} else {
|
|
152
|
-
sql = "INSERT OR REPLACE INTO users (username, fullname, groups, info) VALUES(
|
|
153
|
-
|
|
154
|
-
sql = "UPDATE users SET groups = '" + groups + "', info = '" + info + "', fullname = '" + fullname + "' WHERE username = '" + usr + "';";
|
|
155
|
-
}
|
|
165
|
+
sql = "INSERT OR REPLACE INTO users (username, fullname, groups, info) VALUES(?, ?, ?, ?)";
|
|
166
|
+
params = [usr, fullname, groups, info];
|
|
156
167
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
resolve();
|
|
163
|
-
}
|
|
168
|
+
_run(sql, params).then(() => {
|
|
169
|
+
resolve();
|
|
170
|
+
}).catch((err) => {
|
|
171
|
+
logger.error(`usrstorage.set failed! ${err}`);
|
|
172
|
+
reject();
|
|
164
173
|
});
|
|
165
|
-
}).catch(function (
|
|
174
|
+
}).catch(function () {
|
|
166
175
|
reject();
|
|
167
176
|
});
|
|
168
177
|
});
|
|
@@ -173,15 +182,12 @@ function setUser(usr, fullname, pwd, groups, info) {
|
|
|
173
182
|
*/
|
|
174
183
|
function removeUser(usr) {
|
|
175
184
|
return new Promise(function (resolve, reject) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
} else {
|
|
183
|
-
resolve();
|
|
184
|
-
}
|
|
185
|
+
var sql = "DELETE FROM users WHERE username = ?";
|
|
186
|
+
_run(sql, [usr]).then(() => {
|
|
187
|
+
resolve();
|
|
188
|
+
}).catch((err) => {
|
|
189
|
+
logger.error(`usrstorage.remove failed! ${err}`);
|
|
190
|
+
reject();
|
|
185
191
|
});
|
|
186
192
|
});
|
|
187
193
|
}
|
|
@@ -207,18 +213,17 @@ function getRoles() {
|
|
|
207
213
|
*/
|
|
208
214
|
function setRoles(roles) {
|
|
209
215
|
return new Promise(async function (resolve, reject) {
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
try {
|
|
217
|
+
const sql = "INSERT OR REPLACE INTO roles (name, value) VALUES(?, ?)";
|
|
218
|
+
for (const role of roles) {
|
|
219
|
+
const value = JSON.stringify(role);
|
|
220
|
+
await _run(sql, [role.id, value]);
|
|
221
|
+
}
|
|
222
|
+
resolve();
|
|
223
|
+
} catch (err) {
|
|
224
|
+
logger.error(`usrstorage.set role failed! ${err}`);
|
|
225
|
+
reject();
|
|
220
226
|
}
|
|
221
|
-
resolve();
|
|
222
227
|
});
|
|
223
228
|
}
|
|
224
229
|
|
|
@@ -227,17 +232,16 @@ function setRoles(roles) {
|
|
|
227
232
|
*/
|
|
228
233
|
function removeRoles(roles) {
|
|
229
234
|
return new Promise(async function (resolve, reject) {
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
try {
|
|
236
|
+
const sql = "DELETE FROM roles WHERE name = ?";
|
|
237
|
+
for (const role of roles) {
|
|
238
|
+
await _run(sql, [role.id]);
|
|
239
|
+
}
|
|
240
|
+
resolve();
|
|
241
|
+
} catch (err) {
|
|
242
|
+
logger.error(`usrstorage.remove role failed! ${err}`);
|
|
243
|
+
reject();
|
|
239
244
|
}
|
|
240
|
-
resolve();
|
|
241
245
|
});
|
|
242
246
|
}
|
|
243
247
|
|
|
@@ -260,4 +264,4 @@ module.exports = {
|
|
|
260
264
|
getRoles: getRoles,
|
|
261
265
|
setRoles: setRoles,
|
|
262
266
|
removeRoles: removeRoles
|
|
263
|
-
};
|
|
267
|
+
};
|
package/runtime/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
const ip = require('ip');
|
|
3
|
+
const crypto = require('crypto');
|
|
3
4
|
|
|
4
5
|
'use strict';
|
|
5
6
|
var utils = module.exports = {
|
|
@@ -361,5 +362,9 @@ var utils = module.exports = {
|
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
return target;
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
generateSecretCode: function(byteLength = 32) {
|
|
368
|
+
return crypto.randomBytes(byteLength).toString('hex');
|
|
364
369
|
}
|
|
365
370
|
}
|
package/settings.default.js
CHANGED
|
@@ -6,6 +6,9 @@ module.exports = {
|
|
|
6
6
|
// Standard language (editor)
|
|
7
7
|
language: 'en',
|
|
8
8
|
|
|
9
|
+
// Hide the editor onboarding wizard when entering editor mode
|
|
10
|
+
hideEditorOnboarding: false,
|
|
11
|
+
|
|
9
12
|
// The tcp port that the FUXA web server is listening on
|
|
10
13
|
uiPort: process.env.PORT || 1881,
|
|
11
14
|
|
|
@@ -24,6 +27,7 @@ module.exports = {
|
|
|
24
27
|
// - 'common': Less detailed than 'combined', omitting the referrer and user-agent.
|
|
25
28
|
// - 'short': Shorter format that includes the remote address and request details.
|
|
26
29
|
// - 'tiny': Minimalist format, showing just the method, URL, status, response length, and response time.
|
|
30
|
+
// - 'none': Completely disables HTTP request logging to clean the console for custom debugging scripts and reduce I/O overhead.
|
|
27
31
|
//
|
|
28
32
|
// Default Value:
|
|
29
33
|
// - 'combined': By default, logApiLevel is set to 'combined', providing detailed logs suitable for thorough tracking and analysis.
|
|
@@ -91,8 +95,10 @@ module.exports = {
|
|
|
91
95
|
|
|
92
96
|
// Used to enable security, authentication and authorization and crypt Token
|
|
93
97
|
//secureEnabled: true,
|
|
94
|
-
//secretCode: '
|
|
95
|
-
//tokenExpiresIn: '1h' // '1h'=1hour, 60=60seconds, '1d'=1day
|
|
98
|
+
//secretCode: '<set-a-strong-random-secret>',
|
|
99
|
+
//tokenExpiresIn: '1h', // '1h'=1hour, 60=60seconds, '1d'=1day
|
|
100
|
+
//enableRefreshCookieAuth: false, // if true, use refresh token HttpOnly cookie flow
|
|
101
|
+
//refreshTokenExpiresIn: '7d' // '7d'=7days, 12h=12hours, 3600=3600seconds
|
|
96
102
|
|
|
97
103
|
// Heartbeat interval in seconds (1-20)
|
|
98
104
|
heartbeatIntervalSec: 10,
|