From 55062934245421f5244d5dcc7238013b44aec86e Mon Sep 17 00:00:00 2001 From: simatec Date: Sat, 13 Oct 2018 13:11:36 +0200 Subject: [PATCH 1/5] (simatec) Fix Access Token for dropbox --- admin/index_m.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/index_m.html b/admin/index_m.html index 82ab40c5..1d51f378 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -956,7 +956,7 @@
- + dropbox.com
From 9aed128d60ca3f3e910c1f149df50127569591b1 Mon Sep 17 00:00:00 2001 From: simatec Date: Sat, 13 Oct 2018 14:55:15 +0200 Subject: [PATCH 2/5] (simatec) Fix Access FTP and NAS path --- lib/list/cifs.js | 14 +++++++++++--- lib/scripts/01-mount.js | 9 ++++++--- lib/scripts/50-ftp.js | 6 +++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/list/cifs.js b/lib/list/cifs.js index 22de0c8b..b4460a18 100644 --- a/lib/list/cifs.js +++ b/lib/list/cifs.js @@ -109,9 +109,13 @@ function mount(options, log, callback) { if (!options.mount.startsWith('//')) { options.mount = '//' + options.mount; } - child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777,vers=1.0 ${options.mount}/${options.dir} ${backupDir}`, (error, stdout, stderr) => { + + if (!options.dir.startsWith('/')) { + options.dir = '/' + options.dir; + } + child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777,vers=1.0 ${options.mount}${options.dir} ${backupDir}`, (error, stdout, stderr) => { if (error) { - child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777 ${options.mount}/${options.dir} ${backupDir}`, (error, stdout, stderr) => { + child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777 ${options.mount}${options.dir} ${backupDir}`, (error, stdout, stderr) => { if (error) { callback(error); } else { @@ -126,7 +130,11 @@ function mount(options, log, callback) { }); } else if (options.mountType === 'NFS') { - child_process.exec(`mount ${options.mount}:/${options.dir} ${backupDir}`, (error, stdout, stderr) => { + if (!options.dir.startsWith('/')) { + options.dir = '/' + options.dir; + } + + child_process.exec(`mount ${options.mount}:${options.dir} ${backupDir}`, (error, stdout, stderr) => { if (error) { callback(error); } else { diff --git a/lib/scripts/01-mount.js b/lib/scripts/01-mount.js index 71f92e82..81d34a94 100644 --- a/lib/scripts/01-mount.js +++ b/lib/scripts/01-mount.js @@ -5,14 +5,17 @@ function command(options, log, callback) { if (options.mountType === 'CIFS' && options.mount && !options.mount.startsWith('//')) { options.mount = '//' + options.mount; } + if (options.mountType === 'CIFS' && options.mount && !options.dir.startsWith('/') || options.mountType === 'NFS' && options.mount && !options.dir.startsWith('/')) { + options.dir = '/' + options.dir; + } if (!options.mount) { return callback('NO mount path specified!'); } if (options.mountType === 'CIFS') { - child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777,vers=1.0 ${options.mount}/${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { + child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777,vers=1.0 ${options.mount}${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { if (error) { - child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777 ${options.mount}/${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { + child_process.exec(`mount -t cifs -o ${options.user ? 'user=' + options.user + ',password=' + options.pass : ''},rw,file_mode=0777,dir_mode=0777 ${options.mount}${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { if (error) { log.error(`[${options.name} ${stderr}`); callback(error); @@ -28,7 +31,7 @@ function command(options, log, callback) { }); } if (options.mountType === 'NFS') { - child_process.exec(`mount ${options.mount}:/${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { + child_process.exec(`mount ${options.mount}:${options.dir} ${options.backupDir}`, (error, stdout, stderr) => { if (error) { log.error(`[${options.name} ${stderr}`); callback(error); diff --git a/lib/scripts/50-ftp.js b/lib/scripts/50-ftp.js index 6c79fb14..3280029f 100644 --- a/lib/scripts/50-ftp.js +++ b/lib/scripts/50-ftp.js @@ -90,7 +90,11 @@ function cleanFiles(client, dir, names, num, log, errors, callback) { function command(options, log, callback) { if (options.host && options.context && options.context.fileNames && options.context.fileNames.length) { const client = new Client(); - const fileNames = JSON.parse(JSON.stringify(options.context.fileNames)); + const fileNames = JSON.parse(JSON.stringify(options.context.fileNames)); + + if (!options.dir.startsWith('/')) { + options.dir = '/' + options.dir; + } let dir = (options.dir || '').replace(/\\/g, '/'); From 26332d38aa79fe7d8690525acbe04b4b6353c499 Mon Sep 17 00:00:00 2001 From: simatec Date: Mon, 15 Oct 2018 16:07:05 +0200 Subject: [PATCH 3/5] (simatec) Fix Restore path for ownDir --- admin/index_m.html | 19 +++++++++++++++++++ admin/words.js | 1 + io-package.json | 3 ++- lib/list/cifs.js | 35 ++++++++++++++++++++++++++--------- lib/list/dropbox.js | 14 ++++++++++++++ lib/list/ftp.js | 18 ++++++++++++++++++ main.js | 24 ++++++++++++++++++------ 7 files changed, 98 insertions(+), 16 deletions(-) diff --git a/admin/index_m.html b/admin/index_m.html index 1d51f378..fd793f10 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -518,6 +518,18 @@ $('.copy').hide(); } }).trigger('change'); + + $('#restoreSource').on('change', function () { + if ($(this).val() === 'NAS / Copy' && $('#cifsOwnDir').prop('checked')) { + $('.bkpType').show(); + } else if ($(this).val() === 'FTP' && $('#ftpOwnDir').prop('checked')) { + $('.bkpType').show(); + } else if ($(this).val() === 'Dropbox' && $('#dropboxOwnDir').prop('checked')) { + $('.bkpType').show(); + } else { + $('.bkpType').hide(); + } + }).trigger('change'); /* if ($('#mySqlEnabled').prop('checked')) { $('.tab-my-sql').show(); @@ -1010,6 +1022,13 @@
+
+ + +