New "Connection Status" popup

This commit is contained in:
nutty
2026-10-20 10:40:46 +11:00
parent 58495dcc7e
commit 773de858ac
17 changed files with 203 additions and 213 deletions
+10 -28
View File
@@ -145,6 +145,14 @@ document.documentElement.style.setProperty('--animation-speed', `${animationSpee
// STREAMER.BOT CLIENT //
/////////////////////////
const connectionStatus = new ConnectionStatus({
name: "Streamer.bot",
showDelay: 1000,
disconnectedMessage: "Connecting to Streamer.bot..."
});
connectionStatus.setConnected(false);
const client = new StreamerbotClient({
host: sbServerAddress,
port: sbServerPort,
@@ -153,13 +161,13 @@ const client = new StreamerbotClient({
onConnect: (data) => {
console.log(`Streamer.bot successfully connected to ${sbServerAddress}:${sbServerPort}`)
console.debug(data);
SetConnectionStatus(true);
connectionStatus.setConnected(true);
KickConnect();
},
onDisconnect: () => {
console.error(`Streamer.bot disconnected from ${sbServerAddress}:${sbServerPort}`)
SetConnectionStatus(false);
connectionStatus.setConnected(false);
}
});
@@ -3383,32 +3391,6 @@ function GetWinnersList(gifts) {
}
}
///////////////////////////////////
// STREAMER.BOT WEBSOCKET STATUS //
///////////////////////////////////
// This function sets the visibility of the Streamer.bot status label on the overlay
function SetConnectionStatus(connected) {
let statusContainer = document.getElementById("statusContainer");
if (connected) {
statusContainer.style.background = "#2FB774";
statusContainer.innerText = "Connected!";
statusContainer.style.opacity = 1;
setTimeout(() => {
statusContainer.style.transition = "all 2s ease";
statusContainer.style.opacity = 0;
}, 10);
}
else {
statusContainer.style.background = "#D12025";
statusContainer.innerText = "Connecting...";
statusContainer.style.transition = "";
statusContainer.style.opacity = 1;
}
}
async function GetYouTubeVideoData(videoId) {
const url = `https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`;