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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(auth): reuse startup authentication for recording access (#6838)
Ezra Ellette108546ca6f56
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex 8849f30d2..1b2763026 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -1880,7 +1880,7 @@ async fn main() {}let store_clone = store.clone();let data_dir_clone = data_dir.clone();- if !crate::recording::server_access_allowed(&store_clone) {+ if !crate::recording::server_access_allowed(&app_handle, &store_clone) {info!("Skipping server auto-start: screenpipe account access required");crate::health::set_recording_status(crate::health::RecordingStatus::Paused);let _ = app_handle.emit("app-entitlement-required", ());diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rsindex bd5b33683..f162e2aa1 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs@@ -170,7 +170,22 @@ fn server_access_policy(has_verified_local_plan}-pub(crate) fn server_access_allowed(store: &SettingsStore) -> bool {+pub(crate) fn server_access_allowed(app: &tauri::AppHandle, store: &SettingsStore) -> bool {+ let startup_authentication = app+ .try_state::<crate::startup_auth::AuthenticationStatus>()+ .map(|status| *status)+ .unwrap_or(crate::startup_auth::AuthenticationStatus::LoggedOut);+ let authenticated_after_startup = if cfg!(feature = "enterprise-build") {+ crate::enterprise_policy::recording_authorized()+ } else {+ store.has_cloud_authentication()+ };+ if startup_authentication == crate::startup_auth::AuthenticationStatus::LoggedOut+ && !authenticated_after_startup+ {+ return false;+ }+server_access_policy(cfg!(feature = "enterprise-build"),cfg!(debug_assertions),@@ -230,8 +245,8 @@ fn require_recording_access(app: &tauri::AppHandle, store: &SettingsStore) -> ReErr("account_required: sign in to start screenpipe recording".to_string())}-fn require_server_access(store: &SettingsStore) -> Result<(), String> {- if server_access_allowed(store) {+fn require_server_access(app: &tauri::AppHandle, store: &SettingsStore) -> Result<(), String> {+ if server_access_allowed(app, store) {return Ok(());}@@ -938,7 +953,7 @@ pub async fn spawn_screenpipe(// A summary-paywall install still needs the long-lived local read server// for Timeline, but it must not publish capture intent or restart capture.let store = SettingsStore::get(&app).ok().flatten().unwrap_or_default();- require_server_access(&store)?;+ require_server_access(&app, &store)?;let capture_allowed = recording_access_allowed(&app, &store);// Normal starts publish capture intent before touching lifecycle state.@@ -1023,7 +1038,7 @@ async fn spawn_screenpipe_inner(}let store = SettingsStore::get(&app).ok().flatten().unwrap_or_default();- if let Err(err) = require_server_access(&store) {+ if let Err(err) = require_server_access(&app, &store) {state.is_starting.store(false, Ordering::SeqCst);state.is_starting_capture.store(false, Ordering::SeqCst);return Err(err);