diff --git a/config/env/default.js b/config/env/default.js index 218d6b9c..3cd89628 100644 --- a/config/env/default.js +++ b/config/env/default.js @@ -57,6 +57,7 @@ module.exports = { torrent: { file: { dest: './modules/torrents/client/uploads/', + temp: './modules/torrents/client/uploads/temp/', limits: { fileSize: 1 * 1024 * 1024 // Max file size in bytes (1 MB) } diff --git a/config/lib/multer.js b/config/lib/multer.js index b00bc172..81f32fc5 100644 --- a/config/lib/multer.js +++ b/config/lib/multer.js @@ -37,6 +37,10 @@ module.exports.createUploadFilename = function (req, file, cb) { var regex = new RegExp(',', 'g'); var filename = file.originalname.replace(regex, ' '); + if (fs.existsSync(config.uploads.torrent.file.temp + filename)) { + fs.unlinkSync(config.uploads.torrent.file.temp + filename); + } + if (fs.existsSync(config.uploads.torrent.file.dest + filename)) { var err = new Error(); err.code = 'FILE_ALREADY_EXISTS'; @@ -47,7 +51,7 @@ module.exports.createUploadFilename = function (req, file, cb) { }; module.exports.getUploadDestination = function (req, file, cb) { - cb(null, config.uploads.torrent.file.dest); + cb(null, config.uploads.torrent.file.temp); }; module.exports.createUploadSubtitleFilename = function (req, file, cb) { diff --git a/gulpfile.js b/gulpfile.js index 530f99a1..b98ccaf5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -260,6 +260,11 @@ gulp.task('makeUploadsDir', function () { console.error(err); } }); + fs.mkdir('modules/torrents/client/uploads/temp', function (err) { + if (err && err.code !== 'EEXIST') { + console.error(err); + } + }); fs.mkdir('modules/torrents/client/uploads/subtitles', function (err) { if (err && err.code !== 'EEXIST') { console.error(err); diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index a8f17c0d..a3c638b3 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -31,7 +31,7 @@ body { background-color: rgba(0, 0, 0, .7); //opacity: 0.5; padding-top: 30px; - padding-bottom: 30px; + padding-bottom: 20px; } .loading { color: #ccc; @@ -44,6 +44,7 @@ body { } legend { color: lighten(@gray-light, 8%); + margin-bottom: 10px; } img { opacity: 0; @@ -61,7 +62,7 @@ body { } } .genres-item { - color: #fff; + color: #ccc; } .img-circle { &:hover { @@ -87,6 +88,9 @@ body { .img-thumbnail { padding: 1px !important; } + p { + margin: 0; + } } .torrent-post-info { diff --git a/modules/core/client/views/home.client.view.html b/modules/core/client/views/home.client.view.html index 1eb8ff32..2dada828 100644 --- a/modules/core/client/views/home.client.view.html +++ b/modules/core/client/views/home.client.view.html @@ -39,9 +39,10 @@