Skip to content

Commit

Permalink
refactor: improve readability of string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech authored and xz-dev committed Oct 28, 2024
1 parent 177673f commit a7dca62
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/rpc/server.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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<ConfigList, _> = client.request("get_cloud_config", params).await;
Expand Down
2 changes: 1 addition & 1 deletion src/websdk/repo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod api;
pub mod data;
mod provider;
pub mod provider;
2 changes: 1 addition & 1 deletion src/websdk/repo/provider/fdroid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/websdk/repo/provider/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit a7dca62

Please sign in to comment.