remote-file: add --remote-root option for security
This commit is contained in:
parent
e6394746e3
commit
03812933c5
4 changed files with 9 additions and 1 deletions
|
|
@ -70,7 +70,10 @@ $(document).ready(()=>{
|
|||
|
||||
browse.click(function(e){
|
||||
e.preventDefault()
|
||||
dialog.showOpenDialog({filters:[{name:option.file.name,extensions:option.file.extensions}]},function(file){
|
||||
dialog.showOpenDialog({
|
||||
filters:[{name:option.file.name,extensions:option.file.extensions}],
|
||||
properties: option.file.folder ? ['openDirectory'] : ['openFile']
|
||||
},function(file){
|
||||
input.val(file).change()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -380,6 +380,9 @@ module.exports = {
|
|||
|
||||
if (data.path) p = path.resolve(...data.path)
|
||||
|
||||
var root = settings.read('remoteRoot')
|
||||
if (root && !p.includes(root)) p = root
|
||||
|
||||
fs.readdir(p, (err, files)=>{
|
||||
if (err) {
|
||||
ipc.send('notify', {class: 'error', message: err.message}, clientId)
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ module.exports = {
|
|||
return msg
|
||||
}
|
||||
},
|
||||
'remote-root':{type:'string', describe:'set remote file browsing root folder', file:{folder: true}},
|
||||
'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'},
|
||||
'fullscreen':{type:'boolean', describe:'launch in fullscreen mode (only affects the default gui, F11 to exit)'},
|
||||
'inspect':{type:'boolean', describe:'enable node/electron inspector', launcher: false}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ var makeDefaultConfig = function(argv){
|
|||
noGpu: argv['disable-gpu'] || false,
|
||||
readOnly: argv['read-only'] || false,
|
||||
remoteSaving: argv['remote-saving'] ? RegExp(argv['remote-saving']) : false,
|
||||
remoteRoot: argv['remote-root'] || false,
|
||||
midi: argv['midi'],
|
||||
stateFile: (function(){
|
||||
if (!argv['state']) return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue