-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (48 loc) · 2.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
<title>codedump</title>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script>
function postcode() {
var client = new WebTorrent();
var file = new File([document.all('send').value], document.all('name').value);
client.seed(file, function(torrent){ document.all('deliver').innerHTML = 'Link to posted file:\nhttp://ronsoros.github.io/?' + torrent.infoHash });
}
function loaddoc(){
var query = window.location.search.slice(1);
if ( query != "" ) {
var tmpa = "magnet:?xt=urn:btih:$HASH&dn=inetd.c&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com";
query = tmpa.replace('$HASH', query);
document.all('send').value = "// Loading...";
var client = new WebTorrent();
client.add(query, function (torrent) {
// Torrents can contain many files. Let's use the first.
var file = torrent.files[0]
document.all('srcfile').innerHTML = file.name;
document.all('forkbtn').innerHTML = 'Fork this Code'
document.all('name').value = file.name;
// Display the file by adding it to the DOM. Supports video, audio, image, etc. files
var reader = new FileReader();
reader.addEventListener("loadend", function() {
// reader.result contains the contents of blob as a typed array
document.all('send').value = reader.result;
});
file.getBlob(function(err,blob) {
reader.readAsText(blob);
})
});
}
}
</script>
</head>
<body style='font-family: Arial; font-size: 14px;' onload="loaddoc()">
<h1>codedump</h1>share code instantly
<div id='deliver'></div>
<h2 id='srcfile'>New Source File</h2>
Name: <input type=text id='name'><br/>
<textarea style='width:100%;height:640px' id='send'></textarea>
<button onClick='postcode()' id='forkbtn'>Upload</button>
<script>
</script>
</body>
</html>