summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--misc/links.txt3
-rw-r--r--www/.gitignore1
-rw-r--r--www/composer.json13
-rwxr-xr-xwww/insert.php18
-rw-r--r--www/no-piece-layers-check.patch25
5 files changed, 43 insertions, 17 deletions
diff --git a/misc/links.txt b/misc/links.txt
index ce4647b..d983e3a 100644
--- a/misc/links.txt
+++ b/misc/links.txt
@@ -1,5 +1,6 @@
https://www.europol-europa.eu/police2peer <= torrent nr. 44a058d498dd1880d82570b7e5b7ea729472f529
+https://github.com/arvidn/libtorrent/issues/6033#issuecomment-1426899570
dht crawlerji po internetu:
-http://btdig.com (captcha)
+http://btdig.com (captcha, ki ni cloudflare, ampak njihova -- sploh ni CF na btdig.com)
http://146.19.24.47:8000/ = https://yhgyhg{28..30}.buzz/ (CF)
diff --git a/www/.gitignore b/www/.gitignore
index 8796548..8a90f93 100644
--- a/www/.gitignore
+++ b/www/.gitignore
@@ -1,3 +1,4 @@
package-lock.json
+composer.lock
default
vendor/
diff --git a/www/composer.json b/www/composer.json
index ed23328..1ef2be0 100644
--- a/www/composer.json
+++ b/www/composer.json
@@ -3,12 +3,21 @@
"description": "web frontend for exploring metainfo files downloaded by travnik",
"type": "project",
"require": {
- "rhilip/bencode": "^2.3"
+ "rhilip/bencode": "^2.3",
+ "cweagans/composer-patches": "^1.7"
},
"authors": [
{
"name": "Anton Luka Šijanec",
"email": "anton@sijanec.eu"
}
- ]
+ ],
+ "extra": {
+ "composer-exit-on-patch-failure": true,
+ "patches": {
+ "rhilip/bencode": {
+ "don't check for piece layers validity on parse (called by getFileList/Tree) because we have no piece layers. they aren't present in the info dict.": "no-piece-layers-check.patch"
+ }
+ }
+ }
}
diff --git a/www/insert.php b/www/insert.php
index 4fa8e59..28c9c28 100755
--- a/www/insert.php
+++ b/www/insert.php
@@ -89,14 +89,8 @@ try {
if (isset($t->getRootData()["source"]["v"]))
$odjemalec = $t->getRootData()["source"]["v"];
$s->execute();
- function p ($k, $v, $p) {
- global $c, $zgoščena_vrednost;
- // if (preg_match("/padding.file/i", $k))
- // return;
- if (is_array($v)) {
- foreach ($v as $ke => $va)
- p($ke, $va, $p . $k . "/");
- } else {
+ try {
+ foreach ($t->getFileList() as $datoteka) {
$s = $c->prepare("INSERT INTO datoteke (
torrent,
pot,
@@ -109,16 +103,12 @@ try {
$s->bindParam(":torrent", $zgoščena_vrednost);
$s->bindParam(":pot", $pot);
$s->bindParam(":velikost", $velikost);
- $pot = $p . $k;
+ $pot = $datoteka["path"];
+ $velikost = $datoteka["size"];
if (strlen($pot) > 4096)
echo "$argv[4] pot $pot daljša od 4096";
- $velikost = $v;
$s->execute();
}
- }
- try {
- foreach ($t->getFileTree() as $k => $v)
- p($k, $v, "");
} catch (ParseException $e) {
echo "neveljaven metainfo $argv[4]: " . $e->getMessage() . PHP_EOL;
exit(5);
diff --git a/www/no-piece-layers-check.patch b/www/no-piece-layers-check.patch
new file mode 100644
index 0000000..66d7a92
--- /dev/null
+++ b/www/no-piece-layers-check.patch
@@ -0,0 +1,25 @@
+diff --git a/src/TorrentFile.php b/src/TorrentFile.php
+index 20a7f5e..eddc329 100644
+--- a/src/TorrentFile.php
++++ b/src/TorrentFile.php
+@@ -621,7 +621,7 @@ class TorrentFile
+ } else {
+ $pieceLength = $this->getPieceLength();
+ $fileTree = self::checkTorrentDict($info, 'file tree', 'array');
+- $pieceLayers = self::checkTorrentDict($this->data, 'piece layers', 'array');
++ $pieceLayers = [];
+
+ $loopMerkleTree = function (&$merkleTree, &$paths = []) use (&$files, &$size, $pieceLayers, $addFile, $pieceLength, &$loopMerkleTree) {
+ if (isset($merkleTree[''])) { // reach file
+@@ -633,11 +633,6 @@ class TorrentFile
+ }
+
+ $length = self::checkTorrentDict($file, 'length', 'integer');
+- if ($length > $pieceLength) { // check pieces root of large file is exist in $root['picec layers'] or not
+- if (!array_key_exists($piecesRoot, $pieceLayers)) {
+- throw new ParseException('Pieces not exist in piece layers.');
+- }
+- }
+
+ $addFile($paths, $length);
+ $merkleTree = $length; // rewrite merkleTree to size, it's safe since it not affect $data['info']['file tree']