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

fix(auth): seed api_auth_key on the app auto-start path too

Louis Beaumont608ce9e82041
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 2b516d4a9..bf6a7d4a1 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9725,7 +9725,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.4.1"
+version = "2.4.2"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index acef7fe1b..a40e1ea84 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.4.1"
+version = "2.4.2"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 6e563ac54..71e61c3a1 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1466,6 +1466,27 @@ async fn main() {
.expect("Failed to create server runtime");
server_runtime.block_on(async move {
+ // Resolve + seed the shared api_auth_key cache before building
+ // the config. `to_recording_config` is sync and reads the
+ // cache; without this step the server would start with
+ // `api_auth_key = None` on the app-auto-start path and every
+ // request would 403. Mirrors the path in `spawn_screenpipe`.
+ if store_clone.recording.api_auth {
+ let settings_key_opt = if store_clone.recording.api_key.is_empty() {
+ None
+ } else {
+ Some(store_clone.recording.api_key.clone())
+ };
+ match screenpipe_engine::auth_key::resolve_api_auth_key(
+ &data_dir_clone,
+ settings_key_opt.as_deref(),
+ )
+ .await
+ {
+ Ok(key) => crate::store::seed_api_auth_key(key),
+ Err(e) => tracing::error!("failed to resolve api auth key: {}", e),
+ }
+ }
let config = store_clone.to_recording_config(data_dir_clone.clone());
// Check if server already running