mirror of
https://github.com/veeso/termscp.git
synced 2025-12-06 17:15:35 -08:00
Compare commits
2 Commits
205d2813ad
...
4bebec369f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bebec369f | ||
|
|
05c8613279 |
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@@ -15,7 +15,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -49,6 +49,10 @@ Released on 20/09/2025
|
||||
- [Issue 356](https://github.com/veeso/termscp/issues/356): Fixed SSH auth issue not trying with the password if any RSA key was found.
|
||||
- [Issue 334](https://github.com/veeso/termscp/issues/334): SMB support for MacOS with vendored build of libsmbclient.
|
||||
- [Issue 337](https://github.com/veeso/termscp/issues/337): Migrated to libssh.org on Linux and MacOS for better ssh agent support.
|
||||
- [Issue 361](https://github.com/veeso/termscp/issues/361): Report a message while calculating total size of files to transfer.
|
||||
- [Issue 354](https://github.com/veeso/termscp/issues/354):
|
||||
- Removed error popup message if failed to check for updates.
|
||||
- Prevent long timeouts when checking for updates if the network is down or the DNS is not working.
|
||||
|
||||
## 0.18.0
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! Automatic update module. This module is used to upgrade the current version of termscp to the latest available on Github
|
||||
|
||||
use std::net::ToSocketAddrs as _;
|
||||
|
||||
use self_update::backends::github::Update as GithubUpdater;
|
||||
pub use self_update::errors::Error as UpdateError;
|
||||
use self_update::update::Release as UpdRelease;
|
||||
@@ -67,6 +69,9 @@ impl Update {
|
||||
/// otherwise if no version is available, return None
|
||||
/// In case of error returns Error with the error description
|
||||
pub fn is_new_version_available() -> Result<Option<Release>, UpdateError> {
|
||||
// check if api.github.com is reachable before doing anything
|
||||
Self::check_github_api_reachable()?;
|
||||
|
||||
info!("Checking whether a new version is available...");
|
||||
GithubUpdater::configure()
|
||||
// Set default options
|
||||
@@ -83,6 +88,27 @@ impl Update {
|
||||
.map(Self::check_version)
|
||||
}
|
||||
|
||||
/// Check if api.github.com is reachable
|
||||
/// This is useful to avoid long timeouts when the network is down
|
||||
/// or the DNS is not working
|
||||
fn check_github_api_reachable() -> Result<(), UpdateError> {
|
||||
let Some(socket_addr) = ("api.github.com", 443)
|
||||
.to_socket_addrs()
|
||||
.ok()
|
||||
.and_then(|mut i| i.next())
|
||||
else {
|
||||
error!("Could not resolve api.github.com");
|
||||
return Err(UpdateError::Network(
|
||||
"Could not resolve api.github.com".into(),
|
||||
));
|
||||
};
|
||||
|
||||
// just try to open a connection to api.github.com with a timeout of 5 seconds with tcp
|
||||
std::net::TcpStream::connect_timeout(&socket_addr, std::time::Duration::from_secs(5))
|
||||
.map(|_| ())
|
||||
.map_err(|e| UpdateError::Network(format!("Could not reach api.github.com: {e}")))
|
||||
}
|
||||
|
||||
/// In case received version is newer than current one, version as Some is returned; otherwise None
|
||||
fn check_version(r: Release) -> Option<Release> {
|
||||
debug!("got version from GitHub: {}", r.version);
|
||||
@@ -212,4 +238,9 @@ mod test {
|
||||
assert!(!Update::is_new_version_higher("0.9.9", "0.10.1"));
|
||||
assert!(!Update::is_new_version_higher("0.10.9", "0.11.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_check_whether_github_api_is_reachable() {
|
||||
assert!(Update::check_github_api_reachable().is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,10 +223,7 @@ impl AuthActivity {
|
||||
}
|
||||
Err(err) => {
|
||||
// Report error
|
||||
error!("Failed to get latest version: {}", err);
|
||||
self.mount_error(
|
||||
format!("Could not check for new updates: {err}").as_str(),
|
||||
);
|
||||
error!("Failed to get latest version: {err}",);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1260,7 +1260,10 @@ impl FileTransferActivity {
|
||||
|
||||
/// Get total size of transfer for host_bridgehost
|
||||
fn get_total_transfer_size_host(&mut self, entry: &File) -> usize {
|
||||
if entry.is_dir() {
|
||||
// mount message to tell we are calculating size
|
||||
self.mount_blocking_wait("Calculating transfer size…");
|
||||
|
||||
let sz = if entry.is_dir() {
|
||||
// List dir
|
||||
match self.host_bridge.list_dir(entry.path()) {
|
||||
Ok(files) => files
|
||||
@@ -1281,12 +1284,18 @@ impl FileTransferActivity {
|
||||
}
|
||||
} else {
|
||||
entry.metadata.size as usize
|
||||
}
|
||||
};
|
||||
self.umount_wait();
|
||||
|
||||
sz
|
||||
}
|
||||
|
||||
/// Get total size of transfer for remote host
|
||||
fn get_total_transfer_size_remote(&mut self, entry: &File) -> usize {
|
||||
if entry.is_dir() {
|
||||
// mount message to tell we are calculating size
|
||||
self.mount_blocking_wait("Calculating transfer size…");
|
||||
|
||||
let sz = if entry.is_dir() {
|
||||
// List directory
|
||||
match self.client.list_dir(entry.path()) {
|
||||
Ok(files) => files
|
||||
@@ -1307,7 +1316,11 @@ impl FileTransferActivity {
|
||||
}
|
||||
} else {
|
||||
entry.metadata.size as usize
|
||||
}
|
||||
};
|
||||
|
||||
self.umount_wait();
|
||||
|
||||
sz
|
||||
}
|
||||
|
||||
// file changed
|
||||
|
||||
Reference in New Issue
Block a user