From 31649fc59b5774663888837f2c0d24d627dcc8f0 Mon Sep 17 00:00:00 2001 From: Leo Herzog Date: Sun, 21 Jun 2020 15:50:06 -0400 Subject: [PATCH] Progress Adding More Fields --- bundle.js | 17 +++++++++++++++-- index.html | 19 ++++++++++++++++++- package.json | 2 +- parse.js | 17 +++++++++++++++-- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/bundle.js b/bundle.js index faf09af..fef8ce9 100644 --- a/bundle.js +++ b/bundle.js @@ -2379,6 +2379,10 @@ const Buffer = require('Buffer'); const size = require('filesize'); var name = document.getElementById('name'); +var creationDate = document.getElementById('creationDate'); +var createdBy = document.getElementById('createdBy'); +var comment = document.getElementById('comment'); +var hash = document.getElementById('hash'); var parsed; document.addEventListener('DOMContentLoaded', start); @@ -2400,7 +2404,6 @@ function start() { } function parse(toLoad) { - console.info(toLoad); if (typeof toLoad === "string" && toLoad.toLowerCase().trim().startsWith("http")) { parser.remote(toLoad, handleRemote); } else { @@ -2416,7 +2419,17 @@ function handleRemote(err, result) { function display() { console.log(parsed); - name.value = parsed.name; + name.value = parsed.name || ""; + if (parsed.created) { + creationDate.disabled = false; + creationDate.value = parsed.created.toISOString().slice(0, 19); + } else { + creationDate.disabled = true; + creationDate.value = ""; + } + createdBy.value = parsed.createdBy || ""; + comment.value = parsed.comment || ""; + hash.value = parsed.infoHash; } },{"Buffer":1,"filesize":6,"parse-torrent":9}],21:[function(require,module,exports){ 'use strict' diff --git a/index.html b/index.html index f082608..9ff6b4b 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,24 @@
- + +
+ +
+ + + + +
+ +
+ + +
+ +
+ +
diff --git a/package.json b/package.json index eb0b331..35a51f1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "torrentparts", "version": "0.0.1", - "description": "🗃️ A website to inspect and edit Torrent files and Magnet URLs", + "description": "📑 A website to inspect and edit Torrent files and Magnet URLs", "main": "bundle.js", "dependencies": { "browserify": "latest", diff --git a/parse.js b/parse.js index 4529439..8815d57 100644 --- a/parse.js +++ b/parse.js @@ -3,6 +3,10 @@ const Buffer = require('Buffer'); const size = require('filesize'); var name = document.getElementById('name'); +var creationDate = document.getElementById('creationDate'); +var createdBy = document.getElementById('createdBy'); +var comment = document.getElementById('comment'); +var hash = document.getElementById('hash'); var parsed; document.addEventListener('DOMContentLoaded', start); @@ -24,7 +28,6 @@ function start() { } function parse(toLoad) { - console.info(toLoad); if (typeof toLoad === "string" && toLoad.toLowerCase().trim().startsWith("http")) { parser.remote(toLoad, handleRemote); } else { @@ -40,5 +43,15 @@ function handleRemote(err, result) { function display() { console.log(parsed); - name.value = parsed.name; + name.value = parsed.name || ""; + if (parsed.created) { + creationDate.disabled = false; + creationDate.value = parsed.created.toISOString().slice(0, 19); + } else { + creationDate.disabled = true; + creationDate.value = ""; + } + createdBy.value = parsed.createdBy || ""; + comment.value = parsed.comment || ""; + hash.value = parsed.infoHash; } \ No newline at end of file