diff --git a/README.md b/README.md
index 523acfd..099119e 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,11 @@
## Changelog
+### 0.4.0 (2024-10-07)
+
+- (o0shojo0o) added PixelIt UUID to Core-Node (is necessary in the future to use the API)
+- (o0shojo0o) update dependencies
+
### 0.3.14 (2022-08-16)
- (o0shojo0o) better JSON error handling
diff --git a/pixelit/core.html b/pixelit/core.html
index 40d7583..0af6f07 100644
--- a/pixelit/core.html
+++ b/pixelit/core.html
@@ -6,6 +6,9 @@
name: {
value: "Core"
},
+ uuid: {
+ value: ""
+ },
ip: {
value: ""
},
@@ -26,7 +29,11 @@
-
+
+
+
+
+
diff --git a/pixelit/core.js b/pixelit/core.js
index c27bc08..36ec2e3 100644
--- a/pixelit/core.js
+++ b/pixelit/core.js
@@ -1,7 +1,7 @@
//@ts-check
"use strict";
const tools = require("./lib/tools");
-const axios = require("axios").default;
+const axios = require("axios");
const errorImage = '[64512,0,0,0,0,0,0,64512,0,64512,0,0,0,0,64512,0,0,0,64512,0,0,64512,0,0,0,0,0,64512,64512,0,0,0,0,0,0,64512,64512,0,0,0,0,0,64512,0,0,64512,0,0,0,64512,0,0,0,0,64512,0,64512,0,0,0,0,0,0,64512]';
module.exports = (red) => {
@@ -15,6 +15,7 @@ module.exports = (red) => {
let sleepModeActive = context.get("sleepModeActive") || false;
let sendOverHTTPActive = true;
let mqttMasterTopic = tools.getValue(red, config.masterTopic, msg) || "";
+ const uuid = config.uuid;
// Clean Master Topic
if (mqttMasterTopic.substr(mqttMasterTopic.length - 1) === "/") {
@@ -413,6 +414,8 @@ module.exports = (red) => {
let webBmp = errorImage;
let webResult;
+
+
if (input) {
if (String(input).includes(",")) {
return input;
@@ -425,7 +428,7 @@ module.exports = (red) => {
}
try {
- const res = await axios.get(`https://pixelit.bastelbunker.de/API/GetBMPByID/${input}`, {
+ const res = await axios.get(`https://pixelit.bastelbunker.de/API/GetBMPByID/${input}?uuid=${uuid}`, {
headers: {
"User-Agent": "Node_Red_Core",
"Content-type": "application/json; charset=utf-8",
@@ -434,7 +437,7 @@ module.exports = (red) => {
});
webResult = res.data;
} catch (error) {
- node.status({
+ node.status({
fill: "red",
shape: "dot",
text: `Failed to download icon ${input}. Check Node-RED log.`,
@@ -443,7 +446,7 @@ module.exports = (red) => {
webResult = undefined;
}
- if (webResult && webResult.id && webResult.id != 0) {
+ if (webResult?.id != 0) {
webBmp = webResult.rgB565Array;
context.set(`bmpCache_${input}`, webBmp);
}