From 202e7dcef9de06e2130e4a5c9468dfd71ee1a90d Mon Sep 17 00:00:00 2001 From: Ravinou Date: Sat, 20 Jul 2024 22:08:30 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20the=20ability=20to=20?= =?UTF-8?q?use=20FQDN=20without=20SSH=20port=20in=20wizards=20#237?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repo/QuickCommands/QuickCommands.js | 15 ++++++++--- .../WizardSteps/WizardStep2/WizardStep2.js | 14 ++++++----- .../WizardSteps/WizardStep3/WizardStep3.js | 25 +++++++++++-------- .../WizardSteps/WizardStep4/WizardStep4.js | 2 +- helpers/functions/lanCommandOption.js | 10 ++++++-- 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/Components/Repo/QuickCommands/QuickCommands.js b/Components/Repo/QuickCommands/QuickCommands.js index c76a3a7..4208f18 100644 --- a/Components/Repo/QuickCommands/QuickCommands.js +++ b/Components/Repo/QuickCommands/QuickCommands.js @@ -16,10 +16,16 @@ export default function QuickCommands(props) { wizardEnv.SSH_SERVER_PORT_LAN ) { FQDN = wizardEnv.FQDN_LAN; - SSH_SERVER_PORT = wizardEnv.SSH_SERVER_PORT_LAN; + SSH_SERVER_PORT = + wizardEnv.SSH_SERVER_PORT_LAN === 'false' + ? '' + : ':' + wizardEnv.SSH_SERVER_PORT_LAN; } else { FQDN = wizardEnv.FQDN; - SSH_SERVER_PORT = wizardEnv.SSH_SERVER_PORT; + SSH_SERVER_PORT = + wizardEnv.SSH_SERVER_PORT === 'false' + ? '' + : ':' + wizardEnv.SSH_SERVER_PORT; } //State @@ -30,7 +36,7 @@ export default function QuickCommands(props) { // Asynchronously call copy to clipboard navigator.clipboard .writeText( - `ssh://${wizardEnv.UNIX_USER}@${FQDN}:${SSH_SERVER_PORT}/./${props.repositoryName}` + `ssh://${wizardEnv.UNIX_USER}@${FQDN}${SSH_SERVER_PORT}/./${props.repositoryName}` ) .then(() => { // If successful, update the isCopied state value @@ -50,7 +56,8 @@ export default function QuickCommands(props) {
Copied !
) : (
- ssh://{wizardEnv.UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + ssh://{wizardEnv.UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.repositoryName}
)} diff --git a/Components/WizardSteps/WizardStep2/WizardStep2.js b/Components/WizardSteps/WizardStep2/WizardStep2.js index 5963eaf..d6f4eb4 100644 --- a/Components/WizardSteps/WizardStep2/WizardStep2.js +++ b/Components/WizardSteps/WizardStep2/WizardStep2.js @@ -33,11 +33,12 @@ function WizardStep2(props) { >
borg init -e repokey-blake2 ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName}
@@ -57,8 +58,8 @@ function WizardStep2(props) {

Borgmatic

- If you are using Borgmatic and have already edited the configuration file - (find a sample on the step 4) : + If you are using Borgmatic and have already edited the + configuration file (find a sample on the step 4) :
ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName}
For more information about the Vorta graphical client, please diff --git a/Components/WizardSteps/WizardStep3/WizardStep3.js b/Components/WizardSteps/WizardStep3/WizardStep3.js index cb30a5c..d5b3ef8 100644 --- a/Components/WizardSteps/WizardStep3/WizardStep3.js +++ b/Components/WizardSteps/WizardStep3/WizardStep3.js @@ -32,12 +32,13 @@ function WizardStep3(props) { >
borg create ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName} ::archive1 /your/pathToBackup
@@ -78,11 +79,12 @@ function WizardStep3(props) { >
borg check -v --progress ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName}
  • List the remote archives with :
  • @@ -95,11 +97,12 @@ function WizardStep3(props) { >
    borg list ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName}
  • Download a remote archive with the following command :
  • @@ -112,12 +115,13 @@ function WizardStep3(props) { >
    borg export-tar --tar-filter="gzip -9" ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName} ::archive1 archive1.tar.gz
  • @@ -133,12 +137,13 @@ function WizardStep3(props) { >
    borg mount ssh:// - {UNIX_USER}@{FQDN}:{SSH_SERVER_PORT}/./ + {UNIX_USER}@{FQDN} + {SSH_SERVER_PORT}/./ {props.selectedOption.repositoryName} ::archive1 /tmp/yourMountPoint

    diff --git a/Components/WizardSteps/WizardStep4/WizardStep4.js b/Components/WizardSteps/WizardStep4/WizardStep4.js index 99dcc8d..a119975 100644 --- a/Components/WizardSteps/WizardStep4/WizardStep4.js +++ b/Components/WizardSteps/WizardStep4/WizardStep4.js @@ -23,7 +23,7 @@ function WizardStep4(props) { repositories: # Paths of local or remote repositories to backup to. - - ssh://${UNIX_USER}@${FQDN}:${SSH_SERVER_PORT}/./${props.selectedOption.repositoryName} + - ssh://${UNIX_USER}@${FQDN}${SSH_SERVER_PORT}/./${props.selectedOption.repositoryName} storage: archive_name_format: '{FQDN}-documents-{now}' diff --git a/helpers/functions/lanCommandOption.js b/helpers/functions/lanCommandOption.js index 40918e0..14d5d69 100644 --- a/helpers/functions/lanCommandOption.js +++ b/helpers/functions/lanCommandOption.js @@ -3,10 +3,16 @@ export default function lanCommandOption(wizardEnv, lanCommand) { let SSH_SERVER_PORT; if (lanCommand && wizardEnv.FQDN_LAN && wizardEnv.SSH_SERVER_PORT_LAN) { FQDN = wizardEnv.FQDN_LAN; - SSH_SERVER_PORT = wizardEnv.SSH_SERVER_PORT_LAN; + SSH_SERVER_PORT = + wizardEnv.SSH_SERVER_PORT_LAN === 'false' + ? '' + : ':' + wizardEnv.SSH_SERVER_PORT_LAN; } else { FQDN = wizardEnv.FQDN; - SSH_SERVER_PORT = wizardEnv.SSH_SERVER_PORT; + SSH_SERVER_PORT = + wizardEnv.SSH_SERVER_PORT === 'false' + ? '' + : ':' + wizardEnv.SSH_SERVER_PORT; } return { FQDN, SSH_SERVER_PORT };