Bonjour, j’ai finalement réussi à bloquer mes accès à mon seul IP en modifiant le fichier .conf de nginx qui se trouve dans etc/nginx/conf.d/mondomaine.tld.d/my_webapp.conf
Voici le script de génération du flux RSS en fonction des fichiers téléchargés. Il permet aussi de filtrer directement la taille minimum, renommer, etc. Je l’avais trouvé grâce à l’excellant Vinky, sur le forum nas-forum.com
A+ 
<?php
//Utilisation : <-----------URL------------>/rss.php?dossier=
//Si le paramêtre dossier n'est pas mis, le dossier par défaut est listé.
/********************************/
/* CONFIGURATION */
/********************************/
$physical_path = '/home/yunohost.transmission/completed'; // Dossier à lister par défaut (ex : /var/www/download)
$max = 50; //Nombre de fichiers à afficher dans le flux RSS
$site = 'sftp://XXXXXX:XXXXXXXXX@XX.XX.XX.XX:XX'; // IP ou NDD (http:// ou https:// ou ftp:// etc... utilisé pour télécharger les fichiers)
$nomDePage = 'Nom de page';// Nom affiché
$lienInterne = ''; //position non affiché dans l'url (ex : /var/www/download/fichier.ext et url = http:///download/fichier.ext, mettre /var/www/ dans ce champs car non présent dans l'url)
$tempsAttente = 100; //Temps (en s) sans que le fichier soit modifié avant de le lister. (si trop rapide, il peut apparaître alors que le fichier n'est pas fini de téléchargé).
//VOIR LIGNE 100 POUR INDIQUER LES EXTENSIONS AUTORISES :
// Ajouter '|| get_file_icon($file)=="ext"' (sans les '') avant la fin de la parenthèse avec ext, l'extension que l'on veut qui soit listé
/********************************/
/* FONCTIONS */
/********************************/
$excludeFiles = array(".", "..", ".htaccess", ""); // Liste des fichiers ignorés dans le listing
/**
* Récupère récursivement le contenu d'un répertoire
* et le retourne sous forme d'array
* @param $directory Le répertoire à traiter
**/
function recursive_directory_tree($directory = null)
{
global $excludeFiles;
//If $directory is null, set $directory to the current working directory.
if ($directory == null) {
$directory = getcwd();
}
//declare the array to return
$return = array();
//Check if the argument specified is an array
if (is_dir($directory)) {
//Scan the directory and loop through the results
foreach(scandir($directory) as $file) {
//. = current directory, .. = up one level. We want to ignore both.
if ($file[0] == ".") {
continue;
}
//Exclude some specified files
if (in_array($file, $excludeFiles)) {
continue;
}
//Check if the current $file is a directory itself.
//The appending of $directory is necessary here.
if (is_dir($directory."/".$file))
{
//Create a new array with an index of the folder name.
$return[$directory."/".$file] = recursive_directory_tree($directory."/".$file);
}
else
{
//If $file is not a directory, just add it to th return array.
$return[] = $directory."/".$file;
}
}
}
else
{
$return[] = $directory;
}
return $return;
}
/**
* Stock dans un tableau tous les fichiers video présents dans le repertoire mis en pareamètre
**/
function liste($dossier)
{
global $tabTrie;
foreach ($dossier as $file)
{
if ( is_array($file) )
{
liste($file);
}
else
{
# if(get_file_icon($file)=="mp4" || get_file_icon($file)=="mkv" || get_file_icon($file)=="avi" )
{
array_push($tabTrie, $file);
}
}
}
}
/**
* Convertit la taille en Xo
* @param $fs La taille à convertir
*/
function convert_size($fs)
{
if ($fs >= 1073741824)
$fs = round($fs / 1073741824 * 100) / 100 . " Go";
elseif ($fs >= 1048576)
$fs = round($fs / 1048576 * 100) / 100 . " Mo";
elseif ($fs >= 1024)
$fs = round($fs / 1024 * 100) / 100 . " Ko";
else
$fs = $fs . " o";
return $fs;
}
/**
* Retourne l'extention d'un fichier en fonction de son type
* @filename Le nom du fichier à considérer
*/
function get_file_icon($filename)
{
return pathinfo($filename, PATHINFO_EXTENSION);
}
/**
* Retourne le mime d'un fichier
* @filename Le nom du fichier à considérer
*/
function mime_file($filename)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE); // Retourne le type mime à la extension mimetype
$mime=finfo_file($finfo, $filename);
finfo_close($finfo);
return $mime;
}
/********************************/
/* FONCTIONS */
/********************************/
#ISO-8859-1
$entete = '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<atom:link href="'.$site.'/rss.php" rel="self" type="application/rss+xml" />
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<title>'.$nomDePage.'</title>
<link>'.$site.'</link>
<language>fr-FR</language>
<description>Liste des nouveaux fichiers</description>
';
$pied = '</channel>
</rss>';
if(isset ($_GET['dossier']))
$physical_path = $physical_path.'/'.$_GET['dossier'];
$current_dir = array();
$tab= array();
$tabSize = array();
$tabTrie= array();
$current_dir = recursive_directory_tree($physical_path);
liste($current_dir);
foreach ($tabTrie as $key => $fichier)
{
$time = filemtime($fichier);
$actualTime = time();
$date = date("F d Y H:i:s.", filemtime($fichier));
if($fichier != '.' && $fichier != '..' && $fichier != 'index.php')
{
$tab["$fichier"] = $time;
$taille=filesize($fichier);
$tabSize["$fichier"] = $taille;
}
}
array_multisort($tab, SORT_DESC, $tabSize);
echo $entete;
$nombre = 1;
foreach ($tab as $fichier => $heure)
{
$nom = basename($fichier);
$extension = get_file_icon($fichier,TRUE);
$nom = str_replace(".$extension", "" , $nom);
$nom = str_replace(".", " " , $nom);
//
/* RENOMMAGE */
//
if(substr_count(strtoupper($nom), strtoupper(" epz")) > 0)
{
$nom = str_replace("epz-", "" , $nom);
}
if(substr_count(strtoupper($nom), strtoupper(" HDTV")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("VTDH"))+5));
}
if(substr_count(strtoupper($nom), strtoupper(" PDTV")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("VTDP"))+5));
}
if(substr_count(strtoupper($nom), strtoupper(" WEB")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("BEW"))+4));
}
if(substr_count(strtoupper($nom), strtoupper(" XVID")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("DIVX"))+5));
}
if(substr_count(strtoupper($nom), strtoupper(" LD")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("DL"))+3));
}
if(substr_count(strtoupper($nom), strtoupper(" DC")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("CD"))+3));
}
if(substr_count(strtoupper($nom), strtoupper(" x264")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("462x"))+3));
}
if(substr_count(strtoupper($nom), strtoupper(" bluray")) > 0)
{
$nom = strrev($nom);
$nom = strrev(substr($nom,strpos(strtoupper($nom),strtoupper("yarulb"))+7));
}
$nom = ucwords(mb_strtolower($nom));
$nom = str_replace ( "French" , "FRENCH", $nom);
$nom = str_replace ( "Vostfr" , "VOSTFR", $nom);
$nom = str_replace ( "e0" , "E0", $nom);
$nom = str_replace ( "e1" , "E1", $nom);
$nom = str_replace ( "e2" , "E2", $nom);
$nom = $nom." [$extension]";
//
/* RENOMMAGE */
//
if(($actualTime-$heure) > $tempsAttente)
{
if ($nombre <= $max)
{
echo('
<item>
<title>'.$nom.'</title>
<description>'.$nombre.' | Format : '.$extension.' | Date d\'ajout : '. date("d/m/Y H:i:s", $heure).' | Taille : '.convert_size($tabSize["$fichier"]).'</description>
<pubDate>'.date("D, d M Y H:i:s", $heure).'</pubDate>
<link>'.$site.str_replace($lienInterne, "" ,$fichier).'</link>
<enclosure length="'.$tabSize[$fichier].'" type="'.mime_file($fichier).'" url="'.$site.str_replace($lienInterne, "" ,$fichier).'" />
</item>
');
$nombre++;
}
}
}
echo $pied;
?>