diff options
author | lassulus <lassulus@lassul.us> | 2022-05-18 17:22:07 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-05-18 17:22:07 +0200 |
commit | ca1621c17f867d006c4c394b3be046d42a6c5c7d (patch) | |
tree | 5256ebb49d2a58b347455009791710f1de7a20a1 /lass/2configs | |
parent | 5cbb9aeb7249c51e7a6f4075695e0ca1ec9e0296 (diff) |
l radio: rate limit downvotes
Diffstat (limited to 'lass/2configs')
-rw-r--r-- | lass/2configs/radio/controls.html | 83 | ||||
-rw-r--r-- | lass/2configs/radio/default.nix | 81 |
2 files changed, 84 insertions, 80 deletions
diff --git a/lass/2configs/radio/controls.html b/lass/2configs/radio/controls.html new file mode 100644 index 000000000..858dc3656 --- /dev/null +++ b/lass/2configs/radio/controls.html @@ -0,0 +1,83 @@ +<!doctype html> + +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <title>The_Playlist Voting!</title> +<style> +#good { + display: block; + width: 100%; + border: none; + background-color: #04AA6D; + padding: 14px; + margin: 14px 0 0 0; + height: 100px; + font-size: 16px; + cursor: pointer; + text-align: center; +} +#bad { + display: block; + width: 100%; + border: none; + background-color: red; + padding: 14px; + height: 100px; + + margin: 14px 0 0 0; + font-size: 16px; + cursor: pointer; + text-align: center; +} +</style> + +</head> + +<body> + <div id=votenote></div> + <button id=good type="button"> GUT </button> + + <button id=bad type="button"> SCHLECHT </button> + <center> + Currently Running: <br/><div> + <b id=current></b> + </div> + <div id=vote> + </div> + <audio controls autoplay="autoplay"> + <source src="https://radio.lassul.us/radio.ogg" type="audio/ogg"> + Your browser does not support the audio element. + </audio> + </center> + + <script> + document.getElementById("good").onclick=async ()=>{ + let result = await fetch("https://radio.lassul.us/good", {"method": "POST"}) + document.getElementById("vote").textContent = "Dieses Lied findest du gut" + }; + document.getElementById("bad").onclick=async ()=>{ + let result = await fetch("https://radio.lassul.us/skip", {"method": "POST"}) + document.getElementById("vote").textContent = "Dieses Lied findest du schlecht" + document.getElementById("bad").disabled = true + window.setTimeout(function(){ + document.getElementById("bad").disabled = false + }, 100000) + + }; + + async function current() { + let result = await fetch("https://radio.lassul.us/current", {"method": "GET"}) + let data = await result.json() + document.getElementById("current").textContent = data.name + } + window.onload = function() { + window.setInterval('current()', 10000) + current() + } + + </script> +</body> +</html> diff --git a/lass/2configs/radio/default.nix b/lass/2configs/radio/default.nix index 34115f56a..a1e220cdb 100644 --- a/lass/2configs/radio/default.nix +++ b/lass/2configs/radio/default.nix @@ -384,86 +384,7 @@ in { ''; locations."= /controls".extraConfig = '' default_type "text/html"; - alias ${pkgs.writeText "controls.html" '' -<!doctype html> - -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <title>The_Playlist Voting!</title> -<style> -#good { - display: block; - width: 100%; - border: none; - background-color: #04AA6D; - padding: 14px; - margin: 14px 0 0 0; - height: 100px; - font-size: 16px; - cursor: pointer; - text-align: center; -} -#bad { - display: block; - width: 100%; - border: none; - background-color: red; - padding: 14px; - height: 100px; - - margin: 14px 0 0 0; - font-size: 16px; - cursor: pointer; - text-align: center; -} -</style> - -</head> - -<body> - <div id=votenote></div> - <button id=good type="button"> GUT </button> - - <button id=bad type="button"> SCHLECHT </button> - <center> - Currently Running: <br/><div> - <b id=current></b> - </div> - <div id=vote> - </div> - <audio controls autoplay="autoplay"> - <source src="https://radio.lassul.us/radio.ogg" type="audio/ogg"> - Your browser does not support the audio element. - </audio> - </center> - - <script> - document.getElementById("good").onclick=async ()=>{ - let result = await fetch("https://radio.lassul.us/good", {"method": "POST"}) - document.getElementById("vote").textContent = "Dieses Lied findest du gut" - }; - document.getElementById("bad").onclick=async ()=>{ - let result = await fetch("https://radio.lassul.us/skip", {"method": "POST"}) - document.getElementById("vote").textContent = "Dieses Lied findest du schlecht" - }; - - async function current() { - let result = await fetch("https://radio.lassul.us/current", {"method": "GET"}) - let data = await result.json() - document.getElementById("current").textContent = data.name - } - window.onload = function() { - window.setInterval('current()', 10000) - current() - } - - </script> -</body> -</html> - ''}; + alias ${./controls.html}; ''; extraConfig = '' add_header 'Access-Control-Allow-Origin' '*'; |