mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-01-24 04:08:04 -08:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b14ef98a23 | ||
|
|
85ffd7a9a0 | ||
|
|
73e99937b9 | ||
|
|
be414070b2 | ||
|
|
ffb1e250e4 | ||
|
|
6863553b66 | ||
|
|
f79c280de2 | ||
|
|
c654968116 | ||
|
|
a6a60a0722 | ||
|
|
753afdf70f | ||
|
|
6406bae502 | ||
|
|
26bb58ff05 | ||
|
|
233140a64e | ||
|
|
9ea7ac5a38 | ||
|
|
58f559ff78 | ||
|
|
9e53b06dd0 | ||
|
|
1687f59a71 | ||
|
|
69d9f807ed | ||
|
|
3d8efd6245 | ||
|
|
096919ec30 |
12
README.md
12
README.md
@@ -2,19 +2,21 @@
|
|||||||
|
|
||||||
## What is this?
|
## What is this?
|
||||||
|
|
||||||
[BitTorrent](https://bittorrent.com/) is a ubiquitus and powerful way to transfer files peer-to-peer. To specify what file(s) to download with your client, you need to input either a Torrent file or Magnet link. [Torrent Parts](https://torrent.parts/) is a client-side static web app to read and edit the metadata of a Torrent file or Magnet link so you know what you're downloading, before you add it to your Torrent client.
|
[BitTorrent](https://bittorrent.com/) is a ubiquitus and powerful way to transfer files peer-to-peer. To specify what file(s) to download with your client, you need to input either a Torrent file or Magnet URL. [Torrent Parts](https://torrent.parts/) is a client-side static web app to read and edit the metadata of a Torrent file or Magnet URL so you know what you're downloading, before you add it to your Torrent client.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- 📑 Display metadata of a Torrent file, Magnet link, or URL to a Torrent file ([CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) required)
|
- 📑 Display metadata of a Torrent file, Magnet URL, or URL to a Torrent file ([CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) required)
|
||||||
- 📝 Edit title, comment, Tracker URLs, and Webseeds
|
- 📝 Edit title, comment, Tracker URLs, and Webseeds
|
||||||
- ↔️ Save and convert between Torrent file and Magnet link
|
- ↔️ Save and convert between Torrent file and Magnet URL
|
||||||
- 🔗 Generate link directly to [Torrent Parts](https://torrent.parts/) with prefilled info
|
- 🔗 Generate a link directly to [Torrent Parts](https://torrent.parts/) with prefilled info<sup>[1]</sup>
|
||||||
- 🌐 Add currently known working trackers from [newTrackon](https://newtrackon.com/)
|
- 🌐 Add currently known working trackers from [newTrackon](https://newtrackon.com/)
|
||||||
- 👥 Fetch files metadata for a Magnet link via [WebTorrent](https://webtorrent.io/)
|
- 👥 Fetch files metadata for a Magnet URL via [WebTorrent](https://webtorrent.io/)
|
||||||
- ℹ️ Learn the basic parts of Torrent metadata and what they mean
|
- ℹ️ Learn the basic parts of Torrent metadata and what they mean
|
||||||
- 🔒 Fully client-side, no files leave your computer
|
- 🔒 Fully client-side, no files leave your computer
|
||||||
|
|
||||||
|
<sup>1. Just include the Magnet URL after `https://torrent.parts/#`, [like so](https://torrent.parts#magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https://torrent.ubuntu.com/announce&tr=https://ipv6.torrent.ubuntu.com/announce).</sup>
|
||||||
|
|
||||||
## Special Thanks
|
## Special Thanks
|
||||||
|
|
||||||
This project wouldn't be possible without the fantastic work of:
|
This project wouldn't be possible without the fantastic work of:
|
||||||
|
|||||||
@@ -37957,6 +37957,7 @@ document.addEventListener('DOMContentLoaded', start);
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
|
|
||||||
|
// magnet input
|
||||||
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
@@ -37967,6 +37968,7 @@ function start() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// torrent select button
|
||||||
document.getElementById('torrent').addEventListener('change', function(event) {
|
document.getElementById('torrent').addEventListener('change', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
||||||
@@ -37977,6 +37979,22 @@ function start() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// body drag-and-drop torrent file support
|
||||||
|
document.addEventListener('dragover', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('drop', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
||||||
|
source = "torrent-file";
|
||||||
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
|
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
||||||
|
parse(Buffer.from(arrayBuffer));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// example buttons
|
||||||
example1.addEventListener('click', function(event) {
|
example1.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
||||||
@@ -37992,11 +38010,12 @@ function start() {
|
|||||||
example3.addEventListener('click', async function(event) {
|
example3.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
||||||
let response = await fetch("jj2008-06-14.mk4_archive.torrent");
|
let response = await fetch("/ext/jj2008-06-14.mk4_archive.torrent");
|
||||||
let arrayBuffer = await response.arrayBuffer();
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// share buttons
|
||||||
let copyurl = new clipboard('#copyURL');
|
let copyurl = new clipboard('#copyURL');
|
||||||
copyurl.on('success', function(e) {
|
copyurl.on('success', function(e) {
|
||||||
notyf.success('Copied site URL to clipboard!');
|
notyf.success('Copied site URL to clipboard!');
|
||||||
@@ -38024,6 +38043,7 @@ function start() {
|
|||||||
console.warn(e);
|
console.warn(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// details field listeners
|
||||||
name.addEventListener('input', propertyChange);
|
name.addEventListener('input', propertyChange);
|
||||||
name.addEventListener('change', propertyChange);
|
name.addEventListener('change', propertyChange);
|
||||||
name.addEventListener('reset', propertyChange);
|
name.addEventListener('reset', propertyChange);
|
||||||
@@ -38161,9 +38181,17 @@ function display() {
|
|||||||
files.innerHTML = "";
|
files.innerHTML = "";
|
||||||
if (parsed.files && parsed.files.length) {
|
if (parsed.files && parsed.files.length) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = "none";
|
||||||
for (let file of parsed.files) {
|
if (parsed.files.length < 100) {
|
||||||
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
for (let file of parsed.files) {
|
||||||
files.appendChild(createFileRow(icon, file.name, file.length));
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
||||||
|
files.appendChild(createFileRow(icon, file.name, file.length));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(parsed.files[i].name));
|
||||||
|
files.appendChild(createFileRow(icon, parsed.files[i].name, parsed.files[i].length));
|
||||||
|
}
|
||||||
|
files.appendChild(createFileRow('', '...and another ' + (parsed.files.length - 100) + ' more files', ''));
|
||||||
}
|
}
|
||||||
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
||||||
downloadTorrentTooltip.setContent('Download Torrent file');
|
downloadTorrentTooltip.setContent('Download Torrent file');
|
||||||
@@ -38211,7 +38239,7 @@ function display() {
|
|||||||
function createFileRow(icon, name, size) {
|
function createFileRow(icon, name, size) {
|
||||||
let row = document.createElement('tr');
|
let row = document.createElement('tr');
|
||||||
let iconcell = document.createElement('td');
|
let iconcell = document.createElement('td');
|
||||||
iconcell.innerHTML = '<span class="far fa-' + icon + '"></span>';
|
if (icon) iconcell.innerHTML = '<span class="far fa-' + icon + '"></span>';
|
||||||
row.appendChild(iconcell);
|
row.appendChild(iconcell);
|
||||||
let namecell = document.createElement('td');
|
let namecell = document.createElement('td');
|
||||||
namecell.innerHTML = name;
|
namecell.innerHTML = name;
|
||||||
2
bundle.min.js → bin/bundle.min.js
vendored
2
bundle.min.js → bin/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
52
ext/TorrentPartsFASubset.yaml
Normal file
52
ext/TorrentPartsFASubset.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
projectName: 'C:\Users\herzog\Desktop\TorrentPartsFASubset'
|
||||||
|
version: 5.15.1
|
||||||
|
icons:
|
||||||
|
- magnet:
|
||||||
|
- light
|
||||||
|
- solid
|
||||||
|
- duotone
|
||||||
|
- file-alt:
|
||||||
|
- light
|
||||||
|
- regular
|
||||||
|
- duotone
|
||||||
|
- cloud-upload:
|
||||||
|
- solid
|
||||||
|
- link:
|
||||||
|
- light
|
||||||
|
- duotone
|
||||||
|
- share-alt:
|
||||||
|
- solid
|
||||||
|
- file-download:
|
||||||
|
- solid
|
||||||
|
- file:
|
||||||
|
- regular
|
||||||
|
- file-word:
|
||||||
|
- regular
|
||||||
|
- file-powerpoint:
|
||||||
|
- regular
|
||||||
|
- file-excel:
|
||||||
|
- regular
|
||||||
|
- file-archive:
|
||||||
|
- regular
|
||||||
|
- file-csv:
|
||||||
|
- regular
|
||||||
|
- file-pdf:
|
||||||
|
- regular
|
||||||
|
- file-contract:
|
||||||
|
- regular
|
||||||
|
- file-audio:
|
||||||
|
- regular
|
||||||
|
- file-video:
|
||||||
|
- regular
|
||||||
|
- file-image:
|
||||||
|
- regular
|
||||||
|
- folder-tree:
|
||||||
|
- regular
|
||||||
|
- trash:
|
||||||
|
- regular
|
||||||
|
- times:
|
||||||
|
- regular
|
||||||
|
- info-circle:
|
||||||
|
- regular
|
||||||
|
- plus-circle:
|
||||||
|
- regular
|
||||||
BIN
ext/alata-latin-400.woff
Normal file
BIN
ext/alata-latin-400.woff
Normal file
Binary file not shown.
BIN
ext/alata-latin-400.woff2
Normal file
BIN
ext/alata-latin-400.woff2
Normal file
Binary file not shown.
5
ext/fa.min.js
vendored
Normal file
5
ext/fa.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
0
notyf.min.js → ext/notyf.min.js
vendored
0
notyf.min.js → ext/notyf.min.js
vendored
BIN
img/TorrentParts-Icon-3x.png
Normal file
BIN
img/TorrentParts-Icon-3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
26
index.html
26
index.html
@@ -14,8 +14,10 @@
|
|||||||
<link href="/favicon.ico" rel="icon" />
|
<link href="/favicon.ico" rel="icon" />
|
||||||
<link href="/img/TorrentParts-Icon-1x.png" rel="icon" type="image/png" sizes="128x128" />
|
<link href="/img/TorrentParts-Icon-1x.png" rel="icon" type="image/png" sizes="128x128" />
|
||||||
<link href="/img/TorrentParts-Icon-2x.png" rel="icon" type="image/png" sizes="256x256" />
|
<link href="/img/TorrentParts-Icon-2x.png" rel="icon" type="image/png" sizes="256x256" />
|
||||||
|
<link href="/img/TorrentParts-Icon-3x.png" rel="icon" type="image/png" sizes="512x512" />
|
||||||
<link href="/img/TorrentParts-Icon-1x.png" rel="apple-touch-icon" type="image/png" sizes="128x128" />
|
<link href="/img/TorrentParts-Icon-1x.png" rel="apple-touch-icon" type="image/png" sizes="128x128" />
|
||||||
<link href="/img/TorrentParts-Icon-2x.png" rel="apple-touch-icon" type="image/png" sizes="256x256" />
|
<link href="/img/TorrentParts-Icon-2x.png" rel="apple-touch-icon" type="image/png" sizes="256x256" />
|
||||||
|
<link href="/img/TorrentParts-Icon-3x.png" rel="apple-touch-icon" type="image/png" sizes="512x512" />
|
||||||
<meta name="msapplication-TileColor" content="#102030" />
|
<meta name="msapplication-TileColor" content="#102030" />
|
||||||
<meta name="msapplication-TileImage" content="/img/TorrentParts-Icon-2x.png" />
|
<meta name="msapplication-TileImage" content="/img/TorrentParts-Icon-2x.png" />
|
||||||
<meta property="og:image" content="/img/TorrentParts-Social.png" />
|
<meta property="og:image" content="/img/TorrentParts-Social.png" />
|
||||||
@@ -34,12 +36,12 @@
|
|||||||
|
|
||||||
<title>Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link</title>
|
<title>Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link</title>
|
||||||
|
|
||||||
<link href="style.css" rel="stylesheet" />
|
<link href="/src/style.css" rel="stylesheet" />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Alata&display=swap" rel="stylesheet" />
|
<link href="/ext/alata-latin-400.woff2" rel="preload" as="style">
|
||||||
<link href="notyf.min.css" rel="stylesheet" />
|
<link href="/ext/alata-latin-400.woff" rel="preload" as="style">
|
||||||
<script async src="https://kit.fontawesome.com/9ca49f101f.js"></script>
|
<script async src="/ext/fa.min.js"></script>
|
||||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||||
<script src="notyf.min.js"></script>
|
<script src="/ext/notyf.min.js"></script>
|
||||||
|
|
||||||
<script async defer src="https://www.googletagmanager.com/gtag/js?id=G-VT4953Z89H"></script>
|
<script async defer src="https://www.googletagmanager.com/gtag/js?id=G-VT4953Z89H"></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -49,6 +51,8 @@
|
|||||||
gtag('config', 'G-VT4953Z89H');
|
gtag('config', 'G-VT4953Z89H');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script async defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "6f97f49b4c384ee197a2f319cebec274"}'></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -65,7 +69,7 @@
|
|||||||
Enter URL and press enter
|
Enter URL and press enter
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input id="torrent" type="file" aria-label="Select Torrent file" />
|
<input id="torrent" type="file" accept=".torrent" aria-label="Select Torrent file" />
|
||||||
<label for="torrent">
|
<label for="torrent">
|
||||||
<span class="fas fa-cloud-upload" aria-hidden="true"></span> Select Torrent File
|
<span class="fas fa-cloud-upload" aria-hidden="true"></span> Select Torrent File
|
||||||
</label>
|
</label>
|
||||||
@@ -203,10 +207,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://github.com/leoherzog/TorrentParts/releases" target="_blank">v1.0</a>
|
<a href="https://github.com/leoherzog/TorrentParts/releases" target="_blank" rel="noopener">v1.1.1</a>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="bundle.min.js"></script>
|
<script src="/bin/bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
window.addEventListener('load', () => navigator.serviceWorker.register('/src/sw.js'));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
{
|
{
|
||||||
"src": "/img/TorrentParts-Icon-2x.png",
|
"src": "/img/TorrentParts-Icon-2x.png",
|
||||||
"sizes": "256x256",
|
"sizes": "256x256",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/img/TorrentParts-Icon-3x.png",
|
||||||
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any maskable"
|
"purpose": "any maskable"
|
||||||
}
|
}
|
||||||
|
|||||||
2
notyf.min.css
vendored
2
notyf.min.css
vendored
File diff suppressed because one or more lines are too long
34
package.json
34
package.json
@@ -1,28 +1,28 @@
|
|||||||
{
|
{
|
||||||
"name": "torrentparts",
|
"name": "torrentparts",
|
||||||
"version": "0.0.1",
|
"version": "1.1.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",
|
"main": "bin/bundle.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browserify": "latest",
|
"browserify": "^17.0.0",
|
||||||
"Buffer": "latest",
|
"bytes": "^3.1.0",
|
||||||
"bytes": "latest",
|
"clipboard": "^2.0.6",
|
||||||
"clipboard": "latest",
|
"mime-types": "^2.1.27",
|
||||||
"dropzone": "latest",
|
"parse-torrent": "^9.0.0",
|
||||||
"mime-types": "latest",
|
"tippy.js": "^6.2.7",
|
||||||
"parse-torrent": "latest",
|
"webtorrent": "^0.110.1"
|
||||||
"tippy.js": "latest",
|
|
||||||
"webtorrent": "latest"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"notyf": "latest",
|
"buffer": "^5.2.1",
|
||||||
"terser": "latest",
|
"Buffer": "^0.0.0",
|
||||||
"watchify": "latest"
|
"notyf": "^3.9.0",
|
||||||
|
"terser": "^5.3.8",
|
||||||
|
"watchify": "^3.11.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "watchify parse.js -o bundle.js",
|
"watch": "watchify src/parse.js -o bin/bundle.js",
|
||||||
"compile": "browserify parse.js -o bundle.js",
|
"compile": "browserify src/parse.js -o bin/bundle.js",
|
||||||
"minify": "terser bundle.js -c -m -o bundle.min.js",
|
"minify": "terser bin/bundle.js -c -m -o bin/bundle.min.js",
|
||||||
"build": "npm run compile && npm run minify"
|
"build": "npm run compile && npm run minify"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ document.addEventListener('DOMContentLoaded', start);
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
|
|
||||||
|
// magnet input
|
||||||
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
@@ -89,6 +90,7 @@ function start() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// torrent select button
|
||||||
document.getElementById('torrent').addEventListener('change', function(event) {
|
document.getElementById('torrent').addEventListener('change', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
||||||
@@ -99,6 +101,22 @@ function start() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// body drag-and-drop torrent file support
|
||||||
|
document.addEventListener('dragover', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('drop', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
||||||
|
source = "torrent-file";
|
||||||
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
|
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
||||||
|
parse(Buffer.from(arrayBuffer));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// example buttons
|
||||||
example1.addEventListener('click', function(event) {
|
example1.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
||||||
@@ -114,11 +132,12 @@ function start() {
|
|||||||
example3.addEventListener('click', async function(event) {
|
example3.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
||||||
let response = await fetch("jj2008-06-14.mk4_archive.torrent");
|
let response = await fetch("/ext/jj2008-06-14.mk4_archive.torrent");
|
||||||
let arrayBuffer = await response.arrayBuffer();
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// share buttons
|
||||||
let copyurl = new clipboard('#copyURL');
|
let copyurl = new clipboard('#copyURL');
|
||||||
copyurl.on('success', function(e) {
|
copyurl.on('success', function(e) {
|
||||||
notyf.success('Copied site URL to clipboard!');
|
notyf.success('Copied site URL to clipboard!');
|
||||||
@@ -146,6 +165,7 @@ function start() {
|
|||||||
console.warn(e);
|
console.warn(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// details field listeners
|
||||||
name.addEventListener('input', propertyChange);
|
name.addEventListener('input', propertyChange);
|
||||||
name.addEventListener('change', propertyChange);
|
name.addEventListener('change', propertyChange);
|
||||||
name.addEventListener('reset', propertyChange);
|
name.addEventListener('reset', propertyChange);
|
||||||
@@ -283,9 +303,17 @@ function display() {
|
|||||||
files.innerHTML = "";
|
files.innerHTML = "";
|
||||||
if (parsed.files && parsed.files.length) {
|
if (parsed.files && parsed.files.length) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = "none";
|
||||||
for (let file of parsed.files) {
|
if (parsed.files.length < 100) {
|
||||||
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
for (let file of parsed.files) {
|
||||||
files.appendChild(createFileRow(icon, file.name, file.length));
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
||||||
|
files.appendChild(createFileRow(icon, file.name, file.length));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(parsed.files[i].name));
|
||||||
|
files.appendChild(createFileRow(icon, parsed.files[i].name, parsed.files[i].length));
|
||||||
|
}
|
||||||
|
files.appendChild(createFileRow('', '...and another ' + (parsed.files.length - 100) + ' more files', ''));
|
||||||
}
|
}
|
||||||
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
||||||
downloadTorrentTooltip.setContent('Download Torrent file');
|
downloadTorrentTooltip.setContent('Download Torrent file');
|
||||||
@@ -333,7 +361,7 @@ function display() {
|
|||||||
function createFileRow(icon, name, size) {
|
function createFileRow(icon, name, size) {
|
||||||
let row = document.createElement('tr');
|
let row = document.createElement('tr');
|
||||||
let iconcell = document.createElement('td');
|
let iconcell = document.createElement('td');
|
||||||
iconcell.innerHTML = '<span class="far fa-' + icon + '"></span>';
|
if (icon) iconcell.innerHTML = '<span class="far fa-' + icon + '"></span>';
|
||||||
row.appendChild(iconcell);
|
row.appendChild(iconcell);
|
||||||
let namecell = document.createElement('td');
|
let namecell = document.createElement('td');
|
||||||
namecell.innerHTML = name;
|
namecell.innerHTML = name;
|
||||||
File diff suppressed because one or more lines are too long
33
src/sw.js
Normal file
33
src/sw.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const assets = [
|
||||||
|
'/',
|
||||||
|
'/index.html',
|
||||||
|
'/bin/bundle.min.js',
|
||||||
|
'/src/style.css',
|
||||||
|
'/ext/alata-latin-400.woff2',
|
||||||
|
'/ext/alata-latin-400.woff',
|
||||||
|
'/ext/fa.min.js',
|
||||||
|
'/ext/notyf.min.js',
|
||||||
|
'/ext/jj2008-06-14.mk4_archive.torrent'
|
||||||
|
];
|
||||||
|
|
||||||
|
self.addEventListener('install', function(event) {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.open('assets')
|
||||||
|
.then(function(cache) {
|
||||||
|
return cache.addAll(assets);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', function(event) {
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request)
|
||||||
|
.then(function(response) {
|
||||||
|
if (response) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return fetch(event.request);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user