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: add missing features to embedded server (ignored_urls, chinese_mirror, cloud proxy, FD limit)

Louis Beaumont7502c918a640
diff --git a/screenpipe-app-tauri/app/page.tsx b/screenpipe-app-tauri/app/page.tsx
index 9889db471..c33aae904 100644
--- a/screenpipe-app-tauri/app/page.tsx
+++ b/screenpipe-app-tauri/app/page.tsx
@@ -13,6 +13,7 @@ import { useHealthCheck } from "@/lib/hooks/use-health-check";
import { commands } from "@/lib/utils/tauri";
import localforage from "localforage";
import { LoginDialog } from "../components/login-dialog";
+import { UpdateDialog, useUpdateListener } from "../components/update-dialog";
import { ModelDownloadTracker } from "../components/model-download-tracker";
import Timeline from "@/components/rewind/timeline";
import { Button } from "@/components/ui/button";
@@ -30,6 +31,9 @@ export default function Home() {
const { isMac } = usePlatform();
const [isRestarting, setIsRestarting] = useState(false);
const isProcessingRef = useRef(false);
+
+ // Listen for update events from Rust
+ useUpdateListener();
// Load onboarding status on mount
useEffect(() => {
@@ -138,6 +142,7 @@ export default function Home() {
<ChangelogDialog />
<BreakingChangesInstructionsDialog />
<LoginDialog />
+ <UpdateDialog />
<ModelDownloadTracker />
{!isServerDown ? (
<div className="w-full scrollbar-hide bg-background relative">
diff --git a/screenpipe-app-tauri/components/update-dialog.tsx b/screenpipe-app-tauri/components/update-dialog.tsx
new file mode 100644
index 000000000..587a76889
--- /dev/null
+++ b/screenpipe-app-tauri/components/update-dialog.tsx
@@ -0,0 +1,147 @@
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Download, Sparkles, Clock } from "lucide-react";
+import { create } from "zustand";
+import { useEffect } from "react";
+import { listen } from "@tauri-apps/api/event";
+import { relaunch } from "@tauri-apps/plugin-process";
+import { useToast } from "@/components/ui/use-toast";
+
+interface UpdateInfo {
+ version: string;
+ body: string;
+}
+
+interface UpdateDialogState {
+ isOpen: boolean;
+ updateInfo: UpdateInfo | null;
+ isInstalling: boolean;
+ setIsOpen: (open: boolean) => void;
+ setUpdateInfo: (info: UpdateInfo | null) => void;
+ setIsInstalling: (installing: boolean) => void;
+}
+
+export const useUpdateDialog = create<UpdateDialogState>((set) => ({
+ isOpen: false,
+ updateInfo: null,
+ isInstalling: false,
+ setIsOpen: (open) => set({ isOpen: open }),
+ setUpdateInfo: (info) => set({ updateInfo: info }),
+ setIsInstalling: (installing) => set({ isInstalling: installing }),
+}));
+
+export function UpdateDialog() {
+ const { isOpen, setIsOpen, updateInfo, isInstalling, setIsInstalling } = useUpdateDialog();
+ const { toast } = useToast();
+
+ const handleUpdate = async () => {
+ setIsInstalling(true);
+ toast({
+ title: "installing update...",
+ description: "screenpipe will restart automatically",
+ duration: 10000,
+ });
+
+ // The update is already downloaded on macOS/Linux
+ // Trigger restart to apply it
+ try {
+ await relaunch();
+ } catch (error) {
+ console.error("failed to relaunch:", error);
+ setIsInstalling(false);
+ toast({
+ title: "update failed",
+ description: "please try again or download manually",
+ variant: "destructive",
+ });
+ }
+ };
+
+ const handleLater = () => {
+ setIsOpen(false);
+ toast({
+ title: "update available",
+ description: "click the tray icon to update when ready",
+ duration: 5000,
+ });
+ };
+
+ return (
+ <Dialog open={isOpen} onOpenChange={setIsOpen}>
+ <DialogContent className="max-w-md">
+ <DialogHeader>
+ <DialogTitle className="flex items-center gap-2">
+ <Sparkles className="h-5 w-5 text-primary" />
+ update available
+ </DialogTitle>
+ <DialogDescription>
+ screenpipe {updateInfo?.version} is ready to install
+ </DialogDescription>
+ </DialogHeader>
+
+ {updateInfo?.body && (
+ <div className="max-h-48 overflow-y-auto rounded-md bg-muted p-3 text-sm">
+ <p className="font-medium mb-2">what's new:</p>
+ <p className="text-muted-foreground whitespace-pre-wrap">
+ {updateInfo.body.slice(0, 500)}
+ {updateInfo.body.length > 500 && "..."}
+ </p>
+ </div>
+ )}
+
+ <div className="flex gap-2 justify-end pt-2">
+ <Button
+ variant="ghost"
+ onClick={handleLater}
+ disabled={isInstalling}
+ className="gap-2"
+ >
+ <Clock className="h-4 w-4" />
+ later
+ </Button>
+ <Button
+ onClick={handleUpdate}
+ disabled={isInstalling}
+ className="gap-2"
+ >
+ <Download className="h-4 w-4" />
+ {isInstalling ? "installing..." : "update now"}
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+// Hook to listen for update events from Rust
+export function useUpdateListener() {
+ const { setIsOpen, setUpdateInfo } = useUpdateDialog();
+
+ useEffect(() => {
+ const setupListeners = async () => {
+ // Listen for update available event
+ const unlistenAvailable = await listen<UpdateInfo>("update-available", (event) => {
+ setUpdateInfo(event.payload);
+ setIsOpen(true);
+ });
+
+ // Listen for tray menu click
+ const unlistenClick = await listen("update-now-clicked", () => {
+ setIsOpen(true);
+ });
+
+ return () => {
+ unlistenAvailable();
+ unlistenClick();
+ };
+ };
+
+ setupListeners();
+ }, [setIsOpen, setUpdateInfo]);
+}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 88a55b281..245a88d60 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -8612,7 +8612,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.220"
+version = "2.0.221"
dependencies = [
"anyhow",
"async-stream",
@@ -8692,7 +8692,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"anyhow",
"bytemuck",
@@ -8740,7 +8740,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -8791,7 +8791,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"anyhow",
"chrono",
@@ -8815,7 +8815,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"anyhow",
"chrono",
@@ -8831,7 +8831,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"anyhow",
"image 0.25.5",
@@ -8846,7 +8846,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"anyhow",
"async-trait",
@@ -8910,7 +8910,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.14"
+version = "0.3.15"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/screenpipe-app-tauri/src-tauri/src/embedded_server.rs b/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
index 5bc42fa8c..d8e961016 100644
--- a/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
+++ b/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
@@ -40,6 +40,7 @@ pub struct EmbeddedServerConfig {
pub audio_devices: Vec<String>,
pub ignored_windows: Vec<String>,
pub included_windows: Vec<String>,
+ pub ignored_urls: Vec<String>,
pub languages: Vec<String>,
pub vad_sensitivity: String,
pub deepgram_api_key: Option<String>,
@@ -47,6 +48,8 @@ pub struct EmbeddedServerConfig {
pub analytics_enabled: bool,
pub enable_ui_events: bool,
pub use_all_monitors: bool,
+ pub use_chinese_mirror: bool,
+ pub user_id: Option<String>,
}
impl EmbeddedServerConfig {
@@ -86,6 +89,13 @@ impl EmbeddedServerConfig {
analytics_enabled: store.analytics_enabled,
enable_ui_events: store.enable_ui_events,
use_all_monitors: store.use_all_monitors,
+ use_chinese_mirror: store.use_chinese_mirror,
+ ignored_urls: store.ignored_urls.clone(),
+ user_id: if store.user.id.is_some() && !store.user.id.as_ref().unwrap().is_empty() {
+ store.user.id.clone()
+ } else {
+ None
+ },
}
}
}
@@ -192,6 +202,26 @@ pub async fn start_embedded_server(
) -> Result<EmbeddedServerHandle, String> {
info!("Starting embedded screenpipe server on port {}", config.port);
+ // Set environment variables for compatibility with CLI behavior
+ // File descriptor limit to prevent "Too many open files" errors
+ std::env::set_var("SCREENPIPE_FD_LIMIT", "8192");
+
+ // Chinese HuggingFace mirror
+ if config.use_chinese_mirror {
+ std::env::set_var("HF_ENDPOINT", "https://hf-mirror.com");
+ info!("Using Chinese HuggingFace mirror");
+ }
+
+ // Screenpipe cloud proxy for deepgram
+ if config.audio_transcription_engine == "screenpipe-cloud" {
+ if let Some(ref user_id) = config.user_id {
+ std::env::set_var("DEEPGRAM_API_URL", "https://api.screenpi.pe/v1/listen");
+ std::env::set_var("DEEPGRAM_WEBSOCKET_URL", "wss://api.screenpi.pe");
+ std::env::set_var("CUSTOM_DEEPGRAM_API_TOKEN", user_id);
+ info!("Using screenpipe cloud for audio transcription");
+ }
+ }
+
let local_data_dir = config.data_dir.clone();
// Create data directory
@@ -291,6 +321,7 @@ pub async fn start_embedded_server(
let use_pii_removal = config.use_pii_removal;
let ignored_windows = config.ignored_windows.clone();
let included_windows = config.included_windows.clone();
+ let ignored_urls = config.ignored_urls.clone();
let languages_clone = languages.clone();
if config.use_all_monitors {
@@ -305,7 +336,7 @@ pub async fn start_embedded_server(
use_pii_removal,
ignored_windows,
included_windows,
- ignored_urls: vec![],
+ ignored_urls,
languages: languages_clone,
capture_unfocused_windows: false,
realtime_vision: false,
@@ -381,7 +412,7 @@ pub async fn start_embedded_server(
&vision_handle,
&ignored_windows,
&included_windows,
- &[],
+ &ignored_urls,
languages_clone.clone(),
false,
false,
diff --git a/screenpipe-app-tauri/src-tauri/src/updates.rs b/screenpipe-app-tauri/src-tauri/src/updates.rs
index 3aebebfc5..1959d0f89 100644
--- a/screenpipe-app-tauri/src-tauri/src/updates.rs
+++ b/screenpipe-app-tauri/src-tauri/src/updates.rs
@@ -3,6 +3,7 @@ use crate::SidecarState;
use anyhow::Error;
use dark_light::Mode;
use log::{error, info};
+use serde_json;
use std::sync::Arc;
use std::time::Duration;
use tauri::menu::{MenuItem, MenuItemBuilder};
@@ -122,6 +123,15 @@ impl UpdatesManager {
self.update_menu_item.set_text("update now")?;
}
+ // Emit event to frontend for custom update dialog
+ let update_info = serde_json::json!({
+ "version": update.version,
+ "body": update.body.clone().unwrap_or_default()
+ });
+ if let Err(e) = self.app.emit("update-available", update_info) {
+ error!("Failed to emit update-available event: {}", e);
+ }
+
if show_dialog {
let (tx, rx) = oneshot::channel();
let update_dialog = self
diff --git a/screenpipe-app-tauri/src-tauri/tauri.beta.conf.json b/screenpipe-app-tauri/src-tauri/tauri.beta.conf.json
index 25b8619f7..8c6d0312d 100644
--- a/screenpipe-app-tauri/src-tauri/tauri.beta.conf.json
+++ b/screenpipe-app-tauri/src-tauri/tauri.beta.conf.json
@@ -46,7 +46,7 @@
"plugins": {
"updater": {
"active": true,
- "dialog": true,
+ "dialog": false,
"endpoints": [
"https://cdn.crabnebula.app/update/mediar/screenpipe-beta/{{target}}-{{arch}}/{{current_version}}"
],