From e797d3f7256214f3ca08b3d67c1aab847e1ea9d9 Mon Sep 17 00:00:00 2001 From: tavo Date: Thu, 6 May 2021 17:05:38 +0300 Subject: [PATCH 1/2] Update dependencies --- Cargo.toml | 4 ++-- src/server/controller.rs | 10 +++++----- src/sync/sync.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 389b17b..10fdd58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ serde_json = "1.0.44" toml = "0.5.7" regex = "1" lazy_static = "1.4.0" -reqwest = { version = "0.10.9", features = ["json"] } -tokio = { version = "0.2", features = ["full"] } +reqwest = { version = "0.11", features = ["json"] } +tokio = { version = "1.5", features = ["full"] } log = "0.4.14" [dependencies.rocket_contrib] diff --git a/src/server/controller.rs b/src/server/controller.rs index a509328..5c7748f 100644 --- a/src/server/controller.rs +++ b/src/server/controller.rs @@ -14,21 +14,21 @@ pub fn repo(provider: String, user: String, repo: String) -> JsonValue { #[post("/repositories", data="")] pub fn add_repo(repo: Json) -> JsonValue { - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); let response = rt.block_on(repo_manager::add_repo(repo.into_inner())); rocket_contrib::json!(&response) } #[get("/repositories/sync-all")] pub fn sync_all() -> JsonValue { - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); let response = rt.block_on(sync::sync_all()); rocket_contrib::json!(&response) } #[get("/repositories////sync")] pub fn sync_repo(provider: String, user: String, repo: String) -> JsonValue { - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); let response = rt.block_on(sync::sync_repo(&provider, &user, &repo)); rocket_contrib::json!(&response) } @@ -42,7 +42,7 @@ pub fn post_sync_repo(provider: String, user: String, repo: String) -> JsonValue pub fn sync_repo_github(dto: Json) -> JsonValue { let dto = dto.into_inner(); let (provider, user, repo) = generate_credentials_from_clone_url(&dto.repository.ssh_url); - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(sync::sync_repo(&provider, &user, &repo)); rocket_contrib::json!({}) } @@ -51,7 +51,7 @@ pub fn sync_repo_github(dto: Json) -> JsonValue { pub fn sync_repo_gitlab(dto: Json) -> JsonValue { let dto = dto.into_inner(); let (provider, user, repo) = generate_credentials_from_clone_url(&dto.repository.git_ssh_url); - let mut rt = tokio::runtime::Runtime::new().unwrap(); + let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(sync::sync_repo(&provider, &user, &repo)); rocket_contrib::json!({}) } diff --git a/src/sync/sync.rs b/src/sync/sync.rs index 72b02ea..9fe70a5 100644 --- a/src/sync/sync.rs +++ b/src/sync/sync.rs @@ -131,7 +131,7 @@ async fn fetch_synced_hashes( api_key: &str, ) -> Result { let (provider, user, repo) = generate_credentials_from_clone_url(&repo.url); - let url = format!("{}/api/commits/{}/{}/{}/hash", target_host, provider, user, repo); + let url = format!("{}/api/commits/hash?provider={}&user={}&repo={}", target_host, provider, user, repo); return Ok(client.get(&url) .header("API-key", api_key) From 5419a507254fe3a42790db94f2ea9c07cb70bc18 Mon Sep 17 00:00:00 2001 From: tavo Date: Fri, 7 May 2021 09:54:13 +0300 Subject: [PATCH 2/2] Bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 10fdd58..baa83cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gtm-sync" -version = "0.1.0" +version = "0.1.4" authors = ["tavo "] edition = "2018"