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: build

Louis Beaumontb4fb1ce0a099
diff --git a/screenpipe-app-tauri/components/header.tsx b/screenpipe-app-tauri/components/header.tsx
index e9e4ac64c..9474456c2 100644
--- a/screenpipe-app-tauri/components/header.tsx
+++ b/screenpipe-app-tauri/components/header.tsx
@@ -162,9 +162,6 @@ export default function Header() {
<Search className="mr-2 h-4 w-4" />
<span>search</span>
</DropdownMenuItem>
- <DropdownMenuItem className="cursor-pointer p-0">
- <MeetingHistory />
- </DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"
onClick={handleShowTimeline}
diff --git a/screenpipe-app-tauri/components/meeting-history.tsx b/screenpipe-app-tauri/components/meeting-history.tsx
index 6b6b7a6f3..6eb11f753 100644
--- a/screenpipe-app-tauri/components/meeting-history.tsx
+++ b/screenpipe-app-tauri/components/meeting-history.tsx
@@ -47,6 +47,7 @@ import {
} from "@/components/ui/card";
import { ValueOf } from "next/dist/shared/lib/constants";
import { Checkbox } from "./ui/checkbox";
+import { useHealthCheck } from "@/lib/hooks/use-health-check";
function formatDate(date: string): string {
const dateObj = new Date(date);
@@ -142,6 +143,7 @@ export default function MeetingHistory() {
const [customIdentifyPrompt, setCustomIdentifyPrompt] = useState<string>(
"please identify the participants in this meeting transcript. provide a comma-separated list of one or two word names or roles or characteristics. if it's not possible to identify, respond with n/a."
);
+ const { health } = useHealthCheck();
useEffect(() => {
if (posthog) {
@@ -664,6 +666,7 @@ export default function MeetingHistory() {
<Button
variant="ghost"
className="pl-2"
+ disabled={!health || health.status === "error"}
onClick={(e) => {
e.stopPropagation();
setIsOpen(true);
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index f2608ddb2..1eef46dec 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -185,10 +185,18 @@ const PipeStore: React.FC = () => {
const dataDir = await getDataDir();
try {
- const response = await fetch("http://localhost:3030/pipes/list");
- if (!response.ok) throw new Error("failed to fetch installed pipes");
-
- const data = (await response.json()).data;
+ const cmd = Command.sidecar("screenpipe", [
+ "pipe",
+ "list",
+ "--output",
+ "json",
+ ]);
+ const output = await cmd.execute();
+ const response = JSON.parse(output.stdout);
+
+ if (!response.success) throw new Error("Failed to fetch installed pipes");
+
+ const data = response.data;
for (const pipe of data) {
const pathToReadme = await join(dataDir, "pipes", pipe.id, "README.md");
try {
@@ -221,17 +229,19 @@ const PipeStore: React.FC = () => {
description: "please wait...",
});
- const response = await fetch(`http://localhost:3030/pipes/download`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ url }),
- });
- if (!response.ok) {
- throw new Error("failed to download pipe");
+ const cmd = Command.sidecar("screenpipe", [
+ "pipe",
+ "download",
+ url,
+ "--output",
+ "json",
+ ]);
+ const output = await cmd.execute();
+ const response = JSON.parse(output.stdout);
+
+ if (!response.success) {
+ throw new Error(response.error || "Failed to download pipe");
}
- await response.json();
toast({
title: "pipe downloaded",
@@ -265,19 +275,12 @@ const PipeStore: React.FC = () => {
enabled: !pipe.enabled,
});
- const endpoint = pipe.enabled ? "disable" : "enable";
- const response = await fetch(`http://localhost:3030/pipes/${endpoint}`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ pipe_id: pipe.id }),
- });
-
- if (!response.ok) throw new Error(`failed to ${endpoint} pipe`);
+ const action = pipe.enabled ? "disable" : "enable";
+ const cmd = Command.sidecar("screenpipe", ["pipe", action, pipe.id]);
+ await cmd.execute();
toast({
- title: `${endpoint}ing pipe`,
+ title: `${action}ing pipe`,
description: "this may take a few moments...",
});
@@ -309,19 +312,20 @@ const PipeStore: React.FC = () => {
description: "please wait...",
});
- const response = await fetch(`http://localhost:3030/pipes/download`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ url: newRepoUrl }),
- });
-
- if (!response.ok) {
- throw new Error("failed to download pipe");
+ const cmd = Command.sidecar("screenpipe", [
+ "pipe",
+ "download",
+ newRepoUrl,
+ "--output",
+ "json",
+ ]);
+ const output = await cmd.execute();
+ const response = JSON.parse(output.stdout);
+
+ if (!response.success) {
+ throw new Error(response.error || "Failed to download pipe");
}
- // refresh the pipe list
await fetchInstalledPipes();
toast({
@@ -364,16 +368,15 @@ const PipeStore: React.FC = () => {
const handleConfigSave = async (config: Record<string, any>) => {
if (selectedPipe) {
try {
- const response = await fetch(`http://localhost:3030/pipes/update`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ pipe_id: selectedPipe.id, config }),
- });
- if (!response.ok) {
- throw new Error("failed to update pipe config");
- }
+ const configStr = JSON.stringify(config);
+ const cmd = Command.sidecar("screenpipe", [
+ "pipe",
+ "update",
+ selectedPipe.id,
+ configStr,
+ ]);
+ await cmd.execute();
+
toast({
title: "Configuration saved",
description: "The pipe configuration has been updated.",
@@ -399,17 +402,13 @@ const PipeStore: React.FC = () => {
description: "please wait...",
});
- const response = await fetch(`http://localhost:3030/pipes/delete`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ pipe_id: pipe.id }),
- });
-
- if (!response.ok) {
- throw new Error("failed to delete pipe");
- }
+ const cmd = Command.sidecar("screenpipe", [
+ "pipe",
+ "delete",
+ pipe.id,
+ "--yes",
+ ]);
+ await cmd.execute();
await fetchInstalledPipes();
@@ -844,9 +843,9 @@ const PipeStore: React.FC = () => {
</Button>
</div>
<div className="text-sm text-muted-foreground">
- <a
- href="https://docs.screenpi.pe/docs/plugins"
- target="_blank"
+ <a
+ href="https://docs.screenpi.pe/docs/plugins"
+ target="_blank"
rel="noopener noreferrer"
className="hover:underline flex items-center gap-1"
>
diff --git a/screenpipe-app-tauri/components/screenpipe-status.tsx b/screenpipe-app-tauri/components/screenpipe-status.tsx
index bd6e53150..7fc52fdaa 100644
--- a/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -443,6 +443,60 @@ const HealthStatus = ({ className }: { className?: string }) => {
}
};
+ const handlePermissionButton = async (type: 'screen' | 'audio' | 'accessibility') => {
+ const toastId = toast({
+ title: `checking ${type} permissions`,
+ description: "please wait...",
+ duration: Infinity,
+ });
+
+ try {
+ // Trigger the permission dialog
+ if (type === 'screen') {
+ await invoke("open_screen_capture_preferences");
+ } else if (type === 'audio') {
+ await invoke("trigger_audio_permission");
+ } else {
+ await invoke("open_accessibility_preferences");
+ }
+
+ // Start polling permissions for 30 seconds
+ const permissionResults = await invoke<PermissionsStatus[]>("poll_permissions", {
+ duration_secs: 30
+ });
+
+ // Get the last result
+ const finalStatus = permissionResults[permissionResults.length - 1];
+
+ // Update permissions state
+ setPermissions(finalStatus);
+
+ // Update toast based on result
+ const granted = type === 'screen' ? finalStatus.screen_capture :
+ type === 'audio' ? finalStatus.microphone :
+ finalStatus.accessibility;
+
+ toastId.update({
+ id: toastId.id,
+ title: granted ? "permission granted" : "permission check complete",
+ description: granted ?
+ `${type} permission was successfully granted` :
+ `please try granting ${type} permission again if needed`,
+ duration: 3000,
+ });
+
+ } catch (error) {
+ console.error(`failed to handle ${type} permission:`, error);
+ toastId.update({
+ id: toastId.id,
+ title: "error",
+ description: `failed to handle ${type} permission`,
+ variant: "destructive",
+ duration: 3000,
+ });
+ }
+ };
+
return (
<>
<Badge
@@ -514,7 +568,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
<Button
variant="outline"
className="w-[260px] text-sm justify-start"
- onClick={openScreenPermissions}
+ onClick={() => handlePermissionButton('screen')}
>
<Lock className="h-4 w-4 mr-2" />
grant screen permission
@@ -545,7 +599,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
<Button
variant="outline"
className="w-[260px] text-sm justify-start"
- onClick={() => invoke("trigger_audio_permission")}
+ onClick={() => handlePermissionButton('audio')}
disabled={settings.disableAudio}
>
<Lock className="h-4 w-4 mr-2" />
@@ -575,7 +629,7 @@ const HealthStatus = ({ className }: { className?: string }) => {
<Button
variant="outline"
className="w-[260px] text-sm justify-start"
- onClick={() => invoke("open_accessibility_preferences")}
+ onClick={() => handlePermissionButton('accessibility')}
>
<Lock className="h-4 w-4 mr-2" />
grant accessibility permission
diff --git a/screenpipe-app-tauri/components/search-chat.tsx b/screenpipe-app-tauri/components/search-chat.tsx
index b57543b29..0a6b11d21 100644
--- a/screenpipe-app-tauri/components/search-chat.tsx
+++ b/screenpipe-app-tauri/components/search-chat.tsx
@@ -274,6 +274,12 @@ export function SearchChat({
// Add new state near the top with other state declarations
const [hideDeselected, setHideDeselected] = useState(false);
+ const [currentPlatform, setCurrentPlatform] = useState<string | null>(null);
+
+ useEffect(() => {
+ setCurrentPlatform(platform());
+ }, []);
+
// Update content type when checkboxes change
const handleContentTypeChange = (type: "ocr" | "audio" | "ui") => {
const newTypes = { ...selectedTypes, [type]: !selectedTypes[type] };
@@ -1067,7 +1073,7 @@ export function SearchChat({
</Tooltip>
</TooltipProvider>
</div>
- {platform() === "macos" && (
+ {currentPlatform === "macos" && (
<div className="flex items-center space-x-1">
<Checkbox
id="ui-type"
diff --git a/screenpipe-app-tauri/src-tauri/capabilities/main.json b/screenpipe-app-tauri/src-tauri/capabilities/main.json
index 8ecb966bf..e9449ea1f 100644
--- a/screenpipe-app-tauri/src-tauri/capabilities/main.json
+++ b/screenpipe-app-tauri/src-tauri/capabilities/main.json
@@ -210,6 +210,132 @@
"os:allow-os-type",
"core:path:default",
"process:default",
- "store:default"
+ "store:default",
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-list",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "list",
+ "--output",
+ "json"
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-download",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "download",
+ {
+ "validator": "\\S+"
+ },
+ "--output",
+ "json"
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-enable",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "enable",
+ {
+ "validator": "\\S+"
+ }
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-disable",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "disable",
+ {
+ "validator": "\\S+"
+ }
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-update",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "update",
+ {
+ "validator": "\\S+"
+ },
+ {
+ "validator": "\\{.*\\}"
+ }
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-delete",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "delete",
+ {
+ "validator": "\\S+"
+ },
+ "--yes"
+ ],
+ "sidecar": true
+ }
+ ]
+ },
+ {
+ "identifier": "shell:allow-execute",
+ "allow": [
+ {
+ "name": "screenpipe-pipe-info",
+ "cmd": "screenpipe",
+ "args": [
+ "pipe",
+ "info",
+ {
+ "validator": "\\S+"
+ },
+ "--output",
+ "json"
+ ],
+ "sidecar": true
+ }
+ ]
+ }
]
}
\ No newline at end of file
diff --git a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
index 98464f8b1..39b08ecf1 100644
--- a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
+++ b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
@@ -1 +1 @@
-{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main","timeline","search"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","store:default","store:allow-create-store","store:allow-get","store:allow-set","store:allow-save","store:allow-load","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","purge","-y"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["setup"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["migrate"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","store:default"]}}
\ No newline at end of file
+{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main","timeline","search"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","store:default","store:allow-create-store","store:allow-get","store:allow-set","store:allow-save","store:allow-load","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","purge","-y"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["setup"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["migrate"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","store:default",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]}]}}
\ No newline at end of file
diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rs
index e584a86df..6327242ad 100644
--- a/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -311,7 +311,7 @@ pub async fn open_auth_window(app_handle: tauri::AppHandle<tauri::Wry>) -> Resul
Ok(())
}
-#[derive(Debug, Serialize)]
+#[derive(Debug, Serialize, Clone)]
pub struct PermissionsStatus {
screen_capture: bool,
microphone: bool,
@@ -334,25 +334,40 @@ pub fn trigger_audio_permission() -> Result<(), String> {
use core_foundation::{base::TCFType, string::CFString};
unsafe {
+ // First try to load the AVFoundation framework
+ let framework = libc::dlopen(
+ "/System/Library/Frameworks/AVFoundation.framework/AVFoundation\0".as_ptr() as *const _,
+ libc::RTLD_LAZY,
+ );
+
+ if framework.is_null() {
+ return Err("Could not load AVFoundation framework".to_string());
+ }
+
let av_media_type = CFString::new("avfa"); // Audio media type
- // First check if we can find the function
let func_ptr = libc::dlsym(
- libc::RTLD_DEFAULT,
+ framework,
"AVCaptureDevice_requestAccessForMediaType\0".as_ptr() as *const _,
);
if func_ptr.is_null() {
+ libc::dlclose(framework);
return Err("Could not find AVCaptureDevice API".to_string());
}
let func: extern "C" fn(*const core_foundation::string::__CFString) -> bool =
std::mem::transmute(func_ptr);
- // Call the function with proper error handling
match std::panic::catch_unwind(|| func(av_media_type.as_concrete_TypeRef())) {
- Ok(_) => Ok(()),
- Err(_) => Err("Failed to request audio permission".to_string()),
+ Ok(_) => {
+ libc::dlclose(framework);
+ Ok(())
+ }
+ Err(_) => {
+ libc::dlclose(framework);
+ Err("Failed to request audio permission".to_string())
+ }
}
}
}
@@ -371,6 +386,7 @@ pub fn check_microphone_permissions() -> bool {
unsafe {
let av_media_type = CFString::new("avfa");
+ // Use authorizationStatus instead of requesting
let func_ptr = libc::dlsym(
libc::RTLD_DEFAULT,
"AVCaptureDevice_authorizationStatusForMediaType\0".as_ptr() as *const _,
@@ -389,7 +405,7 @@ pub fn check_microphone_permissions() -> bool {
#[cfg(not(target_os = "macos"))]
{
- true // Windows and Linux don't require explicit microphone permissions
+ true
}
}
@@ -397,11 +413,11 @@ pub fn check_microphone_permissions() -> bool {
pub fn check_screen_capture_permissions() -> bool {
#[cfg(target_os = "macos")]
{
-
unsafe {
+ // Only check status without requesting
let func_ptr = libc::dlsym(
libc::RTLD_DEFAULT,
- "CGRequestScreenCaptureAccess\0".as_ptr() as *const _,
+ "CGPreflightScreenCaptureAccess\0".as_ptr() as *const _,
);
if !func_ptr.is_null() {
@@ -414,7 +430,7 @@ pub fn check_screen_capture_permissions() -> bool {
#[cfg(not(target_os = "macos"))]
{
- true // Windows and Linux don't require explicit screen capture permissions
+ true
}
}
@@ -441,3 +457,26 @@ pub fn show_search(app_handle: tauri::AppHandle<tauri::Wry>) {
.unwrap();
}
}
+
+// Add this new command
+#[tauri::command]
+pub async fn poll_permissions(duration_secs: u64) -> Result<Vec<PermissionsStatus>, String> {
+ let mut results = Vec::new();
+ let start = std::time::Instant::now();
+ let duration = std::time::Duration::from_secs(duration_secs);
+
+ while start.elapsed() < duration {
+ let status = check_all_permissions();
+ results.push(status.clone());
+
+ // If all permissions are granted, we can stop polling
+ if status.screen_capture && status.microphone && status.accessibility {
+ break;
+ }
+
+ // Sleep for 1 second between checks
+ tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
+ }
+
+ Ok(results)
+}
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 888bc1074..83d71dfa9 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -166,6 +166,7 @@ async fn main() {
commands::trigger_audio_permission,
commands::check_microphone_permissions,
commands::show_search,
+ commands::poll_permissions,
])
.setup(|app| {
// Logging setup
diff --git a/screenpipe-app-tauri/src-tauri/tauri.conf.json b/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 3e8c90c03..16673e1ca 100644
--- a/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -143,7 +143,8 @@
"https://ai-proxy.i-f9f.workers.dev",
"https://*.clerk.com",
"https://*.screenpi.pe",
- "https://openrouter.ai"
+ "https://openrouter.ai",
+ "http://tauri.localhost"
],
"font-src": [
"https://fonts.gstatic.com",