...
 
Commits (2)
...@@ -5,16 +5,18 @@ const path = require('path'); ...@@ -5,16 +5,18 @@ const path = require('path');
app.get('/getFiles', getFiles); app.get('/getFiles', getFiles);
var PATH_TORRENTS = '/root/.config/transmission-daemon/torrents/';
function getFiles(request, response) { function getFiles(request, response) {
var dirTree = ('/root/.config/transmission-daemon/torrents/'); var dirTree = (PATH_TORRENTS);
diretoryTreeToObj(dirTree, function (err, res) { diretoryTreeToObj(dirTree, function (err, res) {
if (err) if (err)
console.error(err); console.error(err);
var list = JSON.stringify(res); var json = JSON.stringify(res);
var obj = { "currentDir" : dirTree, "list" : list }; var obj = { "currentDir": dirTree, "res": res };
var str = JSON.parse(JSON.stringify(res));
response.send(JSON.stringify(obj)); response.send(obj);
}); });
} }
...@@ -22,7 +24,7 @@ function getFiles(request, response) { ...@@ -22,7 +24,7 @@ function getFiles(request, response) {
app.get(/^(.+)$/, function (req, res) { app.get(/^(.+)$/, function (req, res) {
console.log('static file request : ' + req.params); console.log('static file request : ' + req.params);
//res.sendFile(__dirname + req.params[0]); //res.sendFile(__dirname + req.params[0]);
res.sendFile('/root/.config/transmission-daemon/torrents' + req.params[0]); res.sendFile(PATH_TORRENTS + req.params[0]);
}); });
var diretoryTreeToObj = function (dir, done) { var diretoryTreeToObj = function (dir, done) {
......
Mad Max Fury Road 2015 4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.a9ef06bf5361c7d7.torrent Example app listening on port 3000!
static file request : [object Object]
Miss Peregrines Home For Peculiar Children 2016 .4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.7ac07b397c109d32.torrent static file request : [object Object]
static file request : [object Object]
Mad Max Fury Road 2015 4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.a9ef06bf5361c7d7.torrent static file request : [object Object]
static file request : [object Object]
Miss Peregrines Home For Peculiar Children 2016 .4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.7ac07b397c109d32.torrent static file request : [object Object]
static file request : [object Object]
Mad Max Fury Road 2015 4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.a9ef06bf5361c7d7.torrent static file request : [object Object]
static file request : [object Object]
Miss Peregrines Home For Peculiar Children 2016 .4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.7ac07b397c109d32.torrent static file request : [object Object]
static file request : [object Object]
The Salt of the Earth 2014 BDRip 1080p HEVC ITA ENG AC3-NAHOM.53ec7624a5088c70.torrent static file request : [object Object]
static file request : [object Object]
Mad Max Fury Road 2015 4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.a9ef06bf5361c7d7.torrent static file request : [object Object]
static file request : [object Object]
Miss Peregrines Home For Peculiar Children 2016 .4K.UHD.2160p.BDRip Ita Eng x265-NAHOM.7ac07b397c109d32.torrent static file request : [object Object]
The Salt of the Earth 2014 BDRip 1080p HEVC ITA ENG AC3-NAHOM.53ec7624a5088c70.torrent