Skip to content

Commit

Permalink
Create PyBLOCK-Bitaxe.scriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
SatoshiNakamotoBitcoin authored Oct 17, 2024
1 parent a26b086 commit 824612f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions PyBLOCK-Bitaxe.scriptable
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## PyBLOCK Bitaxe Widget by PyBLOCK Crew ##
## Change BITAXE-IP x Your-Bitaxe-IP ##

let device = new Request("http://BITAXE-IP/api/system/info");
let pyblock = await device.loadString();
let cuts = pyblock.split(',');
let visibleString = [
cuts[1],
cuts[8],
cuts[9],
cuts[16],
cuts[20]
].join('\n');
console.log(visibleString);
let widget = await createWidget();
if (config.runsInWidget)
{
Script.setWidget(widget);
}
else
{
widget.presentLarge();
}
Script.complete();
async function createWidget()
{
let listwidget = new ListWidget();
listwidget.backgroundColor = new Color("#000000");
let nextRefresh = Date.now() + 1000*10
listwidget.refreshAfterDate = new Date(nextRefresh)
listwidget.backgroundColor = new Color("#000000");
let req = new Request('https://pbs.twimg.com/media/GBBj4bIWUAAq3vK.jpg');
let SN = await req.loadImage();
let gn = listwidget.addImage(SN).centerAlignImage(SN)
let mem = listwidget.addText(visibleString);
mem.centerAlignText();
mem.font = Font.boldSystemFont(15);
mem.textColor = new Color("#0aff17");
let logo = new Request('https://static.wixstatic.com/media/bf9129_6f52f6b1a0b74609b9afc93388a1baf5~mv2.png/v1/fill/w_560,h_314,al_c,q_85,usm_1.20_1.00_0.01,enc_auto/bitaxewhite.png');
let BT = await logo.loadImage();
let ng = listwidget.addImage(BT).centerAlignImage(BT);
return listwidget;
}

0 comments on commit 824612f

Please sign in to comment.