diff --git a/src/rpc/server.rs b/src/rpc/server.rs index e71b34e..32a68cd 100644 --- a/src/rpc/server.rs +++ b/src/rpc/server.rs @@ -1,7 +1,7 @@ use super::data::*; use crate::api as api_root; use crate::websdk::cloud_rules::cloud_rules::CloudRules; -use crate::websdk::repo::api; +use crate::websdk::repo::{api, provider::github}; use jsonrpsee::server::{RpcModule, Server, ServerHandle}; use jsonrpsee::types::{ErrorCode, ErrorObjectOwned}; use std::net::SocketAddr; @@ -237,7 +237,7 @@ mod tests { .await; let id_map = BTreeMap::from([("owner", "DUpdateSystem"), ("repo", "UpgradeAll")]); - let proxy_url = format!("{} -> {}", "https://github.com", server.url()); + let proxy_url = format!("{} -> {}", github::GITHUB_API_URL, server.url()); let hub_data = BTreeMap::from([("reverse_proxy", proxy_url.as_str())]); let (url, handle) = run_server("", Arc::new(AtomicBool::new(true))) @@ -269,7 +269,7 @@ mod tests { .create(); let id_map = BTreeMap::from([("owner", "DUpdateSystem"), ("repo", "UpgradeAll")]); - let proxy_url = format!("{} -> {}", "https://api.github.com", server.url()); + let proxy_url = format!("{} -> {}", github::GITHUB_API_URL, server.url()); let hub_data = BTreeMap::from([("reverse_proxy", proxy_url.as_str())]); let (url, handle) = run_server("", Arc::new(AtomicBool::new(true))) @@ -302,7 +302,7 @@ mod tests { .create(); let id_map = BTreeMap::from([("owner", "DUpdateSystem"), ("repo", "UpgradeAll")]); - let proxy_url = format!("{} -> {}", "https://api.github.com", server.url()); + let proxy_url = format!("{} -> {}", github::GITHUB_API_URL, server.url()); let hub_data = BTreeMap::from([("reverse_proxy", proxy_url.as_str())]); let (url, handle) = run_server("", Arc::new(AtomicBool::new(true))) @@ -377,7 +377,7 @@ mod tests { .unwrap(); println!("Server started at {}", url); let client = HttpClientBuilder::default().build(url).unwrap(); - let url = server.url() + "/cloud_config.json"; + let url = format!("{}/cloud_config.json", server.url()); let params = RpcCloudConfigRequest { api_url: &url }; println!("{:?}", params); let response: Result = client.request("get_cloud_config", params).await; diff --git a/src/websdk/repo.rs b/src/websdk/repo.rs index b399118..d10139d 100644 --- a/src/websdk/repo.rs +++ b/src/websdk/repo.rs @@ -1,3 +1,3 @@ pub mod api; pub mod data; -mod provider; +pub mod provider; diff --git a/src/websdk/repo/provider/fdroid.rs b/src/websdk/repo/provider/fdroid.rs index 6fd42d6..ff786fd 100644 --- a/src/websdk/repo/provider/fdroid.rs +++ b/src/websdk/repo/provider/fdroid.rs @@ -20,7 +20,7 @@ impl FDroidProvider { } pub fn get_api_url(url: &str) -> String { - format!("{}/{}", url, "repo/index.xml") + format!("{}/repo/index.xml", url) } fn get_urls(data_map: &DataMap) -> (String, String) { diff --git a/src/websdk/repo/provider/github.rs b/src/websdk/repo/provider/github.rs index 277d320..8a92341 100644 --- a/src/websdk/repo/provider/github.rs +++ b/src/websdk/repo/provider/github.rs @@ -11,7 +11,7 @@ use crate::utils::{ versioning::Version, }; -const GITHUB_API_URL: &str = "https://api.github.com"; +pub const GITHUB_API_URL: &str = "https://api.github.com"; const GITHUB_URL: &str = "https://github.com"; const VERSION_NUMBER_KEY: &str = "version_number_key";