395 lines
15 KiB
HTML
395 lines
15 KiB
HTML
<link rel="stylesheet" href="/__static-modules/jquery-ui/dist/themes/smoothness/jquery-ui.css">
|
|
|
|
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
|
|
<script src='/__static-modules/mustache/mustache.min.js'></script>
|
|
<script src="/__static/lib/js/jq-repeat.js"></script>
|
|
<script src="/__static-modules/moment/min/moment-with-locales.min.js"></script>
|
|
<script src="/__static-modules/jquery-ui/dist/jquery-ui.min.js"></script>
|
|
<script src="/__static/js/app.js"></script>
|
|
|
|
<style type="text/css">
|
|
.ui-dialog .ui-dialog-title{
|
|
width: unset;
|
|
}
|
|
|
|
#tbp_proxy_header {
|
|
position: fixed;
|
|
top: 0;
|
|
width: 100%;
|
|
z-index: 95;
|
|
background: lightblue;
|
|
height: 3em;
|
|
text-align: initial;
|
|
padding-top: .5em;
|
|
padding-right: 1em;
|
|
}
|
|
|
|
#tbp_proxy_header_right{
|
|
margin-right: 2em;
|
|
float: right;
|
|
|
|
display: flex;
|
|
align-items:center;
|
|
}
|
|
|
|
#tbp_proxy_torrent_dialog_opener{
|
|
border-radius: 25px;
|
|
background: lightseagreen;
|
|
display: flex;
|
|
align-items:center;
|
|
|
|
padding: 1em;
|
|
padding-top: .3em;
|
|
padding-bottom: .3em;
|
|
|
|
margin-right: .5em;
|
|
}
|
|
|
|
#header {
|
|
padding-top: 3.5em;
|
|
}
|
|
</style>
|
|
|
|
<!--
|
|
Dialog boxes to be displayed
|
|
-->
|
|
|
|
<div id="tbp_proxy_login_dialog" title="SSO Login">
|
|
<div class="shadow-lg card">
|
|
<div class="card-header shadow actionMessage" style="display:none"></div>
|
|
<div class="card-body">
|
|
<form action="auth/login" onsubmit="formAJAX(this)" evalAJAX="
|
|
app.auth.setToken(data.token);
|
|
app.auth.logInRedirect();
|
|
">
|
|
<input type="hidden" name="redirect" value="<%= redirect %>">
|
|
|
|
<div class="form-group">
|
|
<label class="control-label">User name</label>
|
|
<div class="input-group mb-3 shadow">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text" ><i class="fa-solid fa-user-tie"></i></span>
|
|
</div>
|
|
<input type="text" name="uid" class="form-control" placeholder="jsmith" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="control-label">Password</label>
|
|
<div class="input-group mb-3 shadow">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text" ><i class="fa-solid fa-key"></i></span>
|
|
</div>
|
|
<input type="password" name="password" class="form-control" placeholder="hunter123!"/>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-outline-dark"><i class="fa-solid fa-right-to-bracket"></i> Log in</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!--
|
|
Torrent List Dialog
|
|
-->
|
|
|
|
<style type="text/css">
|
|
#tbp_proxy_torrent_dialog{
|
|
padding: 0;
|
|
}
|
|
#tbp_proxy_torrent_dialog progress{
|
|
width: 100%;
|
|
height: 2em;
|
|
}
|
|
#tbp_proxy_torrent_dialog ul{
|
|
max-height: 400px;
|
|
overflow-y: scroll;
|
|
list-style-type: none;
|
|
padding-left: 0;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="tbp_proxy_torrent_dialog" title="Torrents">
|
|
<ul>
|
|
<li jq-repeat="tbp_proxy_torrent_dialog_torrents">{{name}}
|
|
<br />
|
|
{{^isFinished}}
|
|
<progress id="file" max="100" value="{{percentDone}}">{{percentDone}}%</progress>
|
|
<br />
|
|
Status: <b>{{statusText}}</b> ETA: <b>{{eta}}</b> Rate: <b>{{rateDownload}}</b>
|
|
{{/isFinished}}
|
|
{{#isFinished}}
|
|
<br /> Done! <a href="https://stuff.718it.biz/torrents/{{name}}" target="_blank"> HTTP Link</a>
|
|
{{/isFinished}}
|
|
<hr />
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<!--
|
|
Torrent Add Dialog
|
|
-->
|
|
<style type="text/css">
|
|
#tbp_proxy_torrent_add_dialog_container{
|
|
width: 32em;
|
|
}
|
|
|
|
#tbp_proxy_torrent_add_dialog input[type="text"]{
|
|
width: 90%;
|
|
}
|
|
#tbp_proxy_torrent_add_dialog label,legend{
|
|
font-weight: bold;
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="tbp_proxy_torrent_add_dialog" title="Add torrent">
|
|
<div id="tbp_proxy_torrent_add_dialog_container" class='card'>
|
|
<div class="card-header shadow actionMessage" style="display:none"></div>
|
|
<div jq-repeat="torrentAdd">
|
|
<form action="torrent" method="post" onsubmit="formAJAX(this)" evalAJAX="
|
|
app.publish('torrent:add', {...data, __noSocket: true});
|
|
$('#tbp_proxy_torrent_add_dialog').dialog('close');
|
|
openDialog($('#tbp_proxy_torrent_dialog'))
|
|
">
|
|
<p>
|
|
<label for="_name">Name:</label>
|
|
<br />
|
|
<input type="text" name="_name" value="{{{name}}}" readonly/>
|
|
</p>
|
|
|
|
<p>
|
|
<label for="magnetLink">Magnet Link:</label>
|
|
<br />
|
|
<input type="text" name="magnetLink" value="{{{magnetLink}}}" readonly/>
|
|
</p>
|
|
|
|
<p>
|
|
<legend>Public Download:</legend>
|
|
|
|
<label for="radio-1" title="The download will appare in the communal download folder">Public</label>
|
|
<input type="radio" name="isPrivate" id="radio-1" value="true" checked readonly/>
|
|
|
|
<label for="radio-2" title="Only you(and the admins) will be able to see this download">Private</label>
|
|
<input type="radio" name="isPrivate" id="radio-2" value="false" readonly/>
|
|
</p>
|
|
|
|
<p>
|
|
<legend>Start on add:</legend>
|
|
|
|
<label for="isStart-1" title="The download will appare in the communal download folder">Yes</label>
|
|
<input type="radio" name="isStart" id="isStart-1" value="true" checked readonly/>
|
|
|
|
<label for="isStart-2" title="Only you(and the admins) will be able to see this download">No</label>
|
|
<input type="radio" name="isStart" id="isStart-2" value="false" readonly/>
|
|
</p>
|
|
|
|
<hr />
|
|
<button type="submit">Start Download</button>
|
|
<button onclick="$('#tbp_proxy_torrent_add_dialog').dialog('close')">Cancel</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!--
|
|
The bar injected at the top of the page
|
|
-->
|
|
|
|
<div id="tbp_proxy_header_right">
|
|
<span id="tbp_proxy_torrent_dialog_opener" class="tbp_proxy_is_authed">
|
|
<img src="/__static/img/Transmission_Icon.svg" height="22" width="22" style="margin-right: .3em;" />
|
|
<span><b>106</b></span>
|
|
</span>
|
|
<button id="tbp_proxy_login_dialog_opener" class="tbp_proxy_not_authed ui-button ui-corner-all ui-widget">Login</button>
|
|
<button class="tbp_proxy_is_authed ui-button ui-corner-all ui-widget"
|
|
onclick="app.auth.logOut(e => window.location.href='/')">Logout</button>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$( document ).ready(function() {
|
|
var commonDialogOptions = {
|
|
position: { my: "left top", at: "left bottom", of: '#tbp_proxy_header_right' },
|
|
autoOpen: false,
|
|
resizable: false,
|
|
closeOnEscape: true,
|
|
draggable: false,
|
|
width: 'auto',
|
|
};
|
|
|
|
/* Login Button and dialog*/
|
|
$( "#tbp_proxy_login_dialog" ).dialog(commonDialogOptions);
|
|
|
|
$( "#tbp_proxy_login_dialog_opener" ).on( "click", function() {
|
|
// https://stackoverflow.com/a/6500385
|
|
$( "#tbp_proxy_login_dialog" ).parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog( "open" );
|
|
});
|
|
|
|
|
|
/* Torrent list button and dialog */
|
|
$( "#tbp_proxy_torrent_dialog" ).dialog(commonDialogOptions);
|
|
|
|
$( "#tbp_proxy_torrent_dialog_opener" ).on( "click", function() {
|
|
$( "#tbp_proxy_torrent_dialog" ).parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog( "open" );
|
|
});
|
|
|
|
|
|
/* Torrent add button and dialog */
|
|
$( "#tbp_proxy_torrent_add_dialog" ).dialog({
|
|
modal: true,
|
|
height: 300,
|
|
...commonDialogOptions
|
|
});
|
|
|
|
$("body").on('click', 'img.718link', function(el){
|
|
// magnetLink
|
|
$.scope.torrentAdd.update({
|
|
magnetLink: $(this).data('link'),
|
|
name: (new URLSearchParams($(this).data('link'))).get('dn')
|
|
});
|
|
$('#tbp_proxy_torrent_add_dialog').parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog('open');
|
|
});
|
|
|
|
$('a').each(function(idx, el){
|
|
var $el = $(el);
|
|
if($el.attr('href') && $el.attr('href').match("magnet:?")){
|
|
$el.before('<img class="tbp_proxy_is_authed 718link" src="/__static/img/Transmission_Icon.svg" height=24 width=24 data-link="'+$el.attr('href')+'"/>')
|
|
}
|
|
});
|
|
|
|
/* Enable tooltips*/
|
|
$( '#tbp_proxy_header' ).tooltip({
|
|
track: true
|
|
});
|
|
|
|
app.subscribe('torrent:add', function(data, topic){
|
|
console.log('sub', topic, data)
|
|
$.scope.tbp_proxy_torrent_dialog_torrents.unshift(app.torrent.parseTorrnetItem(data))
|
|
});
|
|
|
|
listTorrents();
|
|
setInterval(refreshTorrents, 2000)
|
|
});
|
|
|
|
function openDialog($el){
|
|
$el.parent().css({
|
|
position:"fixed", 'margin-right': "2em", 'margin-top': '3em'
|
|
}).end().dialog('open');
|
|
}
|
|
|
|
function listTorrents(){
|
|
app.torrent.list(function(err, data){
|
|
for(let torrent of data.results){
|
|
$.scope.tbp_proxy_torrent_dialog_torrents.unshift(app.torrent.parseTorrnetItem(torrent))
|
|
app.torrent.get(function(error, torrent){
|
|
$.scope.tbp_proxy_torrent_dialog_torrents.update('id', torrent.result.id, app.torrent.parseTorrnetItem(torrent.result))
|
|
} , torrent.id, true)
|
|
}
|
|
});
|
|
};
|
|
|
|
function refreshTorrents(){
|
|
for(let torrent of $.scope.tbp_proxy_torrent_dialog_torrents){
|
|
if(!torrent.isFinished){
|
|
app.torrent.get(function(error, torrent){
|
|
$.scope.tbp_proxy_torrent_dialog_torrents.update('id', torrent.result.id, app.torrent.parseTorrnetItem(torrent.result))
|
|
} , torrent.id, true)
|
|
}
|
|
}
|
|
}
|
|
|
|
app.torrent = (function(app){
|
|
let myTorrents = [];
|
|
|
|
statusMap = [
|
|
'Inactive',
|
|
'CHECK_WAIT',
|
|
'Verifying',
|
|
'DOWNLOAD_WAIT',
|
|
'Downloading',
|
|
'SEED_WAIT',
|
|
'Seeding',
|
|
'ISOLATED',
|
|
'Unknown',
|
|
];
|
|
|
|
function list(callback, username) {
|
|
app.api.get('torrent', callback);
|
|
}
|
|
|
|
function get(callback, id, forceUpdate){
|
|
app.api.get(`torrent/${id}?${forceUpdate ? 'latest': '' }`, callback);
|
|
}
|
|
|
|
function parseTorrnetItem(torrent){
|
|
return {
|
|
...torrent,
|
|
"eta": torrent.eta > 0 ? moment().seconds(torrent.eta).fromNow() : 'Unknown',
|
|
"rateDownload": `${Math.floor(torrent.rateDownload/1024/1024)}mb/s`,
|
|
"sizeWhenDone": `${Math.floor(torrent.sizeWhenDone/1024/1024)}mb/s`,
|
|
"percentDone": torrent.percentDone*100,
|
|
"statusText": statusMap[torrent.status || 8],
|
|
// "createdAtString": moment(torrent.createdAt).fromNow().
|
|
// "downloadDir": "/media/torrents",
|
|
// "errorString": "",
|
|
// "files": [],
|
|
// "hashString": "4794a0915cada6c491eb5c910e1f4a0da727cac8",
|
|
// "isFinished": false,
|
|
// "isStalled": false,
|
|
// "name": "reacher.s02e06.1080p.web.h264-successfulcrab[EZTVx.to].mkv",
|
|
// "peers": [],
|
|
// "peersConnected": 50,
|
|
// "status": 4,
|
|
// "id": 1,
|
|
// "torrent_id": "454",
|
|
// "magnetLink": "magnet:?xt=urn:btih:4794A0915CADA6C491EB5C910E1F4A0DA727CAC8&dn=Reacher+S02E06+1080p+WEB+H264-SuccessfulCrab&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2F47.ip-51-68-199.eu%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2780%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2730%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
|
// "isPrivate": false,
|
|
// "added_by": "wmantly",
|
|
// "createdAt": "2024-01-05T21:18:30.607Z",
|
|
// "updatedAt": "2024-01-05T21:32:54.493Z"
|
|
}
|
|
}
|
|
|
|
return {list, get, parseTorrnetItem};
|
|
})(app);
|
|
|
|
</script>
|
|
|
|
<!-- {
|
|
"result": {
|
|
"downloadDir": "/media/torrents",
|
|
"errorString": "",
|
|
"eta": -2,
|
|
"files": [],
|
|
"hashString": "a7ff69e500f0b62c3dec1061b9998610385dc7b6",
|
|
"isFinished": false,
|
|
"isStalled": true,
|
|
"name": "Aftershock.2012.LIMITED.720p.BluRay.x264-GECKOS+[PublicHD]",
|
|
"peers": [],
|
|
"peersConnected": 0,
|
|
"percentDone": 0,
|
|
"rateDownload": 0,
|
|
"sizeWhenDone": 0,
|
|
"status": 4,
|
|
"dataValues": {
|
|
"id": 1,
|
|
"torrent_id": "451",
|
|
"magnetLink": "magnet:?xt=urn:btih:DF0146FBD120793246BE3D29ADD11BC7D460BFBB&dn=Magnum+P+I+2018+S05E19+720p+HDTV+x264-SYNCOPY&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2F47.ip-51-68-199.eu%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2780%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2730%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
|
"hashString": "a7ff69e500f0b62c3dec1061b9998610385dc7b6",
|
|
"name": "Aftershock.2012.LIMITED.720p.BluRay.x264-GECKOS+[PublicHD]",
|
|
"added_by": "wmantly",
|
|
"status": 4,
|
|
"percentDone": 0,
|
|
"downloadDir": "/media/torrents",
|
|
"errorString": "",
|
|
"sizeWhenDone": 0,
|
|
"createdAt": "2024-01-04T17:40:58.187Z",
|
|
"updatedAt": "2024-01-05T19:30:37.676Z"
|
|
},
|
|
} --> |