master
Martin Zwigl 2025-03-08 00:56:08 +01:00
parent eff4ebc33c
commit 3ad611799f
2 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,7 @@
const settings = require("Storage").readJSON("coin_info.settings.json",1)||{};
const db = require("Storage").readJSON("coin_info.cmc_key.json",1)||{};
const logFile = require("Storage").open("log.txt", "a");
if (!(settings.tokenSelected instanceof Array))
settings.tokenSelected = [];
@ -24,16 +25,21 @@
})
.then(cmcResult => {
// text: JSON.parse(cmcResult.resp).data["1"].symbol, // Fixed data path
logFile.write(cmcResult.toString());
const apiData = JSON.parse(cmcResult.resp); // Correctly declare variable
logFile.write(apiData.toString());
return {
text: apiData.symbol,
img: COIN_ICON
};
})
.catch(err => ({
text: err.toString(),
img: COIN_ICON
}));
.catch(err => {
logFile.write("API Error: " + err.toString());
return {
text: err.toString(),
img: COIN_ICON
}
});
},
show : function() {
var self = this;

View File

@ -1,7 +1,7 @@
{ "id": "coin_info",
"name": "Crypto-Coins Info",
"shortName":"Coins Info",
"version": "0.04.21",
"version": "0.04.22",
"description": "Crypto-Coins Infos with the help of the Coinmarketcap API",
"icon": "app.png",
"tags": "clkinfo",
@ -16,6 +16,7 @@
{"name":"coin_info.app.js","url":"app.js"},
{"name":"coin_info.clkinfo.js","url":"clkinfo.js"},
{"name":"coin_info.settings.js","url":"settings.js"},
{"name":"coin_info.img","url":"app-icon.js","evaluate":true}
{"name":"coin_info.img","url":"app-icon.js","evaluate":true},
{"name":"coin_info.log.txt","url":"log.txt"}
]
}