diff --git a/Components/Repo/QuickCommands/QuickCommands.js b/Components/Repo/QuickCommands/QuickCommands.js index 2979613..86933d9 100644 --- a/Components/Repo/QuickCommands/QuickCommands.js +++ b/Components/Repo/QuickCommands/QuickCommands.js @@ -5,6 +5,23 @@ import classes from './QuickCommands.module.css'; import { IconSettingsAutomation, IconCopy } from '@tabler/icons'; export default function QuickCommands(props) { + ////Vars + //Needed to generate command for borg over LAN instead of WAN if env vars are set and option enabled. + let HOSTNAME; + let SSH_SERVER_PORT; + console.log(props.lanCommand); + if ( + props.lanCommand && + process.env.NEXT_PUBLIC_HOSTNAME_LAN && + process.env.NEXT_PUBLIC_SSH_SERVER_PORT_LAN + ) { + HOSTNAME = process.env.NEXT_PUBLIC_HOSTNAME_LAN; + SSH_SERVER_PORT = process.env.NEXT_PUBLIC_SSH_SERVER_PORT_LAN; + } else { + HOSTNAME = process.env.NEXT_PUBLIC_HOSTNAME; + SSH_SERVER_PORT = process.env.NEXT_PUBLIC_SSH_SERVER_PORT; + } + //State const [isCopied, setIsCopied] = useState(false); @@ -13,7 +30,7 @@ export default function QuickCommands(props) { // Asynchronously call copy to clipboard navigator.clipboard .writeText( - `borg init -e repokey-blake2 ssh://${props.unixUser}@${process.env.NEXT_PUBLIC_HOSTNAME}:${process.env.NEXT_PUBLIC_SSH_SERVER_PORT}/./${props.repository}` + `borg init -e repokey-blake2 ssh://${props.unixUser}@${HOSTNAME}:${SSH_SERVER_PORT}/./${props.repository}` ) .then(() => { // If successful, update the isCopied state value @@ -34,8 +51,7 @@ export default function QuickCommands(props) { ) : (
borg init -e repokey-blake2 ssh://{props.unixUser}@ - {process.env.NEXT_PUBLIC_HOSTNAME}: - {process.env.NEXT_PUBLIC_SSH_SERVER_PORT}/./ + {HOSTNAME}:{SSH_SERVER_PORT}/./ {props.repository}
)} diff --git a/Components/Repo/Repo.js b/Components/Repo/Repo.js index ff9cb0a..d65b83b 100644 --- a/Components/Repo/Repo.js +++ b/Components/Repo/Repo.js @@ -34,6 +34,7 @@ export default function Repo(props) { diff --git a/Containers/RepoList/RepoList.js b/Containers/RepoList/RepoList.js index fc4bde9..05b01bf 100644 --- a/Containers/RepoList/RepoList.js +++ b/Containers/RepoList/RepoList.js @@ -136,6 +136,7 @@ export default function RepoList() { displayDetails={repo.displayDetails} unixUser={repo.unixUser} comment={repo.comment} + lanCommand={repo.lanCommand} repoManageEditHandler={() => repoManageEditHandler(repo.id)} > {repo.displayDetails ? (