An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: update OAuthClient::new() signature to accept base_url parameter

OAuthClient now receives the base URL from the caller (AppState.relay_client().base_url_str()) instead of hardcoding it via RelayClient::base_url().

- Add base_url parameter to OAuthClient::new()
- Update call site in load_home_data() to pass state.relay_client().base_url_str()
- Rename check_relay_health() to ping_relay_health() for clarity
- Pass relay_client to ping_relay_health() instead of creating new client
- Update all call sites to use ping_relay_health(state.relay_client())

authored by

Malpercio and committed by
Tangled
e436a5ab 72e6e90a

+13 -11
+11 -9
apps/identity-wallet/src-tauri/src/home.rs
··· 69 69 }; 70 70 71 71 let Some(session) = session_opt else { 72 - let relay_healthy = check_relay_health().await; 72 + let relay_healthy = ping_relay_health(state.relay_client()).await; 73 73 return Ok(HomeData { 74 74 relay_healthy, 75 75 session: None, ··· 80 80 81 81 let session_arc = Arc::new(Mutex::new(session)); 82 82 83 - let oauth_client = match crate::oauth_client::OAuthClient::new(session_arc.clone()) { 83 + let oauth_client = match crate::oauth_client::OAuthClient::new( 84 + session_arc.clone(), 85 + state.relay_client().base_url_str().to_owned(), 86 + ) { 84 87 Ok(c) => c, 85 88 Err(e) => { 86 89 tracing::error!(error = %e, "OAuthClient construction failed"); 87 90 return Ok(HomeData { 88 - relay_healthy: check_relay_health().await, 91 + relay_healthy: ping_relay_health(state.relay_client()).await, 89 92 session: None, 90 93 session_error: Some(oauth_error_code(&e)), 91 94 share1_in_keychain, ··· 94 97 }; 95 98 96 99 let (relay_healthy, session_result) = tokio::join!( 97 - check_relay_health(), 100 + ping_relay_health(state.relay_client()), 98 101 oauth_client.get("/xrpc/com.atproto.server.getSession"), 99 102 ); 100 103 ··· 159 162 160 163 // ── Private helpers ─────────────────────────────────────────────────────── 161 164 162 - /// Creates a new RelayClient on each call. Acceptable because load_home_data 163 - /// is invoked at most once per user-initiated home screen refresh; the cost is 164 - /// not significant at this call frequency. 165 - async fn check_relay_health() -> bool { 166 - crate::http::RelayClient::new() 165 + /// Ping the relay health endpoint. Named to avoid ambiguity with any future 166 + /// public IPC commands. 167 + async fn ping_relay_health(relay_client: &crate::http::RelayClient) -> bool { 168 + relay_client 167 169 .get("/xrpc/_health") 168 170 .await 169 171 .map(|r| r.status().is_success())
+2 -2
apps/identity-wallet/src-tauri/src/oauth_client.rs
··· 34 34 /// `Client::new()` inherits the TLS backend configured at the crate level via Cargo features 35 35 /// (`default-features = false, features = ["rustls-tls"]` in Cargo.toml). No builder 36 36 /// configuration is needed — the feature flags apply crate-wide, not per-client-instance. 37 - pub fn new(session: Arc<Mutex<OAuthSession>>) -> Result<Self, OAuthError> { 37 + pub fn new(session: Arc<Mutex<OAuthSession>>, base_url: String) -> Result<Self, OAuthError> { 38 38 let dpop = DPoPKeypair::get_or_create()?; 39 39 Ok(Self { 40 40 inner: Client::new(), 41 41 dpop, 42 42 session, 43 - base_url: crate::http::RelayClient::base_url().to_string(), 43 + base_url, 44 44 }) 45 45 } 46 46