Browse Source

possibilité d'envoyer les dl depuis l'interface + todo pour le dl

master
Cabillot Julien 6 years ago
parent
commit
80a19dcd38
5 changed files with 62 additions and 9 deletions
  1. 11
      controller/download.php
  2. 4
      root/index.php
  3. 4
      root/js/jquery-2.1.1.min.js
  4. 34
      root/js/my.js
  5. 18
      templates/status.php

11
controller/download.php

@ -1,13 +1,18 @@
<?php
// TODO : ne doit pas lancer le dl directement mais simplement l'enregistrer en base
function getDownload()
{
if (!isset($_GET['myurl'])) {
echo 'pas de get';
if (isset($_GET['myurls'])) {
$myurls = $_GET['myurls'];
} elseif (isset($_POST['myurls'])) {
$myurls = $_POST['myurls'];
} else {
echo 'pas d\'url';
exit();
}
foreach($_GET['myurl'] as $url) {
foreach($myurls as $url) {
$premInfos = PremiumizeMe::getLink($url);
$db = DbMongo::get();
$coll = $db->download;

4
root/index.php

@ -12,12 +12,12 @@ switch($_GET['action']) {
getStatus();
break;
case 'stream':
// http://mydl.cabillot.eu/?myurl=https://1fichier.com/?yawxht1b3y
// http://mydl.cabillot.eu/stream/?myurl=https://1fichier.com/?yawxht1b3y
include dirname(__FILE__).'/../controller/stream.php';
getStream();
break;
case 'download':
// http://mydl.cabillot.eu/download/?myurl[]=https://1fichier.com/?yawxht1b3y
// http://mydl.cabillot.eu/download/?myurls[]=https://1fichier.com/?yawxht1b3y
include dirname(__FILE__).'/../controller/download.php';
getDownload();
break;

4
root/js/jquery-2.1.1.min.js
File diff suppressed because it is too large
View File

34
root/js/my.js

@ -0,0 +1,34 @@
"use strict";
function subURL() {
$("body").css("cursor", "progress");
var lines = $('#urls').val().split('\n');
var url = [];
$.each(lines, function(){
if ($.trim(this) == '') {
return;
}
url.push($.trim(this));
});
if (url.length != 0) {
$.ajax({
url: "/download/",
type: 'post',
data: {
myurls: url
},
dataType: 'json',
success: function(data) {
$("body").css("cursor", "auto");
console.log(data);
},
error: function(xhr, err) {
$("body").css("cursor", "auto");
alert('LOOCKUP_FAILED');
}
});
} else {
$("body").css("cursor", "auto");
}
}

18
templates/status.php

@ -1,4 +1,14 @@
<?php
var_dump($infos['expires']);
var_dump($infos['fairuse_left']);
var_dump($infos['trafficleft_gigabytes']);
<!doctype html>
<html>
<head>
<script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/js/my.js"></script>
</script>
</head>
<body>
Expiration : <?= $infos['expires']->format('H:i d.m.Y') ?><br>
Traffic Restant : <?= intval($infos['trafficleft_gigabytes']) ?>Go (<?= intval($infos['fairuse_left'] * 100) ?>%)<br>
<textarea id="urls" name="urls" style="margin: 0px; width: 985px; height: 401px;"></textarea><br>
<input type="button" id="sub" name="sub" value="submit" onclick="javascript:subURL();">
</body>
</html>
Loading…
Cancel
Save