diff --git a/package.json b/package.json index 15a05f4..ea94b01 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "watch": "watchify public/js/main.js -o public/js/bundle.js", "prestart": "npm run build", "start": "nodemon --ignore public/js/bundle.js index.js", - "poststart": "npm run watch" + "poststart":"npm run watch" }, "author": "", "license": "ISC" diff --git a/public/css/main.css b/public/css/main.css index 7cc8b87..a27f3a8 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -12,4 +12,47 @@ footer { position:fixed; bottom:0; left:0; -} \ No newline at end of file +} + +#output video { + width: 100%; + } + #progressBar { + height: 5px; + width: 0%; + background-color: #35b44f; + transition: width .4s ease-in-out; + } + body.is-seed .show-seed { + display: inline; + } + body.is-seed .show-leech { + display: none; + } + .show-seed { + display: none; + } + #status code { + font-size: 90%; + font-weight: 700; + margin-left: 3px; + margin-right: 3px; + border-bottom: 1px dashed rgba(255,255,255,0.3); + } + + .is-seed #hero { + background-color: #154820; + transition: .5s .5s background-color ease-in-out; + } + #hero { + background-color: #2a3749; + } + #status { + color: #fff; + font-size: 17px; + padding: 5px; + } + a:link, a:visited { + color: #30a247; + text-decoration: none; + } \ No newline at end of file diff --git a/public/js/drag-drop.js b/public/js/drag-drop.js new file mode 100644 index 0000000..7585818 --- /dev/null +++ b/public/js/drag-drop.js @@ -0,0 +1 @@ +(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.DragDrop=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c${torrent.magnetURI}`; - - t += `

Name: ${torrent.name}

`; - t += `

Name: ${torrent.path}

`; - var hexdata = torrent.torrentFile.toString('hex'); - t += `

Torrent: ${hexdata}

`; - t += `

`; - - t += `
Files hash
`; - for (let h = 0; h < torrent._hashes.length; h++) { - const hash = torrent._hashes[h]; - t += `

${hash}

`; - } - - t += `
Peers
`; - for (let p = 0; p < torrent._peers.length; p++) { - const peer = torrent._peers[p]; - t += `

Peer: ${peer}

`; - } - - t += `
Trackers
`; - for (let r = 0; r < torrent.discovery._announce.length; r++) { - const tracker = torrent.discovery._announce[r]; - t += `

${tracker}

`; - } - - $("#seed-result").html(t); - - }) -}) diff --git a/routes.js b/routes.js index 7a2e9b7..4f2b323 100644 --- a/routes.js +++ b/routes.js @@ -3,7 +3,6 @@ const router = express.Router(); const { check, validationResult } = require('express-validator/check') const { matchedData } = require('express-validator/filter') const _ = require('lodash'); -//const fetch = require('node-fetch'); var path = require('path') var fs = require('fs'); diff --git a/views/download.ejs b/views/download.ejs index 2dc5b49..b046370 100644 --- a/views/download.ejs +++ b/views/download.ejs @@ -1,188 +1,89 @@ - - - -

Download files using the WebTorrent protocol (BitTorrent over WebRTC).

+<%include partials/header.ejs %> -
- - - -
+
+

Download files using the WebTorrent protocol (BitTorrent over WebRTC).

+ Sample torrents -

Log

-
- - - - - - - - -HTML example with status showing UI - -This complete HTML example mimics the UI of the webtorrent.io homepage. It downloads the sintel.torrent file, streams it in the browser and outputs some statistics to the user (peers, progress, remaining time, speed...). - -You can try it right now on CodePen to see what it looks like and play around with it! - -Feel free to replace torrentId with other torrent files, or magnet links, but keep in mind that the browser can only download torrents that are seeded by WebRTC peers (web peers). Use WebTorrent Desktop or Instant.io to seed torrents to the WebTorrent network. - - - - - - WebTorrent video player - - - -
-
-
- +
+
+
+ +
+ +
+
+ Seeding + + + + Downloading torent file + from + to + 0 peers.
- -
-
- Downloading - Seeding - - - sintel.torrent - - from - to - 0 peers. -
-
- - of - —
- ↘0 b/s - / ↗0 b/s -
+
+ + of + —
+ ↘0 b/s + / ↗0 b/s
- - +
- - +
- - - \ No newline at end of file + } +}); + + \ No newline at end of file diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index 48cdb62..17d5052 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -2,7 +2,8 @@ - + + diff --git a/views/seed.ejs b/views/seed.ejs index eb85ee2..26de4bb 100644 --- a/views/seed.ejs +++ b/views/seed.ejs @@ -1,7 +1,7 @@ <%include partials/header.ejs %>
-

hello

+

Drop a file to make it a torrent file:

@@ -11,7 +11,58 @@
<%include partials/footer.ejs %> + \ No newline at end of file