Added a basic settings page to many widgets

This commit is contained in:
nuttylmao
2025-05-17 06:48:58 +10:00
parent 396d625437
commit 8c8f134968
18 changed files with 432 additions and 0 deletions
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="../../.resources/logo.png" type="image/png">
<title>nutty</title>
<style>
body {
margin: 0;
display: flex;
background: #181818;
}
#widgetContainer {
width: 100vw;
height: 100vh;
border-width: 0px;
}
</style>
</head>
<body>
<iframe id="widgetContainer"></iframe>
<script src="script.js"></script>
</body>
</html>
@@ -0,0 +1,23 @@
const widgetContainer = document.getElementById('widgetContainer');
const settingsPageURL = '../../.utilities/settings-page-builder';
const currentURL = window.location.href;
let settingsJSON;
let baseURL = currentURL;
if (baseURL.endsWith("index.html"))
baseURL = baseURL.replace("index.html", "");
settingsJSON = "?settingsJson=" + baseURL + "settings.json";
const lastSlashIndex = baseURL.lastIndexOf("/");
let widgetURL = "&widgetURL=" + baseURL.replace("/settings", "");
console.debug("Window Ref: " + window.location.href);
console.debug("Base URL: " + baseURL);
console.debug("Settings JSON: " + settingsJSON);
console.debug("Widget URL: " + widgetURL);
widgetContainer.src = settingsPageURL + settingsJSON + widgetURL;
@@ -0,0 +1,20 @@
{
"settings": [
{
"id": "address",
"label": "Address",
"description": "Streamer.bot Websocket Server Address",
"type": "text",
"defaultValue": "127.0.0.1",
"group": "Advanced"
},
{
"id": "port",
"label": "Port",
"description": "Streamer.bot Websocket Server Port",
"type": "text",
"defaultValue": "8080",
"group": "Advanced"
}
]
}