Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

release-app fix tray menu change for windows when unhealthy

Louis Beaumont973776d2b32b
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index 5eb77fde3..1635eee0c 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -232,6 +232,7 @@ const PipeStore: React.FC = () => {
const { getDataDir } = useSettings();
const { user, refreshUser } = useUser();
const [showCreditDialog, setShowCreditDialog] = useState(false);
+ const [isEnabling, setIsEnabling] = useState(false);
useEffect(() => {
fetchInstalledPipes();
@@ -399,6 +400,11 @@ const PipeStore: React.FC = () => {
const handleToggleEnabled = async (pipe: Pipe) => {
try {
+ // Set loading state when enabling
+ if (!pipe.enabled) {
+ setIsEnabling(true);
+ }
+
const corePipe = corePipes.find((cp) => cp.id === pipe.id);
console.log("attempting to toggle pipe:", {
pipeId: pipe.id,
@@ -498,7 +504,8 @@ const PipeStore: React.FC = () => {
throw new Error(data.error);
}
- await new Promise((resolve) => setTimeout(resolve, 1000));
+ // Wait for pipe to initialize
+ await new Promise((resolve) => setTimeout(resolve, 3000));
const freshPipes = await fetchInstalledPipes();
await new Promise((resolve) => setTimeout(resolve, 1000));
@@ -520,6 +527,9 @@ const PipeStore: React.FC = () => {
description: "please try again or check the logs for more information.",
variant: "destructive",
});
+ } finally {
+ // Reset loading state
+ setIsEnabling(false);
}
};
@@ -969,9 +979,10 @@ const PipeStore: React.FC = () => {
`http://localhost:${selectedPipe.config!.port}`
)
}
+ disabled={isEnabling}
>
<ExternalLink className="mr-2 h-3.5 w-3.5" />
- open in browser
+ {isEnabling ? "initializing..." : "open in browser"}
</Button>
<Button
variant="default"
@@ -990,9 +1001,10 @@ const PipeStore: React.FC = () => {
});
}
}}
+ disabled={isEnabling}
>
<Puzzle className="mr-2 h-3.5 w-3.5" />
- open as app
+ {isEnabling ? "initializing..." : "open as app"}
</Button>
</div>
</div>
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index e7de40542..5c14581a6 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -3794,9 +3794,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.19.0"
+version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "open"
@@ -4966,7 +4966,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.22.6"
+version = "0.22.8"
dependencies = [
"anyhow",
"axum",
@@ -4982,6 +4982,7 @@ dependencies = [
"log",
"nokhwa-bindings-macos",
"objc",
+ "once_cell",
"reqwest",
"scap",
"serde",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index bdd667189..61345ad62 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.22.8"
+version = "0.22.9"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/health.rs b/screenpipe-app-tauri/src-tauri/src/health.rs
index 9c289d4d1..6e47b64aa 100644
--- a/screenpipe-app-tauri/src-tauri/src/health.rs
+++ b/screenpipe-app-tauri/src-tauri/src/health.rs
@@ -81,6 +81,7 @@ async fn check_health(client: &reqwest::Client) -> Result<HealthCheckResponse> {
.get("http://localhost:3030/health")
.header("Cache-Control", "no-cache")
.header("Pragma", "no-cache")
+ .timeout(Duration::from_secs(5)) // on windows it never times out
.send()
.await?;
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 7077767ec..580bf75dc 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -881,16 +881,13 @@ async fn main() {
let server_shutdown_tx = spawn_server(app.handle().clone(), 11435);
app.manage(server_shutdown_tx);
- // Start health check service, only on macos since it's crashing on windows
- #[cfg(target_os = "macos")]
- {
- let app_handle = app.handle().clone();
- tauri::async_runtime::spawn(async move {
- if let Err(e) = start_health_check(app_handle).await {
- error!("Failed to start health check service: {}", e);
- }
- });
- }
+ // Start health check service
+ let app_handle = app.handle().clone();
+ tauri::async_runtime::spawn(async move {
+ if let Err(e) = start_health_check(app_handle).await {
+ error!("Failed to start health check service: {}", e);
+ }
+ });
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Regular);