forked from apoc/chaospott_mumble
Merge pull request 'Remove all BBB stuff from chaospott_mumble.js' (#1) from Schnitzel/chaospott_mumble:main into main
Reviewed-on: apoc/chaospott_mumble#1
This commit is contained in:
commit
d247ba4d72
@ -3,12 +3,10 @@
|
||||
// icon-color: deep-green; icon-glyph: power-off;
|
||||
const mumbleApiUrl = "https://status.chaospott.de/chaospott_mumble.json";
|
||||
const spaceApiUrl = "https://status.chaospott.de/status.json";
|
||||
const bbbApiUrl = "https://unterricht.roschow.de/chaospott_bbb.json";
|
||||
const logoUrl = "https://chaospott.de/images/logo.png";
|
||||
const logoLocalFilename = "chaospott_logo.png";
|
||||
const mumbleLocalFilename = "chaospott_mumble.json";
|
||||
const spaceLocalFilename = "chaospott_space.json";
|
||||
const bbbLocalFilename = "chaospott_bbb.json";
|
||||
|
||||
const title = "Chaospott";
|
||||
const subTitle = "Essen";
|
||||
@ -44,7 +42,6 @@ async function createWidget(){
|
||||
try {
|
||||
var [mumbleStatus, mumbleFresh] = await getJSONandCache(mumbleLocalFilename, mumbleApiUrl);
|
||||
var [spaceStatus, spaceFresh] = await getJSONandCache(spaceLocalFilename, spaceApiUrl);
|
||||
var [bbbStatus, bbbFresh] = await getJSONandCache(bbbLocalFilename, bbbApiUrl);
|
||||
} catch(err) {
|
||||
const errorList = new ListWidget();
|
||||
errorList.addText("Please enable internet for initial execution.");
|
||||
@ -75,23 +72,10 @@ async function createWidget(){
|
||||
colorBorderLonely = colorLonelyStale;
|
||||
}
|
||||
|
||||
if (bbbFresh){
|
||||
colorBBBOpen = colorOpenFresh;
|
||||
colorBBBClosed = colorClosedFresh;
|
||||
colorBBBLonely = colorLonelyFresh;
|
||||
} else {
|
||||
colorBBBOpen = colorOpenStale;
|
||||
colorBBBClosed = colorClosedStale;
|
||||
colorBBBLonely = colorLonelyStale;
|
||||
colorBorderOpen = colorOpenStale;
|
||||
colorBorderClosed = colorClosedStale;
|
||||
colorBorderLonely = colorLonelyStale;
|
||||
}
|
||||
|
||||
if (spaceStatus.state.open){
|
||||
widget.backgroundColor = colorBorderOpen;
|
||||
} else {
|
||||
switch(mumbleStatus.connected_users + bbbStatus.participantCount){
|
||||
switch(mumbleStatus.connected_users){
|
||||
case 0:
|
||||
widget.backgroundColor = colorBorderClosed;
|
||||
break;
|
||||
@ -174,37 +158,6 @@ async function createWidget(){
|
||||
|
||||
bottomRow.addSpacer(10);
|
||||
|
||||
const bbbLabelStack = bottomRow.addStack();
|
||||
bbbLabelStack.layoutVertically();
|
||||
const labelBBB = bbbLabelStack.addText("BBB");
|
||||
labelBBB.font = Font.regularSystemFont(12);
|
||||
|
||||
let bbbLastUpdate = new Date(bbbStatus.startTime);
|
||||
let labelBBBUpdated;
|
||||
if(bbbStatus.active){
|
||||
labelBBBUpdated = bbbLabelStack.addDate(bbbLastUpdate);
|
||||
labelBBBUpdated.applyTimeStyle();
|
||||
} else {
|
||||
labelBBBUpdated = bbbLabelStack.addText("---");
|
||||
}
|
||||
labelBBBUpdated.font = Font.mediumSystemFont(6);
|
||||
|
||||
|
||||
bottomRow.addSpacer(3);
|
||||
|
||||
const bbbValueStack = bottomRow.addStack();
|
||||
const labelBBBUser = bbbValueStack.addText(bbbStatus.participantCount.toString(10));
|
||||
labelBBBUser.font = Font.boldSystemFont(23);
|
||||
switch(bbbStatus.participantCount){
|
||||
case 0:
|
||||
labelBBBUser.textColor = colorBBBClosed;
|
||||
break;
|
||||
case 1:
|
||||
labelBBBUser.textColor = colorBBBLonely;
|
||||
break;
|
||||
default:
|
||||
labelBBBUser.textColor = colorBBBOpen;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user