Show client information for file list (#1066)

This commit is contained in:
Cønstantine Kovalensky 2023-11-08 23:08:31 +04:00 committed by GitHub
commit c4ad384342
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ $row = DB()->fetch_row($sql);
if (empty($row) || empty($row['physical_filename'])) { if (empty($row) || empty($row['physical_filename'])) {
http_response_code(404); http_response_code(404);
die('Topic id is missing'); die('Valid topic id is missing');
} }
if (empty($row['info_hash_v2'])) { if (empty($row['info_hash_v2'])) {
@ -36,6 +36,7 @@ $file_list = $torrent->fileTreeTable($tor['info']['file tree']);
$date = ''; $date = '';
$name = htmlCHR($tor['info']['name'] ?? ''); $name = htmlCHR($tor['info']['name'] ?? '');
$client = htmlCHR(substr($tor['created by'], 0, 20) ?? 'unknown');
if (isset($tor['creation date']) && is_numeric($tor['creation date'])) { if (isset($tor['creation date']) && is_numeric($tor['creation date'])) {
$date = date("d M Y | G:i:s T", $tor['creation date']); $date = date("d M Y | G:i:s T", $tor['creation date']);
} }
@ -84,7 +85,10 @@ echo "<html>
</style> </style>
<center> <center>
<h2 style = \"color: #b3b3b3;font-family: Monospace\">Document name: $name | Date: ($date) | Size: $size</h2><hr> <h2 style = \"color: #b3b3b3;font-family: Monospace\">Document name: $name | Date: ($date) | Size: $size
</h2>
<p><i>Created by: $client</i></p>
<hr>
<table><tr><th>Path</th><th>Size</th><th title=\"BitTorrent Merkle Root — The hash of the file, which is embedded in torrents with BitTorrent v2 support, tracker users can extract, calculate them, also deduplicate torrents using desktop tools such as Torrent Merkle Root Reader.\">Hash <sup>?</sup></th></tr>"; <table><tr><th>Path</th><th>Size</th><th title=\"BitTorrent Merkle Root — The hash of the file, which is embedded in torrents with BitTorrent v2 support, tracker users can extract, calculate them, also deduplicate torrents using desktop tools such as Torrent Merkle Root Reader.\">Hash <sup>?</sup></th></tr>";
@ -92,7 +96,7 @@ echo implode('', $file_list['list']);
echo '</center> echo '</center>
</table> </table>
<p>Generated by <a href = "https://github.com/torrentpier/torrentpier" target="_blank">TorrentPier</a></p> <p style = "width: 100%; left: 0; position: absolute; bottom: 0px; text-align: center">Generated by <a href = "https://github.com/torrentpier/torrentpier" target="_blank">TorrentPier</a></p>
</body> </body>
</html>'; </html>';