From fd1485b8a3ad46639b49979ae2c32ab40a2433fb Mon Sep 17 00:00:00 2001 From: Evandro Araujo Date: Sun, 23 Aug 2020 14:20:04 -0300 Subject: [PATCH] Advanced UI implementarion ready for testing Implements requests from issue #13 --- src/renderer/App.vue | 1 + src/renderer/ProcessHandlerWin.js | 23 +++- src/renderer/SshfsParamsList.js | 112 ++++++++++++++++++ .../CustomCmdlOptions.vue | 93 ++++----------- .../AddEditConnectionWindow/index.vue | 2 +- src/renderer/components/MainWindow/index.vue | 2 +- 6 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 src/renderer/SshfsParamsList.js diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 2dc76aa..cc71392 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -90,6 +90,7 @@ button.btn { fill: contrast(@main-color); width: 22px; float: left; + margin-right: 5px; } } diff --git a/src/renderer/ProcessHandlerWin.js b/src/renderer/ProcessHandlerWin.js index 8ac6548..ad756b7 100644 --- a/src/renderer/ProcessHandlerWin.js +++ b/src/renderer/ProcessHandlerWin.js @@ -7,7 +7,7 @@ class ProcessHandlerWin { create (conn) { return new Promise((resolve, reject) => { - const cmdArgs = [ + let cmdArgs = [ 'cmd', `${conn.user}@${conn.host}:${conn.folder}`, conn.mountPoint, @@ -26,6 +26,27 @@ class ProcessHandlerWin { '-okernel_cache' ] + if (conn.advanced.customCmdlOptionsEnabled) { + let optionalArgs = [] + + conn.advanced.customCmdlOptions.forEach(arg => { + cmdArgs = cmdArgs.filter(a => a.substr(2, arg.name.length) !== arg.name) + + if (arg.value !== '') { + optionalArgs.push(`-o${arg.name}=${arg.value}`) + } else { + optionalArgs.push(`-o${arg.name}`) + } + }) + + cmdArgs = [ + ...cmdArgs, + ...optionalArgs + ] + } + + console.log(cmdArgs) + if (conn.authType === 'password') { cmdArgs.push('-oPreferredAuthentications=password') cmdArgs.push('-opassword_stdin') diff --git a/src/renderer/SshfsParamsList.js b/src/renderer/SshfsParamsList.js new file mode 100644 index 0000000..c3edeaf --- /dev/null +++ b/src/renderer/SshfsParamsList.js @@ -0,0 +1,112 @@ +export default [ + { + name: 'reconnect', + type: 'bool', + description: 'Reconnect to server' + }, + { + name: 'delay_connect', + type: 'bool', + description: 'Delay connection to server' + }, + { + name: 'sshfs_sync', + type: 'bool', + description: 'Synchronous writes' + }, + { + name: 'no_readahead', + type: 'bool', + description: 'Synchronous reads (no speculative readahead)' + }, + { + name: 'sshfs_debug', + type: 'bool', + description: 'Print some debugging information' + }, + { + name: 'cache', + type: 'string', + description: 'Enable caching {yes,no} (default: yes)' + }, + { + name: 'cache_timeout', + type: 'number', + description: 'Sets timeout for caches in seconds (default: 20)' + }, + { + name: 'cache_stat_timeout', + type: 'number', + description: 'Sets timeout for stat cache' + }, + { + name: 'cache_dir_timeout', + type: 'number', + description: 'Sets timeout for dir cache' + }, + { + name: 'cache_link_timeout', + type: 'number', + description: 'Sets timeout for link cache' + }, + { + name: 'workaround', + type: 'string', + description: 'Colon separated list of workarounds' + }, + { + name: 'idmap', + type: 'string', + description: 'User/group ID mapping' + }, + { + name: 'oidfile', + type: 'string', + description: 'File containing username:uid mappings for idmap=file' + }, + { + name: 'gidfile', + type: 'string', + description: 'File containing groupname:gid mappings for idmap=file' + }, + { + name: 'nomap', + type: 'string', + description: 'With idmap=file, how to handle missing mappings' + }, + { + name: 'ssh_command', + type: 'string', + description: 'Execute CMD instead of "ssh"' + }, + { + name: 'ssh_protocol', + type: 'string', + description: 'SSH protocol to use (default: 2)' + }, + { + name: 'sftp_server', + type: 'string', + description: 'Path to SFTP server or subsystem (default: sftp)' + }, + { + name: 'directport', + type: 'number', + description: 'Directly connect to port bypassing SSH -o slave communicate over stdin and stdout bypassing network' + }, + { + name: 'transform_symlinks', + type: 'bool', + description: 'Transform absolute symlinks to relative' + }, + { + name: 'follow_symlinks', + type: 'bool', + description: 'Follow symlinks on the server' + }, + { + name: 'no_check_root', + type: 'bool', + description: 'Don\'t check for existence of "dir" on server' + } +] diff --git a/src/renderer/components/AddEditConnectionWindow/CustomCmdlOptions.vue b/src/renderer/components/AddEditConnectionWindow/CustomCmdlOptions.vue index 956a572..2dcc100 100644 --- a/src/renderer/components/AddEditConnectionWindow/CustomCmdlOptions.vue +++ b/src/renderer/components/AddEditConnectionWindow/CustomCmdlOptions.vue @@ -1,15 +1,15 @@