Naming cleanup

master
Martin Zwigl 2025-03-08 12:27:23 +01:00
parent 93fbffed3b
commit 0df72cfc41
6 changed files with 21 additions and 23 deletions

View File

@ -1,2 +1,3 @@
0.03: Initial creation
0.04: Using GB http for Coinmarketcap requests
0.04: Using GB http for Binance API requests
0.05: Lot of cleanup

View File

@ -7,4 +7,4 @@ Crypto-Coins Infos with the help of the Coinmarketcap API
Martin Zwigl
## Reminder for last working
- 0cfd65b919157356d46ccbbeb2416d794312e13a
- 93fbffed3b7a074a8eb0f44b4fa8308f183d1012

View File

@ -1,9 +1,10 @@
(function() {
const COIN_ICON = atob("MDCBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAAAA//8AAAAB///AAAAB8A/gAAAAgAH4AAAwAAB8AAB4AAA+AADwA4APAADgA4APAAHgA4AHgADAf/ADwAAAf/gBwAAAf/wB4AAAcB4A4AAAcA4A4AAAcA4A4AYAcA4AcA8AcB4AcB+Af/wDdj/Af/4D/n/Af/8D/n/AcAcB/A4AcAOA+A4AcAOAcAcAcAOAAAcAcAAAAAcAcAAAAAeAf/AAAAOAf/AAAAPAf/ADAAHgA4AHgADwA4AHAADwA4APAAB8AAA+AAA+AAB8AAAfgAH4AAAH8A/gAAAD///AAAAA//8AAAAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="); // (full base64 string here)
const COIN_ICON = atob("MDCBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAAAA//8AAAAB///AAAAB8A/gAAAAgAH4AAAwAAB8AAB4AAA+AADwA4APAADgA4APAAHgA4AHgADAf/ADwAAAf/gBwAAAf/wB4AAAcB4A4AAAcA4A4AAAcA4A4AYAcA4AcA8AcB4AcB+Af/wDdj/Af/4D/n/Af/8D/n/AcAcB/A4AcAOA+A4AcAOAcAcAcAOAAAcAcAAAAAcAcAAAAAeAf/AAAAOAf/AAAAPAf/ADAAHgA4AHgADwA4AHAADwA4APAAB8AAA+AAA+AAB8AAAfgAH4AAAH8A/gAAAD///AAAAA//8AAAAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==");
const LOAD_ICON_24 = atob("GBiBAAAAAAAeAAGfwAGB4AAAcBgAOBgYHAAYDAAYDGAYBmAYBgAYBgAYBmDbBmB+BgA8DAAYDBgAHBgAOAAAcAGB4AGfwAAeAAAAAA==");
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");
const logFile = require("Storage").open("coin_info_log.txt", "a");
if (!(settings.tokenSelected instanceof Array)) settings.tokenSelected = [];
@ -22,8 +23,8 @@
// Return placeholder while waiting for data
return {
text: "Load...",
img: COIN_ICON
text: "Load",
img: LOAD_ICON_24
};
},
show: function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

View File

@ -4,28 +4,24 @@
</head>
<body>
<h3>Settings for Crypto-Coin Info</h3>
<p>Set Coinmarketcap API key and traceable tokens.</p>
<p>Input for coins to request and calculate against pair.</p>
<p>
<label for="apikey">API Key</label><br>
<input id="apikey" onkeyup="checkInput()" style="width:90%; margin: 3px"></input>
<label for="traceTokens">Traceable tokens. comma delimited</label><br>
<label for="traceTokens">Traceable tokens - comma delimited</label><br>
<input id="traceTokens" onkeyup="checkInput()" style="width:90%; margin: 3px"></input>
<label for="calcPair">Calc price against...</label><br>
<input id="calcPair" onkeyup="checkInput()" style="width:90%; margin: 3px"></input>
<button id="upload" class="btn btn-primary">Save</button>
</p>
<h4>Where to get your personal API key?</h4>
<p>Go to <a href="https://coinmarketcap.com/api/">https://coinmarketcap.com/api/</a> and sign up for a free account.<br>
There are various pricing models with various degrees of API access. As of 2025.02.22 there is also a free tier.</p>
<h4>General Info:</h4>
<p>Requesting from Binance with free API. Get info from their website.</p>
<script src="../../core/lib/interface.js"></script>
<script>
function checkInput() {
if(document.getElementById("apikey").value==="") {
if(document.getElementById("calcPair").value==="") {
document.getElementById('upload').disabled = true;
} else {
document.getElementById('upload').disabled = false;
@ -41,7 +37,7 @@
if(data){
settings = data;
console.log("Got settings", settings);
document.getElementById("apikey").value = settings.apikey;
document.getElementById("calcPair").value = settings.calcPair;
document.getElementById("traceTokens").value = settings.traceTokens;
console.log("Loaded settings from BangleJs.");
checkInput();
@ -56,7 +52,7 @@
document.getElementById("upload").addEventListener("click", function() {
try {
settings.apikey = document.getElementById("apikey").value;
settings.calcPair = document.getElementById("calcPair").value;
settings.traceTokens = document.getElementById("traceTokens").value;
Util.showModal("Saving...");
Util.writeStorage("coin_info.cmc_key.json", JSON.stringify(settings), ()=>{

View File

@ -1,7 +1,7 @@
{ "id": "coin_info",
"name": "Crypto-Coins Info",
"shortName":"Coins Info",
"version": "0.04.29",
"version": "0.05.00",
"description": "Crypto-Coins Infos with the help of the Coinmarketcap API",
"icon": "app.png",
"tags": "clkinfo",
@ -11,7 +11,7 @@
"data": [
{"name":"coin_info.settings.json"},
{"name":"coin_info.cmc_key.json"},
{"name":"coin_info.log.txt"}
{"name":"coin_info.coin_info_log.txt"}
],
"storage": [
{"name":"coin_info.app.js","url":"app.js"},