112 lines
5.3 KiB
Twig
112 lines
5.3 KiB
Twig
{% extends 'master.twig' %}
|
|
|
|
{% set title = torrent_info.name %}
|
|
|
|
{% block content %}
|
|
<div class="info">
|
|
<div class="info-header">
|
|
<h2>{{ torrent_info.name }}</h2>
|
|
<ul>
|
|
<li><a href="/download/{{ torrent_info.id }}"><img src="//static.flash.moe/images/silk/link.png" alt=""> Download</a></li>
|
|
{% if globals.auth_info.isLoggedIn and globals.auth_info.userInfo.canRecalculateInfoHash %}
|
|
<li><a href="javascript:;" class="js-info-hash-recalc"><img src="//static.flash.moe/images/silk/calculator.png" alt=""> Recalculate Info Hash</a></li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="info-stats">
|
|
<div class="info-stats-item info-stats-submitted">
|
|
<div class="info-stats-item-title">Submitted on</div>
|
|
<div class="info-stats-item-value"><time datetime="{{ torrent_info.createdTime|date('c') }}">{{ torrent_info.createdTime|date('Y-m-d H:i:s e') }}</time></div>
|
|
</div>
|
|
|
|
{% if torrent_info.isApproved and globals.auth_info.isLoggedIn and globals.auth_info.userInfo.canApproveTorrents %}
|
|
<div class="info-stats-item info-stats-approved">
|
|
<div class="info-stats-item-title">Approved on</div>
|
|
<div class="info-stats-item-value"><time datetime="{{ torrent_info.approvedTime|date('c') }}">{{ torrent_info.approvedTime|date('Y-m-d H:i:s e') }}</time></div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="info-stats-item info-stats-size" style="border-color: {{ seria_filesize_colour(torrent_total_size) }}">
|
|
<div class="info-stats-item-title">Total size</div>
|
|
<div class="info-stats-item-value">{{ torrent_total_size|format_filesize }} ({{ torrent_total_size|number_format }} bytes)</div>
|
|
</div>
|
|
|
|
<div class="info-stats-item info-stats-uploading">
|
|
<div class="info-stats-item-title">Uploading</div>
|
|
<div class="info-stats-item-value">{{ torrent_complete_peers|number_format }}</div>
|
|
</div>
|
|
|
|
<div class="info-stats-item info-stats-downloading">
|
|
<div class="info-stats-item-title">Downloading</div>
|
|
<div class="info-stats-item-value">{{ torrent_incomplete_peers|number_format }}</div>
|
|
</div>
|
|
|
|
{% if torrent_info.isPrivate %}
|
|
<div class="info-stats-item info-stats-visibility">
|
|
<div class="info-stats-item-title">Visibility</div>
|
|
<div class="info-stats-item-value">Private</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if torrent_user is not null %}
|
|
<div class="info-user" style="--user-colour: {{ torrent_user.colour }}">
|
|
<div class="info-user-uploaded">Submitted by</div>
|
|
<div class="avatar info-user-avatar"><a href="/profile/{{ torrent_user.name }}"><img src="{{ globals.site_info.avatarUrl(torrent_user, 40) }}" alt="" width="20" height="20"></a></div>
|
|
<div class="info-user-name"><a href="/profile/{{ torrent_user.name }}">{{ torrent_user.name }}</a></div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not torrent_info.isApproved and globals.auth_info.isLoggedIn and globals.auth_info.userInfo.canApproveTorrents %}
|
|
<div class="info-pending">
|
|
<div class="info-pending-text">This torrent is pending approval.</div>
|
|
<a class="info-pending-approve js-info-approve" href="javascript:;">APPROVE</a>
|
|
<a class="info-pending-deny js-info-deny" href="javascript:;">DENY</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if torrent_info.hasComment %}
|
|
<div class="info-comment">
|
|
<div class="info-comment-header">Description</div>
|
|
<div class="info-comment-content"><pre>{{ torrent_info.comment }}</pre></div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<script>
|
|
(function() {
|
|
const dlId = '{{ torrent_info.id }}';
|
|
|
|
const jsInfoHashRecalc = document.querySelector('.js-info-hash-recalc');
|
|
if(jsInfoHashRecalc)
|
|
jsInfoHashRecalc.onclick = () => seria.dls.rehash(dlId).then(result => {
|
|
if(result.hash)
|
|
alert('Recalculated info hash is: ' + result.hash);
|
|
else
|
|
alert('Something went wrong: ' + result);
|
|
});
|
|
|
|
const jsInfoApprove = document.querySelector('.js-info-approve');
|
|
if(jsInfoApprove)
|
|
jsInfoApprove.onclick = () => seria.dls.approve(dlId).then(result => {
|
|
if(result !== '') {
|
|
alert('Something went wrong: ' + result);
|
|
return;
|
|
}
|
|
|
|
location.reload();
|
|
});
|
|
|
|
const jsInfoDeny = document.querySelector('.js-info-deny');
|
|
if(jsInfoDeny)
|
|
jsInfoDeny.onclick = () => seria.dls.deny(dlId).then(result => {
|
|
if(result !== '') {
|
|
alert('Something went wrong: ' + result);
|
|
return;
|
|
}
|
|
|
|
location.assign('/pending');
|
|
});
|
|
})();
|
|
</script>
|
|
{% endblock %}
|