From 458ca31cc617831dbe05d129fffa5e023c06d3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 10 Jan 2023 11:53:56 +0100 Subject: metadl works, but wastes bandwidth --- www/.gitignore | 3 +++ www/composer.json | 14 ++++++++++ www/index.php | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 www/.gitignore create mode 100644 www/composer.json create mode 100644 www/index.php (limited to 'www') diff --git a/www/.gitignore b/www/.gitignore new file mode 100644 index 0000000..8796548 --- /dev/null +++ b/www/.gitignore @@ -0,0 +1,3 @@ +package-lock.json +default +vendor/ diff --git a/www/composer.json b/www/composer.json new file mode 100644 index 0000000..ed23328 --- /dev/null +++ b/www/composer.json @@ -0,0 +1,14 @@ +{ + "name": "sijanec/travnik", + "description": "web frontend for exploring metainfo files downloaded by travnik", + "type": "project", + "require": { + "rhilip/bencode": "^2.3" + }, + "authors": [ + { + "name": "Anton Luka Šijanec", + "email": "anton@sijanec.eu" + } + ] +} diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..2fd5a92 --- /dev/null +++ b/www/index.php @@ -0,0 +1,77 @@ +"; + while (false !== ($entry = readdir($handle))) { + if (preg_match("/torrent$/", $entry)) { + $h = htmlspecialchars(explode(".", $entry)[0]); + echo '
  • ' . $h . ''; + } + } + die(); + closedir($handle); + } else { + die("ne morem brati direktorija"); + } +} +if (!preg_match("/^[a-f0-9A-F]{40}$/", $_REQUEST["h"])) + die('!preg_match("/^[a-f0-9A-F]{40}$/", $_REQUEST["h"])'); +$t = TorrentFile::load("../".$_REQUEST["h"].".torrent"); +?> + + +

    getName()) ?>

    +<?= htmlspecialchars($t->getName()) ?> + + + + + + + + + + + isPrivate()) echo ""; ?> + + + + + + + + + + + + + +getRootData()["source"]["v"]) { ?> + + + + +
    pridobljenogetCreationDate()) ?>
    tipgetProtocol() ?>
    datotečni načingetFileMode() ?>
    zaseben
    magnetna povezava
    .torrent>torrent datoteka
    velikostgetSize()/(1024*1024*1024), 6, ",", "") ?> GiB
    število datotekgetFileCount() ?>
    ip naslov viragetRootData()["source"]["ip"]) ?>
    odjemalec viragetRootData()["source"]["v"]) ?>
    + " . htmlspecialchars($k) . ""; + } else { + echo "
  • " . htmlspecialchars($k) . " (" . number_format($v/(1024*1024), 6, ",", "") . " MiB)"; + } +} +echo ""; +?> -- cgit v1.2.3