-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.ts
1119 lines (928 loc) · 53.2 KB
/
index.ts
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
let folderSelectionEnabled = false;
if (typeof WebAssembly === "undefined")
document.getElementById("no_wasm_warning")!.style.display = "";
if ((<any>document.getElementById("folderchooser")).webkitdirectory === undefined)
{
document.getElementById("no_folder_warning")!.style.display = "block";
(<HTMLButtonElement>document.getElementById("folderchooserbutton")).disabled = true;
}
else
folderSelectionEnabled = true;
const favicon = document.createElement("link");
favicon.rel = "shortcut icon";
favicon.type = "image/png";
favicon.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdY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AHRFn0h7m09N8cn+OG0Hq8RN9XInk6HoSOT21luJZBUsFq5ToBvwS2AcJMu6ur8Qa85DDhZeQXPROKoSrYKlglSrliGvE3kgJr23QqknrQh1yaPAfxI3jQzzk11LBUsFShF6IvWtnYATRZ0fNRyYC7yB+Uq8jbhteUcFSwVKapjfiJ7QDkuJlWwrj5NEWS5Ag57FI6uX3kTxYkaKCpYKltHwLORg5os99NkXSvBQ6M5BTyfGNPpPIwxTKKlgqWEo4uiCVcgYjJ2j9kXjH/kiOqoo86OMqI0pTaHCPmGJE6UvkVLEgUMFSwVLcUWFEqx+wHuKV38t8uiKnll0RZ8v2ZsuZy07QVCLDhYixe6XZsi1FnEwXIKdyCxC70mzEe3wmEkA8g2JJQ6yCtRr/PwA4rtiZbEn49AAAAABJRU5ErkJggg==";
document.getElementsByTagName("head")[0].appendChild(favicon);
window.addEventListener("load", function ()
{
const request = new XMLHttpRequest();
request.onload = function (ev)
{
if (ev.target === null)
return;
if (this.readyState !== 4 || (this.status !== 200 && this.status !== 0))
return;
const trackerList = this.responseText.trim().split(/\s+/);
const trackerButtonContainer = <HTMLDivElement>document.getElementById("tracker_button_container");
const trackersTextarea = <HTMLTextAreaElement>document.getElementById("torrent_trackers");
for (let i = 0; i < trackerList.length; ++i)
{
const currentTracker = trackerList[i];
const currentButton = document.createElement("button");
currentButton.className = "trackers-list-element";
currentButton.textContent = currentTracker;
currentButton.onclick = function ()
{
currentButton.classList.add("tracker-list-element-hidden");
trackersTextarea.value += currentTracker + "\n";
};
trackerButtonContainer.appendChild(currentButton);
}
const button = <HTMLButtonElement>document.getElementById("tracker_add_button");
button.style.visibility = "visible";
button.style.opacity = "1";
};
request.open("GET", "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt");
request.send();
});
function ResizeTextarea(element: HTMLElement)
{
element.style.height = "auto";
element.style.height = (element.scrollHeight - 10) + "px";
}
function FormatTextareLines(element: HTMLTextAreaElement, resizeTextArea: boolean = true)
{
element.value = element.value.split(/\s+/g)
.map(str => str.trim())
.filter(str => str.length !== 0)
.join("\n")
+ "\n";
if (resizeTextArea)
ResizeTextarea(element);
}
function GetSizeStr(size: number)
{
if (size < 1024)
return size + " bytes";
if (size < 1048576)
return ((size / 1024) | 0) + " kB";
if (size < 1073741824)
return ((size / 1048576) | 0) + " MB";
return (size / 1073741824).toFixed(2) + " GB";
}
let allFiles: File[] | null = [];
let singleFile: File | null = null;
let totalSize: number;
function FolderSelected(files: FileList)
{
const folderName = (<string>((<any>files[0]).webkitRelativePath)).split("/")[0];
(<HTMLInputElement>document.getElementById("torrent_name")).value = folderName;
allFiles = [];
totalSize = 0;
for (let i = 0; i < files.length; ++i)
{
allFiles.push(files[i]);
totalSize += files[i].size;
}
document.getElementById("selected_file_info")!.textContent = "Selected folder: " + folderName + " (" + GetSizeStr(totalSize) + ")";
singleFile = null;
(<HTMLButtonElement>document.getElementById("create_torrent_button")).disabled = false;
ResetCreateButton();
}
function FileSelected(files: FileList)
{
singleFile = files[0];
const fileName = singleFile.name;
totalSize = singleFile.size;
(<HTMLInputElement>document.getElementById("torrent_name")).value = fileName;
document.getElementById("selected_file_info")!.textContent = "Selected file: " + fileName + " (" + GetSizeStr(totalSize) + ")";
allFiles = null;
(<HTMLButtonElement>document.getElementById("create_torrent_button")).disabled = false;
ResetCreateButton();
}
let torrentChanged = false;
function TorrentParamsChanged(type: string)
{
switch (type)
{
case "blocksize":
ResetCreateButton();
return;
default:
break;
}
torrentChanged = true;
}
let trackersOverlayVisible = false;
function ShowTrackers(show: boolean)
{
if (show === trackersOverlayVisible)
return;
trackersOverlayVisible = show;
if (show)
{
const buttonContainer = document.getElementById("tracker_button_container")!.children;
for (let i = 0; i < buttonContainer.length; ++i)
{
if (buttonContainer[i].nodeType === 1)
buttonContainer[i].classList.remove("tracker-list-element-hidden");
}
}
const overlay = document.getElementById("trackers_list_overlay")!;
overlay.style.transition = show ? "visibility 0s, opacity 0.15s ease-out" : "visibility 0s 0.15s, opacity 0.15s ease-in";
overlay.style.visibility = show ? "visible" : "hidden";
overlay.style.opacity = show ? "1" : "0";
}
window.addEventListener("keydown", function (e)
{
if (e.code === "Escape")
ShowTrackers(false);
});
interface TorrentFileInfo
{
length: number;
path: string[];
}
interface TorrentInfo
{
name: string;
private?: number;
pieces: number[] | string;
"piece length": number;
files?: TorrentFileInfo[];
length?: number;
source?: string;
}
interface TorrentObject
{
info: TorrentInfo | null;
announce?: string;
"announce-list"?: string[][];
"url-list"?: string[];
"creation date"?: number;
"created by"?: string;
comment?: string;
}
let creationInProgress = false;
let creationFinished = false;
let blockSize = 262144;
let torrentObject: TorrentObject | null = null;
function SetTorrentData()
{
const errorTextDiv = document.getElementById("error_text")!;
const torrentName = (<HTMLInputElement>document.getElementById("torrent_name")).value.trim();
if (torrentName === "")
{
errorTextDiv.textContent = "Torrent name must not be empty";
errorTextDiv.style.display = "";
return false;
}
if (torrentName.match(/[<>:\"\\\/\|\?\*]/))
{
errorTextDiv.innerHTML = "Torrent name cannot contain any of the following characters: < > : \\ / | ? *";
errorTextDiv.style.display = "";
return false;
}
if (torrentName.length > 255)
{
errorTextDiv.innerHTML = "Torrent name cannot be longer than 255 characters";
errorTextDiv.style.display = "";
return false;
}
const trackers = (<HTMLTextAreaElement>document.getElementById("torrent_trackers")).value.split("\n");
const okTrackers: { [key: string]: boolean } = {};
for (let i = 0; i < trackers.length; ++i)
{
const current = trackers[i].trim();
if (current === "")
continue;
let validTracker = true;
try
{
const url = new URL(current);
validTracker = /\/announce\/?$/.test(url.pathname); // must end with "announce" or "announce/"
}
catch
{
validTracker = false;
}
if (validTracker)
okTrackers[current] = true;
else
{
errorTextDiv.innerHTML = "Invalid tracker: " + current;
errorTextDiv.style.display = "block";
return false;
}
}
const infoObject: TorrentInfo = (torrentObject && torrentObject["info"]) || { name: "", pieces: "", "piece length": 0 };
torrentObject = { "info": infoObject };
const okTrackersList = Object.keys(okTrackers);
if (okTrackersList.length !== 0)
{
torrentObject["announce"] = okTrackersList[0];
const announceList: string[][] = [];
for (let i = 0; i < okTrackersList.length; ++i)
announceList.push([okTrackersList[i]]);
torrentObject["announce-list"] = announceList;
}
const webSeeds = (<HTMLTextAreaElement>document.getElementById("torrent_webseeds")).value.split(/\s+/).filter(str => str.length !== 0);
if (webSeeds.length !== 0)
torrentObject["url-list"] = webSeeds;
const comment = (<HTMLTextAreaElement>document.getElementById("torrent_comment")).value;
if (comment !== "")
torrentObject["comment"] = comment;
if ((<HTMLInputElement>document.getElementById("torrent_creation_date")).checked)
torrentObject["creation date"] = (Date.now() / 1000) | 0;
torrentObject["created by"] = "kimbatt.github.io/torrent-creator";
if ((<HTMLInputElement>document.getElementById("torrent_is_private")).checked)
infoObject["private"] = 1;
infoObject["name"] = torrentName;
const blockSizeComboBox = <HTMLSelectElement>document.getElementById("torrent_block_size");
blockSize = Number(blockSizeComboBox.options[blockSizeComboBox.selectedIndex].value);
if (blockSize === 0 || isNaN(blockSize))
{
let factor = Math.round(Math.log(totalSize / 1200) / Math.log(2));
if (factor < 14)
factor = 14;
else if (factor > 24)
factor = 24;
blockSize = 1 << factor;
}
infoObject["piece length"] = blockSize;
const source = (<HTMLInputElement>document.getElementById("torrent_source")).value;
if (source !== "")
infoObject["source"] = source;
errorTextDiv.style.display = "none";
return true;
}
function CreateTorrent()
{
if (creationInProgress)
{
Cancel();
return;
}
if (!SetTorrentData() || !torrentObject)
return;
torrentChanged = false;
creationInProgress = true;
document.getElementById("progressbar_container")!.className = "progress-bar-visible";
document.getElementById("progressbar_processing_container")!.className = "progress-bar-visible";
document.getElementById("create_torrent_button")!.textContent = "Cancel";
DisableElements(true);
//if (wasmEnabled)
// sharedMemoryBuffer.set(new Uint8Array(16777216), 0);
if (singleFile)
CreateFromFile(torrentObject);
else if (allFiles)
CreateFromFolder(torrentObject);
}
function ResetCreateButton()
{
if (!creationFinished)
return;
creationFinished = false;
torrentChanged = false;
torrentObject = null;
const button = <HTMLButtonElement>document.getElementById("create_torrent_button");
button.onclick = CreateTorrent;
Cancel();
}
let blobUrl: string;
function Finished()
{
creationFinished = true;
if (!torrentObject || !torrentObject.info)
return;
const pieceBytes = <number[]>torrentObject.info["pieces"];
let pieceStr = "";
for (let i = 0; i < pieceBytes.length; ++i)
pieceStr += String.fromCharCode(pieceBytes[i]);
torrentObject.info["pieces"] = pieceStr;
let blob = new Blob();
function UpdateBlob()
{
if (torrentObject)
blob = new Blob([new Uint8Array(Bencode.EncodeToBytes(torrentObject))], { type: "application/octet-stream" });
}
UpdateBlob();
const button = <HTMLButtonElement>document.getElementById("create_torrent_button");
button.textContent = "Download torrent file";
const msSaveOrOpenBlob: ((blob: any, defaultName?: string, retVal?: boolean) => boolean) | undefined = (window.navigator as any).msSaveOrOpenBlob;
if (msSaveOrOpenBlob)
{
button.onclick = function ()
{
if (torrentChanged)
{
if (!SetTorrentData())
return;
UpdateBlob();
}
if (torrentObject && torrentObject.info)
msSaveOrOpenBlob(blob, torrentObject.info.name + ".torrent");
};
}
else
{
const a = <HTMLAnchorElement>document.getElementById("download_link");
a.download = torrentObject.info.name + ".torrent";
window.URL.revokeObjectURL(blobUrl);
blobUrl = window.URL.createObjectURL(blob);
a.href = blobUrl;
button.onclick = function ()
{
if (torrentChanged)
{
if (!SetTorrentData() || !torrentObject || !torrentObject.info)
return;
UpdateBlob();
a.download = torrentObject.info.name + ".torrent";
window.URL.revokeObjectURL(blobUrl);
blobUrl = window.URL.createObjectURL(blob);
a.href = blobUrl;
}
a.click();
};
}
document.getElementById("progressbar_text")!.textContent = "Done";
document.getElementById("progressbar")!.style.width = "100%";
document.getElementById("progressbar_processing_text")!.textContent = "Done";
document.getElementById("progressbar_processing")!.style.width = "100%";
creationInProgress = false;
DisableElements(false);
}
function Failed(fileName: string | null, err: DOMException | null)
{
const errorTextDiv = document.getElementById("error_text")!;
let errorText = fileName ? ("Failed to read file: " + fileName) : "Error reading file";
if (err)
errorText += "\nReason: " + err.message + " (" + err.name + ")";
errorTextDiv.textContent = errorText;
errorTextDiv.style.display = "block";
const progressBar = document.getElementById("progressbar")!;
progressBar.style.display = "none";
progressBar.style.width = "0%";
const progressBarProcessing = document.getElementById("progressbar_processing")!;
progressBarProcessing.style.display = "none";
progressBarProcessing.style.width = "0%";
Cancel();
}
function Cancel()
{
creationInProgress = false;
document.getElementById("create_torrent_button")!.textContent = "Create torrent";
document.getElementById("progressbar_container")!.className = "progress-bar-hidden";
document.getElementById("progressbar_processing_container")!.className = "progress-bar-hidden";
document.getElementById("progressbar_text")!.textContent = "";
document.getElementById("progressbar")!.style.width = "0%";
document.getElementById("progressbar_processing_container")!.className = "progress-bar-hidden";
document.getElementById("progressbar_processing_text")!.textContent = "";
document.getElementById("progressbar_processing")!.style.width = "0%";
DisableElements(false);
}
function DisableElements(disable: boolean)
{
function DisableInternal(elementName: string, isDisabled: boolean)
{
(<any>document.getElementById(elementName)).disabled = isDisabled;
}
DisableInternal("torrent_name", disable);
DisableInternal("torrent_block_size", disable);
DisableInternal("torrent_is_private", disable);
DisableInternal("torrent_creation_date", disable);
DisableInternal("torrent_trackers", disable);
DisableInternal("torrent_comment", disable);
DisableInternal("torrent_source", disable);
DisableInternal("filechooserbutton", disable);
DisableInternal("folderchooserbutton", !folderSelectionEnabled || disable);
DisableInternal("tracker_add_button", disable);
}
function CreateFromFile(obj: TorrentObject)
{
if (!singleFile || !obj.info)
return;
const progressBarStyle = document.getElementById("progressbar")!.style;
progressBarStyle.width = "0%";
const progressBarProcessingStyle = document.getElementById("progressbar_processing")!.style;
progressBarProcessingStyle.width = "0%";
const infoObject = obj.info;
const chunkSize = infoObject["piece length"];
const file = singleFile;
const fileSize = file.size;
const readChunkSize = 16777216;
const maxChunkCount = Math.ceil(fileSize / readChunkSize);
const blocksPerChunk = readChunkSize / blockSize;
const maxBlockCount = Math.ceil(fileSize / blockSize);
const pieces = new Uint8Array(20 * maxBlockCount);
infoObject["length"] = fileSize;
let bytesReadSoFar = 0;
let readStartIndex = 0;
let bytesProcessedSoFar = 0;
const progressBarText = document.getElementById("progressbar_text")!;
progressBarText.textContent = "Reading file: " + file.name;
const progressBarProcessingText = document.getElementById("progressbar_processing_text")!;
progressBarProcessingText.textContent = "Processing: 0%";
const fr = new FileReader();
let currentWorkerCount = 0;
function reader()
{
if (!creationInProgress)
return;
if (currentWorkerCount === maxWorkerCount)
{
waitingForWorkers = true
return;
}
fr.readAsArrayBuffer(file.slice(readStartIndex, readStartIndex + readChunkSize));
readStartIndex += readChunkSize;
}
let chunkIndex = 0;
let waitingForWorkers = false;
fr.onloadend = async function (ev)
{
if (!ev.target || !(ev.target.result instanceof ArrayBuffer))
return;
++currentWorkerCount;
const currentChunkIndex = chunkIndex++;
const bytes = new Uint8Array(ev.target.result);
const byteCount = bytes.length;
bytesReadSoFar += byteCount;
progressBarStyle.width = (bytesReadSoFar / fileSize * 100) + "%";
sha1({ data: bytes, blockSize: chunkSize, readChunkSize: readChunkSize }).then(result =>
{
pieces.set(result, currentChunkIndex * blocksPerChunk * 20);
--currentWorkerCount;
bytesProcessedSoFar += byteCount;
const percent = bytesProcessedSoFar / fileSize * 100;
progressBarProcessingStyle.width = percent + "%";
progressBarProcessingText.textContent = "Processing: " + percent.toFixed(2) + "%";
if (chunkIndex === maxChunkCount && currentWorkerCount === 0)
{
// everything finished
infoObject["pieces"] = Array.from(pieces);
Finished();
}
else if (waitingForWorkers)
{
waitingForWorkers = false;
reader();
}
});
if (chunkIndex !== maxChunkCount)
reader();
else
{
// finished reading
progressBarText.textContent = "File reading finished";
}
};
fr.onerror = function ()
{
Failed(singleFile && singleFile.name, fr.error);
};
reader();
}
function CreateFromFolder(obj: TorrentObject)
{
if (!allFiles || !obj.info)
return;
const progressBarStyle = document.getElementById("progressbar")!.style;
progressBarStyle.width = "0%";
const progressBarProcessingStyle = document.getElementById("progressbar_processing")!.style;
progressBarProcessingStyle.width = "0%";
const infoObject = obj.info;
const chunkSize = infoObject["piece length"];
let bytesReadSoFar = 0;
let bytesProcessedSoFar = 0;
const readChunkSize = 16777216;
let currentChunk = new Uint8Array(readChunkSize);
let currentChunkDataIndex = 0;
let chunkIndex = 0;
const blocksPerChunk = readChunkSize / blockSize;
let totalSize = 0;
const fileInfos: TorrentFileInfo[] = [];
for (let i = 0; i < allFiles.length; ++i)
{
const currentFileInfo = allFiles[i];
const currentFileSize = currentFileInfo.size;
totalSize += currentFileSize;
fileInfos.push({
"length": currentFileSize,
"path": (<string>(<any>currentFileInfo).webkitRelativePath).split("/").slice(1)
});
}
const totalBlockCount = Math.ceil(totalSize / chunkSize);
const pieces = new Uint8Array(totalBlockCount * 20);
let processedBlockCount = 0;
infoObject["files"] = fileInfos;
let fileIndex = 0;
const files = allFiles;
let currentFile = files[0];
const progressBarText = document.getElementById("progressbar_text")!;
const progressBarProcessingText = document.getElementById("progressbar_processing_text")!;
let readStartIndex = 0;
let fileSize = currentFile.size;
const fr = new FileReader();
let currentWorkerCount = 0;
function reader()
{
if (!creationInProgress)
return;
if (currentWorkerCount === maxWorkerCount)
{
waitingForWorkers = true
return;
}
fr.readAsArrayBuffer(currentFile.slice(readStartIndex, readStartIndex + readChunkSize));
readStartIndex += readChunkSize;
}
function MaybeFinished()
{
if (processedBlockCount >= totalBlockCount)
{
infoObject["pieces"] = Array.from(pieces);
Finished();
}
}
let waitingForWorkers = false;
fr.onloadend = async function (ev)
{
if (!ev.target || !(ev.target.result instanceof ArrayBuffer))
return;
const bytes = new Uint8Array(ev.target.result);
const byteCount = bytes.length;
bytesReadSoFar += byteCount;
progressBarStyle.width = (bytesReadSoFar / totalSize * 100) + "%";
if (currentChunkDataIndex + bytes.length >= readChunkSize)
{
// data doesn't fit in the current buffer, so fill the rest and create a new one
const byteIndex = readChunkSize - currentChunkDataIndex;
currentChunk.set(bytes.subarray(0, byteIndex), currentChunkDataIndex);
const localChunk = currentChunk;
currentChunk = new Uint8Array(readChunkSize);
const currentChunkIndex = chunkIndex++;
++currentWorkerCount;
sha1({ data: localChunk, blockSize: chunkSize, readChunkSize: readChunkSize }).then(result =>
{
processedBlockCount += blocksPerChunk;
pieces.set(result, currentChunkIndex * blocksPerChunk * 20);
--currentWorkerCount;
if (waitingForWorkers)
{
waitingForWorkers = false;
reader();
}
if (!creationFinished)
{
bytesProcessedSoFar += readChunkSize;
const percent = bytesProcessedSoFar / totalSize * 100;
progressBarProcessingStyle.width = percent + "%";
progressBarProcessingText.textContent = "Processing: " + percent.toFixed(2) + "%";
}
MaybeFinished();
});
// set the remaining data
currentChunk.set(bytes.subarray(byteIndex), 0);
currentChunkDataIndex = bytes.length - byteIndex;
}
else
{
// just add to the buffer
currentChunk.set(bytes, currentChunkDataIndex);
currentChunkDataIndex += bytes.length;
}
if (readStartIndex < fileSize)
{
// current file is not finished yet
reader();
}
else
{
// current file is finished, check if we have any more files left
++fileIndex;
if (fileIndex === files.length)
{
// all files are processed, calculate the hash of the current buffer data
if (currentChunkDataIndex !== 0)
{
sha1({ data: currentChunk, blockSize: chunkSize, readChunkSize: currentChunkDataIndex }).then(result =>
{
processedBlockCount += blocksPerChunk;
pieces.set(result, chunkIndex * blocksPerChunk * 20);
MaybeFinished();
});
}
else
MaybeFinished();
progressBarText.textContent = "All files read";
}
else
{
// some files are still left
currentFile = files[fileIndex];
fileSize = currentFile.size;
readStartIndex = 0;
progressBarText.textContent = "Reading file: " + currentFile.name;
reader();
}
}
};
fr.onerror = function ()
{
Failed(currentFile.name, fr.error);
};
progressBarText.innerHTML = "Reading file: " + currentFile.name;
progressBarProcessingText.textContent = "Processing: 0%";
reader();
}
// bencode
function toUTF8Array(str: string)
{
const utf8 = [];
for (let i = 0; i < str.length; ++i)
{
let charcode = str.charCodeAt(i);
if (charcode < 0x80)
utf8.push(charcode);
else if (charcode < 0x800)
utf8.push(0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f));
else if (charcode < 0xd800 || charcode >= 0xe000)
utf8.push(0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));
else
{
++i;
charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));
utf8.push(0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f));
}
}
return utf8;
}
function stringByteCount(str: string)
{
let count = 0;
for (let i = 0; i < str.length; ++i)
{
const charcode = str.charCodeAt(i);
if (charcode < 0x80)
++count;
else if (charcode < 0x800)
count += 2;
else if (charcode < 0xd800 || charcode >= 0xe000)
count += 3;
else
{
++i;
count += 4;
}
}
return count;
}
function toByteArray(str: string)
{
const ret = [];
for (let i = 0; i < str.length; ++i)
ret.push(str.charCodeAt(i));
return ret;
}
class BencodeObject
{
encode(_array: number[]) { }
getBencodeObject(obj: any)
{
if (obj === null || obj === undefined)
return null;
switch (typeof obj)
{
case "number":
return new BencodeInt(obj);
case "string":
return new BencodeString(obj);
case "object": {
if (Array.isArray(obj))
return new BencodeList(obj);
else
return new BencodeDict(obj);
}
}
return null;
}
}
class BencodeDict extends BencodeObject
{
private data: { [key: string]: BencodeObject };
constructor(obj: { [key: string]: any })
{
super();
this.data = {};
for (let key in obj)
{
const bencodeObj = this.getBencodeObject(obj[key]);
if (bencodeObj)
this.data[key] = bencodeObj;
}
}
encodeBinaryString(array: number[], str: string)
{
const bytesCount = str.length;
array.push.apply(array, toByteArray(bytesCount.toString()));
array.push(":".charCodeAt(0));
const strBytes = toByteArray(str);
for (let i = 0; i < strBytes.length; ++i)
array.push(strBytes[i]);
}
encode(array: number[])
{
array.push("d".charCodeAt(0));
const sortedKeys = Object.keys(this.data).sort();
for (let i = 0; i < sortedKeys.length; ++i)
{
const currentKey = sortedKeys[i];
const currentObject = this.data[currentKey];
const bencodedKeyObject = this.getBencodeObject(currentKey);
if (bencodedKeyObject)
{
bencodedKeyObject.encode(array);
if (currentKey === "pieces" && currentObject instanceof BencodeString)
this.encodeBinaryString(array, currentObject.value);
else
currentObject.encode(array);
}
}
array.push("e".charCodeAt(0));
}
}
class BencodeList extends BencodeObject
{
private data: BencodeObject[];
constructor(list: any[])
{
super();
this.data = [];
for (let i = 0; i < list.length; ++i)
{
const bencodeObj = this.getBencodeObject(list[i]);
if (bencodeObj)
this.data.push(bencodeObj);
}
}
encode(array: number[])
{
array.push("l".charCodeAt(0));
for (let i = 0; i < this.data.length; ++i)
this.data[i].encode(array);
array.push("e".charCodeAt(0));
}
}
class BencodeString extends BencodeObject
{
public readonly value: string;
constructor(value: string)
{
super();
this.value = value;
}
encode(array: number[])
{
const bytesCount = stringByteCount(this.value);
array.push.apply(array, toByteArray(bytesCount.toString()));
array.push(":".charCodeAt(0));
array.push.apply(array, toUTF8Array(this.value));
}
}
class BencodeInt extends BencodeObject
{
public readonly value: number
constructor(value: number)
{
super();
this.value = value;
}
encode(array: number[])
{
array.push("i".charCodeAt(0));
array.push.apply(array, toUTF8Array(this.value.toString()));
array.push("e".charCodeAt(0));
}
}
const Bencode =
{
EncodeToBytes: function (obj: TorrentObject)
{
const result: number[] = [];
new BencodeDict(obj).encode(result);
return result;
}
};
let sha1: (data: Sha1Data) => Promise<Uint8Array>;
interface Sha1Data
{
data: Uint8Array;
blockSize: number;
readChunkSize: number;
}
// workers
const maxWorkerCount = Math.min(navigator.hardwareConcurrency || 1, 8); // use 8 workers at max, reading from disk will be the slowest anyways