fix(extension): make bridge health check reliable

This commit is contained in:
NimBold
2026-06-18 18:07:55 +03:30
parent 94628b865f
commit 34fcdcc04a
2 changed files with 3 additions and 9 deletions
+2 -8
View File
@@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use sha2::Sha256;
use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex, RwLock};
use std::time::{SystemTime, UNIX_EPOCH};
use tauri::{AppHandle, Emitter, Manager};
@@ -34,7 +34,6 @@ type ReplayCache = Arc<Mutex<HashMap<String, u64>>>;
pub struct ServerState {
pub app_handle: AppHandle,
pub pairing_token: SharedExtensionToken,
pub frontend_ready: SharedFrontendReady,
pub replay_cache: ReplayCache,
}
@@ -67,13 +66,12 @@ pub struct ExtensionDownload {
pub async fn start_server(
app_handle: AppHandle,
pairing_token: SharedExtensionToken,
frontend_ready: SharedFrontendReady,
_frontend_ready: SharedFrontendReady,
mut shutdown_rx: watch::Receiver<bool>,
) -> Result<(), String> {
let state = ServerState {
app_handle,
pairing_token,
frontend_ready,
replay_cache: Arc::new(Mutex::new(HashMap::new())),
};
@@ -131,10 +129,6 @@ async fn ping_handler(
headers: HeaderMap,
body: Bytes,
) -> StatusCode {
if !state.frontend_ready.load(Ordering::Acquire) {
return StatusCode::SERVICE_UNAVAILABLE;
}
let signature = match headers
.get("x-firelink-signature")
.and_then(|v| v.to_str().ok())
+1 -1
View File
@@ -922,7 +922,7 @@ export default function SettingsView() {
<div className="border border-border-modal/70 rounded-lg p-3 bg-item-hover/10 flex justify-between items-center text-[12px]">
<span className="text-text-secondary font-medium">Extension Server Status:</span>
<span className="text-green-500 font-semibold flex items-center gap-1">
Listening on 127.0.0.1:23522 (Active)
Listening on 127.0.0.1:6412-6422 (Active)
</span>
</div>
</div>