diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-17 13:41:06 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-17 13:41:06 +0000 |
commit | 06f7696c0976c75c13435f84a2101c1203c18b95 (patch) | |
tree | 9ea52c784f4bc5013c8e8af32e82c0a497889b32 /priv/home.html.eex | |
download | mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.tar mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.tar.gz mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.zip |
Initial commit
Diffstat (limited to 'priv/home.html.eex')
-rw-r--r-- | priv/home.html.eex | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/priv/home.html.eex b/priv/home.html.eex new file mode 100644 index 0000000..5936e6c --- /dev/null +++ b/priv/home.html.eex @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>home | mediasync</title> + <link rel="stylesheet" href="/static/main.css"> +</head> + +<body> + <form action="/host_room" method="post"> + <input name="_csrf_token" type="hidden" value="<%= Plug.CSRFProtection.get_csrf_token() %>"> + <label for="host_room_input_video_url">video url:</label> + <input name="video_url" id="host_room_input_video_url" type="url" + maxlength="<%= Application.get_env(:mediasync, :max_video_url_size) %>" required><br> + + <script> + "use strict"; + /* The built-in validation for <input type="url"> seems very half-hearted in my + testing (Firefox 127.0.2), so let's replace it with something complete. */ + (() => { + const checkURLInputValidity = (urlInput) => { + if (URL.canParse(urlInput.value)) { + urlInput.setCustomValidity(""); + } else { + urlInput.setCustomValidity("Please enter a valid URL."); + } + urlInput.reportValidity(); + }; + const urlInput = document.querySelector("input#host_room_input_video_url"); + checkURLInputValidity(urlInput); + urlInput.addEventListener("input", e => checkURLInputValidity(e.target)); + })(); + </script> + + <input type="submit" value="host room"> + </form> +</body> + +</html> |