summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/http_package.rs5
-rw-r--r--src/net/i2p_package.rs12
2 files changed, 6 insertions, 11 deletions
diff --git a/src/net/http_package.rs b/src/net/http_package.rs
index 4566e05..4924805 100644
--- a/src/net/http_package.rs
+++ b/src/net/http_package.rs
@@ -12,9 +12,8 @@ use std::{collections::HashMap, path::Path};
use tar::Archive;
use tokio::{fs::File, io::AsyncWriteExt};
-use crate::pkgtoolkit::install::InstallOperations;
use crate::pkgtoolkit::archive::ArchiveOperations;
-
+use crate::pkgtoolkit::install::InstallOperations;
pub struct HTTPPackage {
pub config: Config,
@@ -278,7 +277,7 @@ impl HTTPPackage {
// Install the package
log::info!("Installing package '{}'...", package_name);
let mut package = package_info.clone();
-
+
match package.install() {
Ok(_) => {
log::info!("Package '{}' installed successfully.", package_name);
diff --git a/src/net/i2p_package.rs b/src/net/i2p_package.rs
index cebfa34..fed3361 100644
--- a/src/net/i2p_package.rs
+++ b/src/net/i2p_package.rs
@@ -1,5 +1,7 @@
use crate::cfg::config::Config;
use crate::pkgtoolkit::Package;
+use crate::pkgtoolkit::archive::ArchiveOperations;
+use crate::pkgtoolkit::install::InstallOperations;
use flate2::read::GzDecoder;
use futures_util::stream::TryStreamExt;
use indicatif::{ProgressBar, ProgressStyle};
@@ -9,9 +11,6 @@ use std::fs::File as StdFile;
use std::{collections::HashMap, path::Path};
use tar::Archive;
use tokio::{fs::File, io::AsyncWriteExt};
-use crate::pkgtoolkit::archive::ArchiveOperations;
-use crate::pkgtoolkit::install::InstallOperations;
-
pub struct I2PPackage {
pub config: Config,
@@ -44,9 +43,7 @@ impl I2PPackage {
fn create_proxy_client(&self) -> Result<reqwest::Client, Box<dyn std::error::Error>> {
let proxy_url = format!("http://127.0.0.1:{}", self.config.repo.i2p_http_proxy_port);
let proxy = reqwest::Proxy::http(&proxy_url)?;
- let client = reqwest::Client::builder()
- .proxy(proxy)
- .build()?;
+ let client = reqwest::Client::builder().proxy(proxy).build()?;
Ok(client)
}
@@ -182,7 +179,6 @@ impl I2PPackage {
file_path: &Path,
description: &str,
) -> Result<(), Box<dyn std::error::Error>> {
-
let head_response = client.head(url).send().await?;
let content_length: u64 = head_response
.headers()
@@ -275,7 +271,7 @@ impl I2PPackage {
// Install the package
log::info!("Installing package '{}'...", package_name);
let mut package = package_info.clone();
-
+
match package.install() {
Ok(_) => {
log::info!("Package '{}' installed successfully.", package_name);