From d6204d9a62d8c5bf8a830cf27613400014561954 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Sun, 17 Jul 2022 12:06:47 +0200 Subject: [PATCH] add rudimentary reconnect Signed-off-by: Christian Richter --- assets/index.html | 36 ++++++++++++++++++++++++++++++++++++ config/config.json.example | 1 + weirdradio.js | 4 +++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/assets/index.html b/assets/index.html index d0826d4..a701c7b 100644 --- a/assets/index.html +++ b/assets/index.html @@ -50,6 +50,8 @@ diff --git a/config/config.json.example b/config/config.json.example index c64aca2..36e642c 100644 --- a/config/config.json.example +++ b/config/config.json.example @@ -2,6 +2,7 @@ "homeServerUrl": "https://matrix.your-homeserver.org", "accessToken": "youraccesstokencanbeobtainedthroughriot", "storage": "config/bot.json", + "assetDir": "assets/", "webServerPort": "8080", "webSocketServerPort":"8090", "monitorChannels": [ diff --git a/weirdradio.js b/weirdradio.js index e1d265f..ce95dda 100644 --- a/weirdradio.js +++ b/weirdradio.js @@ -21,11 +21,13 @@ const client = new MatrixClient( ); // load assets +console.log("Reading assets...") let assets = []; -var files = fs.readdirSync("assets/"); +var files = fs.readdirSync(config.assetDir); files.forEach((name) => { assets[name] = fs.readFileSync("assets/" + name); }); +console.log("[DONE]") // create server, this is for delivering the iframe page const webServer = http .createServer((req, res) => {