Display a file list on the info page.

This commit is contained in:
flash 2023-10-06 22:34:49 +00:00
parent 69c78510ff
commit b09e8400d0
3 changed files with 40 additions and 3 deletions

View file

@ -7,13 +7,13 @@
}
html,
body,
.wrapper {
body {
width: 100%;
height: 100%;
}
.wrapper {
min-height: 100%;
font: 12px/20px Verdana, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
background: #111;
color: #fff;
@ -332,6 +332,31 @@ body,
line-height: 14px;
}
.info-files {
background: #161616;
overflow: hidden;
width: 100%;
box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
text-shadow: 0 1px 4px #000;
align-items: center;
padding: 2px;
margin-top: 2px;
}
.info-files-header {
font-size: 1.4em;
padding: 5px 10px;
}
.info-files-content {
padding: 5px 10px;
overflow: auto;
max-height: 300px;
}
.info-files-item {
font-family: monospace;
font-size: 1.1em;
line-height: 1.5em;
}
.profile {}
.profile-header {

View file

@ -88,7 +88,9 @@ class TorrentInfoRouting extends RouteHandler {
$completePeers = $peers->countCompletePeers($this->torrentInfo);
$incompletePeers = $peers->countIncompletePeers($this->torrentInfo);
$totalFileSize = $this->torrentsCtx->getFiles()->countTotalSize($this->torrentInfo);
$files = $this->torrentsCtx->getFiles();
$totalFileSize = $files->countTotalSize($this->torrentInfo);
$fileList = $files->getFiles($this->torrentInfo);
return $this->templating->render('info', [
'torrent_info' => $this->torrentInfo,
@ -96,6 +98,7 @@ class TorrentInfoRouting extends RouteHandler {
'torrent_total_size' => $totalFileSize,
'torrent_complete_peers' => $completePeers,
'torrent_incomplete_peers' => $incompletePeers,
'torrent_files' => $fileList,
]);
}

View file

@ -72,6 +72,15 @@
<div class="info-comment-content"><pre>{{ torrent_info.comment }}</pre></div>
</div>
{% endif %}
<div class="info-files">
<div class="info-files-header">Files</div>
<div class="info-files-content">
{% for file in torrent_files %}
<div class="info-files-item">{{ file.path }} ({{ file.length|format_filesize }})</div>
{% endfor %}
</div>
</div>
</div>
<script>
(function() {