aboutsummaryrefslogtreecommitdiff
path: root/torrent.html
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-12-24 05:48:44 -0300
committerEuAndreh <eu@euandre.org>2020-12-24 05:50:10 -0300
commita9142c9f5ccdfab285f71f48f20573fe7bf8ddff (patch)
tree8ddf44569685afea7160154ce1c19e1795cd1678 /torrent.html
parentUse feature toggle to show podcast links (diff)
downloadeuandre.org-a9142c9f5ccdfab285f71f48f20573fe7bf8ddff.tar.gz
euandre.org-a9142c9f5ccdfab285f71f48f20573fe7bf8ddff.tar.xz
Add torrent.html page with WebTorrent
Diffstat (limited to '')
-rw-r--r--torrent.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/torrent.html b/torrent.html
new file mode 100644
index 0000000..7be57d0
--- /dev/null
+++ b/torrent.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="/styles.css" />
+ <title>WebTorrent player - EuAndreh</title>
+ <script src="/vendor/webtorrent/webtorrent.min.js"></script>
+ </head>
+ <body>
+ <div id="output"></div>
+ <div id="torrentLink"></div>
+ <script>
+ const params = new URLSearchParams(window.location.search);
+ const torrentID = params.get("torrent"); // "https://webtorrent.io/torrents/sintel.torrent";
+ document.querySelector("#torrentLink").innerHTML = `Downloading <a href=${torrentID}>${torrentID}</a>`;
+
+ const client = new WebTorrent();
+ client.add(torrentID, torrent =>
+ torrent.files.forEach(file => file.appendTo("#output")));
+ </script>
+ </body>
+</html>