From 36c3617204d80be45f291b12271c4feaa9f6b1ad Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 14 Jul 2023 12:52:33 -0600 Subject: [PATCH] permit IP for cifs backups (#2342) * permit IP for cifs backups * allow ip instead of hostname (#2347) --------- Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Co-authored-by: Aiden McClelland --- backend/src/disk/mount/filesystem/cifs.rs | 3 +++ .../components/backup-drives/backup-drives.component.ts | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/disk/mount/filesystem/cifs.rs b/backend/src/disk/mount/filesystem/cifs.rs index 7dfcb207d..c456bce63 100644 --- a/backend/src/disk/mount/filesystem/cifs.rs +++ b/backend/src/disk/mount/filesystem/cifs.rs @@ -16,6 +16,9 @@ use crate::util::Invoke; use crate::Error; async fn resolve_hostname(hostname: &str) -> Result { + if let Ok(addr) = hostname.parse() { + return Ok(addr); + } #[cfg(feature = "avahi")] if hostname.ends_with(".local") { return Ok(IpAddr::V4(crate::net::mdns::resolve_mdns(hostname).await?)); diff --git a/frontend/projects/ui/src/app/components/backup-drives/backup-drives.component.ts b/frontend/projects/ui/src/app/components/backup-drives/backup-drives.component.ts index a226de329..fa73b8452 100644 --- a/frontend/projects/ui/src/app/components/backup-drives/backup-drives.component.ts +++ b/frontend/projects/ui/src/app/components/backup-drives/backup-drives.component.ts @@ -277,12 +277,10 @@ export class BackupDrivesStatusComponent { const CifsSpec: ConfigSpec = { hostname: { type: 'string', - name: 'Hostname', + name: 'Hostname/IP', description: - 'The hostname of your target device on the Local Area Network.', - placeholder: `e.g. 'My Computer' OR 'my-computer.local'`, - pattern: '^[a-zA-Z0-9._-]+( [a-zA-Z0-9]+)*$', - 'pattern-description': `Must be a valid hostname. e.g. 'My Computer' OR 'my-computer.local'`, + 'The hostname or IP address of the target device on your Local Area Network.', + placeholder: `e.g. 'MyComputer.local' OR '192.168.1.4'`, nullable: false, masked: false, copyable: false,