From c361bc2a521576a344e9b7794d6fabee5e762dd1 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Fri, 15 Jul 2022 16:04:37 +0200 Subject: [PATCH] add assets & rudimentary playing Signed-off-by: Christian Richter --- assets/index.html | 77 +++++++++++++++++++++++++++++++++++++++++++++++ weirdradio.js | 8 +++-- 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 assets/index.html diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 0000000..4e0876e --- /dev/null +++ b/assets/index.html @@ -0,0 +1,77 @@ + + + + Weirdradio + +
+ + + + + \ No newline at end of file diff --git a/weirdradio.js b/weirdradio.js index 3e971dd..803418a 100644 --- a/weirdradio.js +++ b/weirdradio.js @@ -81,14 +81,16 @@ client.on("room.message", (roomId, event) => { //link_matches = body.match(/https?:\/\/[^\ ]*youtu[^\ ]*/g); var r = new RegExp(/https?:\/\/[^\ ]*youtube.com\/watch\?v=([^\ ]*)/g); link_matches = r.exec(body); - console.log(link_matches); if (link_matches && link_matches.length > 1) { - console.log("Relaying: " + link_matches[0]); // pass to server var obj = { - link: + link: link_matches[0], + embedLink: "https://www.youtube.com/embed/" + link_matches[1] + "?autoplay=1", + videoId: link_matches[1], + }; + console.log("Relaying: " + obj.link); sockets.forEach((s) => s.send(JSON.stringify(obj))); } }