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 auto destruct on windows

Louis Beaumontc000fbd536a8
diff --git a/Cargo.toml b/Cargo.toml
index 8e2bbfea6..c10986594 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,15 +21,17 @@ license = "MIT OR Apache-2.0"
edition = "2021"
[workspace.dependencies]
+# AI
+candle = { package = "candle-core", version = "0.7.1" }
+candle-nn = { package = "candle-nn", version = "0.7.1" }
+candle-transformers = { package = "candle-transformers", version = "0.7.1" }
+tokenizers = "0.20.0"
+hf-hub = "0.3.0"
+
log = "0.4"
-candle = { package = "candle-core", version = "0.7.0" }
-candle-nn = { package = "candle-nn", version = "0.7.0" }
-candle-transformers = { package = "candle-transformers", version = "0.7.0" }
-tokenizers = "0.19.1"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tokio = { version = "1.15", features = ["full", "tracing"] }
-hf-hub = "0.3.0"
crossbeam = "0.8.4"
image = "0.25"
reqwest = { version = "0.11", features = ["blocking", "multipart", "json"] }
diff --git a/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/README.md b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/README.md
new file mode 100644
index 000000000..6afa6a69d
--- /dev/null
+++ b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/README.md
@@ -0,0 +1,52 @@
+# pipe-llama32-sync-user-conversation-to-notion
+
+This pipe automatically summarizes your user conversations (screen text only) and sends the summaries to a Notion database. It uses AI to analyze screen content from your meetings and generate structured tables.
+
+## Quick Setup
+
+1. Run Ollama:
+ ```
+ ollama run llama3.2:3b-instruct-q4_K_M
+ ```
+
+2. Set up Notion:
+ a. Create a new integration at https://www.notion.so/my-integrations
+ b. Copy the API key for later use
+ c. Create a new database in Notion with the following properties:
+ - Summary (Title)
+ - Key Points (Rich text)
+ - Action Items (Rich text)
+ - Pain Points (Rich text)
+ - Needs (Rich text)
+ - Sentiment (Select)
+ - Timestamp (Date)
+ d. Share the database with your integration:
+ - Open the database
+ - Click the '...' menu in the top right
+ - Go to 'Add connections' and select your integration
+ e. Copy the database ID from the URL:
+ - Open the database in full-page view
+ - The URL will look like: https://www.notion.so/your-workspace/database-id?v=...
+ - Copy the 'database-id' part
+
+3. Configure the pipe:
+ a. Open the Screenpipe app
+ b. Go to the Pipes section
+ c. Find or add the "pipe-meeting-summary-by-notion" pipe
+ d. Configure the following fields:
+ - Polling Interval (default: 3600000 ms / 1 hour)
+ - Notion API Key (from step 2b)
+ - Notion Database ID (from step 2e)
+ - AI API URL (default: http://localhost:11434/api/chat for Ollama)
+ - AI Model (default: llama3.2:3b-instruct-q4_K_M)
+ - Custom Summary Prompt (optional)
+ e. Save the configuration
+ f. Enable the pipe
+
+4. Restart Screenpipe recording
+
+That's it! The pipe will now periodically check for new audio content, summarize it using AI, and send the summaries to your Notion database.
+
+## Customization
+
+To customize the pipe's behavior, you can modify the `pipe.ts` file. Key areas you might want to adjust include:
diff --git a/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.json b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.json
new file mode 100644
index 000000000..93ff50b0e
--- /dev/null
+++ b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.json
@@ -0,0 +1,52 @@
+{
+ "fields": [
+ {
+ "name": "pollingInterval",
+ "type": "number",
+ "default": 60000,
+ "description": "interval in milliseconds to poll conversation content (default: 2 minutes)"
+ },
+ {
+ "name": "pollingSize",
+ "type": "number",
+ "default": 100,
+ "description": "number of records to retrieve from Screenpipe per page"
+ },
+ {
+ "name": "windowName",
+ "type": "window",
+ "default": "",
+ "description": "specific window name to filter the conversation data, e.g., 'slack', 'gmail', etc."
+ },
+ {
+ "name": "aiApiUrl",
+ "type": "string",
+ "default": "http://localhost:11434/api/chat",
+ "description": "ai api url, can be ollama, openai, or any openai compatible api"
+ },
+ {
+ "name": "aiModel",
+ "type": "string",
+ "default": "llama3.2:3b-instruct-q4_K_M",
+ "description": "ai model to use for summarizing conversations"
+ },
+ {
+ "name": "notionApiKey",
+ "type": "string",
+ "default": "<fill your notion api key here>",
+ "description": "notion api key for authentication"
+ },
+ {
+ "name": "notionDatabaseId",
+ "type": "string",
+ "default": "<fill your notion database id here>",
+ "description": "id of the notion database to sync conversations to"
+ },
+ {
+ "name": "customSummaryPrompt",
+ "type": "string",
+ "default": "you are an expert in user research and product development, trained in 'the mom test' methodology. analyze this user conversation with the following guidelines:\n\n1. focus on extracting specific examples and stories, not opinions.\n2. identify problems and frustrations the user is currently facing.\n3. uncover the user's current behaviors and workflows.\n4. look for emotional responses and strong reactions.\n5. detect any mentions of money or time investments.\n6. note any alternative solutions the user has tried.\n7. capture any future plans or intended actions.\n8. identify potential product ideas or feature requests.\n9. highlight any misunderstandings or areas of confusion.\n10. detect any 'maybes' or non-committal responses that need further exploration.\n\nremember, good user research is about listening and observing, not pitching or leading the user. extract insights that can drive product decisions and improvements.",
+ "description": "custom prompt for the ai to analyze and summarize the conversation"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.ts b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.ts
new file mode 100644
index 000000000..b05456ea3
--- /dev/null
+++ b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/pipe.ts
@@ -0,0 +1,208 @@
+interface ConversationEntry {
+ summary: string;
+ keyPoints: string[];
+ actionItems: string[];
+ painPoints: string[];
+ needs: string[];
+ sentiment: string;
+ timestamp: string;
+}
+
+function extractJsonFromLlmResponse(response: string): any {
+ // Remove any markdown code block syntax
+ let cleaned = response.replace(/^```(?:json)?\s*|\s*```$/g, "");
+
+ // Try to find JSON-like content
+ const jsonMatch = cleaned.match(/\{[\s\S]*\}/);
+ if (jsonMatch) {
+ cleaned = jsonMatch[0];
+ }
+
+ // Remove any non-JSON content before or after the main object
+ cleaned = cleaned.replace(/^[^{]*/, "").replace(/[^}]*$/, "");
+
+ // Replace any escaped newlines and remove actual newlines
+ cleaned = cleaned.replace(/\\n/g, "").replace(/\n/g, "");
+
+ try {
+ return JSON.parse(cleaned);
+ } catch (error) {
+ console.warn("failed to parse json:", error);
+ console.warn("cleaned content:", cleaned);
+
+ // Attempt to fix common issues
+ cleaned = cleaned
+ .replace(/,\s*}/g, "}") // Remove trailing commas
+ .replace(/'/g, '"') // Replace single quotes with double quotes
+ .replace(/(\w+):/g, '"$1":') // Add quotes to keys
+ .replace(/:\s*'([^']*)'/g, ': "$1"'); // Replace single-quoted values with double-quoted values
+
+ try {
+ return JSON.parse(cleaned);
+ } catch (secondError) {
+ console.warn("failed to parse json after attempted fixes:", secondError);
+ throw new Error("invalid json format in llm response");
+ }
+ }
+}
+
+async function summarizeConversation(
+ conversationData: ContentItem[],
+ aiApiUrl: string,
+ aiModel: string,
+ customSummaryPrompt: string
+): Promise<ConversationEntry | null> {
+ const prompt = `${customSummaryPrompt}
+
+ analyze the following conversation:
+
+ ${JSON.stringify(conversationData)}
+
+ return a json object with the following structure:
+ {
+ "summary": "brief summary of the conversation",
+ "keyPoints": ["key point 1", "key point 2", ...],
+ "actionItems": ["action item 1", "action item 2", ...],
+ "painPoints": ["pain point 1", "pain point 2", ...],
+ "needs": ["need 1", "need 2", ...],
+ "sentiment": "positive/neutral/negative"
+ }
+
+ rules:
+ - do not add backticks to the json eg \`\`\`json\`\`\` is wrong
+ - do not return anything but json. no comments below the json.
+ - if the data does not seem to be related to user conversation, return "false"
+ `;
+
+ const response = await fetch(aiApiUrl, {
+ method: "POST",
+ body: JSON.stringify({
+ model: aiModel,
+ messages: [{ role: "user", content: prompt }],
+ stream: false,
+ response_format: { type: "json_object" },
+ }),
+ });
+
+ if (!response.ok) {
+ console.log("ai response:", await response.text());
+ throw new Error(`http error! status: ${response.status}`);
+ }
+
+ const result = await response.json();
+ console.log("ai answer:", result);
+ if (result.message.content === "false") {
+ return null;
+ }
+
+ let content;
+ try {
+ content = extractJsonFromLlmResponse(result.message.content);
+ } catch (error) {
+ console.warn("failed to parse ai response:", error, result);
+ throw new Error("invalid ai response format");
+ }
+
+ return {
+ ...content,
+ timestamp: new Date().toISOString(),
+ };
+}
+
+async function addToNotion(
+ notionApiKey: string,
+ databaseId: string,
+ entry: ConversationEntry
+): Promise<void> {
+ const response = await fetch(`https://api.notion.com/v1/pages`, {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${notionApiKey}`,
+ "Notion-Version": "2022-06-28",
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ parent: { database_id: databaseId },
+ properties: {
+ "Summary": { title: [{ text: { content: entry.summary } }] },
+ "Key Points": {
+ rich_text: [{ text: { content: entry.keyPoints.join(", ") } }],
+ },
+ "Action Items": {
+ rich_text: [{ text: { content: entry.actionItems.join(", ") } }],
+ },
+ "Pain Points": {
+ rich_text: [{ text: { content: entry.painPoints.join(", ") } }],
+ },
+ "Needs": { rich_text: [{ text: { content: entry.needs.join(", ") } }] },
+ "Sentiment": { select: { name: entry.sentiment } },
+ "Timestamp": { date: { start: entry.timestamp } },
+ },
+ }),
+ });
+
+ if (!response.ok) {
+ throw new Error(`failed to add to notion: ${response.statusText}`);
+ }
+
+ console.log("successfully added to notion");
+}
+
+async function syncConversationPipeline(): Promise<void> {
+ console.log("starting conversation sync pipeline");
+
+ const config = await pipe.loadConfig();
+ console.log("loaded config:", JSON.stringify(config, null, 2));
+
+ const {
+ pollingInterval,
+ windowName,
+ aiApiUrl,
+ aiModel,
+ notionApiKey,
+ notionDatabaseId,
+ customSummaryPrompt,
+ } = config;
+
+ while (true) {
+ try {
+ const now = new Date();
+ const fiveMinutesAgo = new Date(now.getTime() - 5 * 60 * 1000);
+
+ const conversationData = await pipe.queryScreenpipe({
+ start_time: fiveMinutesAgo.toISOString(),
+ end_time: now.toISOString(),
+ window_name: windowName,
+ content_type: "ocr",
+ limit: 1000,
+ });
+
+ if (
+ conversationData &&
+ conversationData.data &&
+ conversationData.data.length > 0
+ ) {
+ const summary = await summarizeConversation(
+ conversationData.data,
+ aiApiUrl,
+ aiModel,
+ customSummaryPrompt
+ );
+ if (!summary) {
+ console.log("no summary found");
+ continue;
+ }
+ console.log("conversation summary:", summary);
+
+ await addToNotion(notionApiKey, notionDatabaseId, summary);
+ console.log("added to notion");
+ }
+ } catch (error) {
+ console.warn("error in conversation sync pipeline:", error);
+ }
+ console.log("sleeping for", pollingInterval, "ms");
+ await new Promise((resolve) => setTimeout(resolve, pollingInterval));
+ }
+}
+
+syncConversationPipeline();
diff --git a/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/screenpipe.d.ts b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/screenpipe.d.ts
new file mode 100644
index 000000000..820e1a2d0
--- /dev/null
+++ b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/screenpipe.d.ts
@@ -0,0 +1,245 @@
+declare global {
+ const pipe: {
+ /**
+ * Reads the contents of a file.
+ * @param path - The path to the file to be read.
+ * @returns A promise that resolves with the file contents as a string.
+ */
+ readFile: (path: string) => Promise<string>;
+
+ /**
+ * Writes content to a file.
+ * @param path - The path to the file to be written.
+ * @param contents - The content to write to the file.
+ * @returns A promise that resolves when the write operation is complete.
+ */
+ writeFile: (path: string, contents: string) => Promise<void>;
+
+ /**
+ * Removes a file.
+ * @param path - The path to the file to be removed.
+ * @returns A promise that resolves when the file is removed.
+ */
+ removeFile: (path: string) => Promise<void>;
+
+ /**
+ * Performs a GET request to the specified URL.
+ * @param url - The URL to send the GET request to.
+ * @returns A promise that resolves with the response data.
+ */
+ get: (url: string) => Promise<any>;
+
+ /**
+ * Performs a POST request to the specified URL.
+ * @param url - The URL to send the POST request to.
+ * @param body - The body of the POST request.
+ * @returns A promise that resolves with the response data.
+ */
+ post: (url: string, body: string) => Promise<any>;
+
+ /**
+ * Performs a fetch request.
+ * @param url - The URL to fetch.
+ * @param options - Optional fetch options.
+ * @returns A promise that resolves with the fetch response.
+ */
+ fetch: (url: string, options?: RequestInit) => Promise<Response>;
+
+ /**
+ * Sends a notification.
+ * @param options - The notification options.
+ * @returns A promise that resolves when the notification is sent.
+ */
+ sendNotification: (options: {
+ title: string;
+ body: string;
+ }) => Promise<any>;
+
+ /**
+ * Loads the configuration for the pipe.
+ * @returns A promise that resolves with the configuration object.
+ */
+ loadConfig: () => Promise<Record<string, any>>;
+
+ /**
+ * The current configuration of the pipe.
+ */
+ config: Record<string, any>;
+
+ /**
+ * Metadata about the current pipe.
+ */
+ metadata: {
+ id: string;
+ };
+
+ /**
+ * Sends an email.
+ * @param options - The email options.
+ * @returns A promise that resolves to true if the email was sent successfully, false otherwise.
+ */
+ sendEmail: (options: {
+ to: string;
+ from: string;
+ password: string;
+ subject: string;
+ body: string;
+ }) => Promise<boolean>;
+
+ /**
+ * Queries the Screenpipe database.
+ * @param params - The query parameters.
+ * @returns A promise that resolves with the query results or null if an error occurred.
+ */
+ queryScreenpipe: (
+ params: ScreenpipeQueryParams
+ ) => Promise<ScreenpipeResponse | null>;
+ };
+
+ const fs: {
+ /**
+ * Reads the contents of a file.
+ * @param path - The path to the file to be read.
+ * @returns A promise that resolves with the file contents as a string.
+ */
+ readFile: (path: string) => Promise<string>;
+
+ /**
+ * Writes content to a file.
+ * @param path - The path to the file to be written.
+ * @param contents - The content to write to the file.
+ * @returns A promise that resolves when the write operation is complete.
+ */
+ writeFile: (path: string, contents: string) => Promise<void>;
+
+ /**
+ * Reads the contents of a directory.
+ * @param path - The path to the directory to be read.
+ * @returns A promise that resolves with an array of file names in the directory.
+ */
+ readdir: (path: string) => Promise<string[]>;
+
+ /**
+ * Creates a new directory.
+ * @param path - The path of the directory to be created.
+ * @returns A promise that resolves when the directory is created.
+ */
+ mkdir: (path: string) => Promise<void>;
+ };
+
+ const path: {
+ /**
+ * Joins multiple path segments into a single path.
+ * @param paths - The path segments to join.
+ * @returns The joined path string.
+ */
+ join: (...paths: string[]) => string;
+ };
+
+ namespace NodeJS {
+ interface ProcessEnv {
+ SCREENPIPE_DIR: string;
+ SCREENPIPE_LOG_API_URL?: string;
+ SCREENPIPE_SERVER_URL?: string;
+ PIPE_DIR: string;
+ NOTION_DATABASE_ID: string;
+ NOTION_API_KEY: string;
+ }
+ }
+ const process: {
+ env: NodeJS.ProcessEnv;
+ };
+
+ /**
+ * Types of content that can be queried in Screenpipe.
+ */
+ type ContentType = "ocr" | "audio" | "all";
+
+ /**
+ * Parameters for querying Screenpipe.
+ */
+ interface ScreenpipeQueryParams {
+ q?: string;
+ content_type?: ContentType;
+ limit?: number;
+ offset?: number;
+ start_time?: string;
+ end_time?: string;
+ app_name?: string;
+ window_name?: string;
+ include_frames?: boolean;
+ min_length?: number;
+ max_length?: number;
+ }
+
+ /**
+ * Structure of OCR (Optical Character Recognition) content.
+ */
+ interface OCRContent {
+ frame_id: number;
+ text: string;
+ timestamp: string;
+ file_path: string;
+ offset_index: number;
+ app_name: string;
+ window_name: string;
+ tags: string[];
+ frame?: string;
+ }
+
+ /**
+ * Structure of audio content.
+ */
+ interface AudioContent {
+ chunk_id: number;
+ transcription: string;
+ timestamp: string;
+ file_path: string;
+ offset_index: number;
+ tags: string[];
+ device_name: string;
+ device_type: string;
+ }
+
+ /**
+ * Structure of Full Text Search content.
+ */
+ interface FTSContent {
+ text_id: number;
+ matched_text: string;
+ frame_id: number;
+ timestamp: string;
+ app_name: string;
+ window_name: string;
+ file_path: string;
+ original_frame_text?: string;
+ tags: string[];
+ }
+
+ /**
+ * Union type for different types of content items.
+ */
+ type ContentItem =
+ | { type: "OCR"; content: OCRContent }
+ | { type: "Audio"; content: AudioContent }
+ | { type: "FTS"; content: FTSContent };
+
+ /**
+ * Pagination information for search results.
+ */
+ interface PaginationInfo {
+ limit: number;
+ offset: number;
+ total: number;
+ }
+
+ /**
+ * Structure of the response from a Screenpipe query.
+ */
+ interface ScreenpipeResponse {
+ data: ContentItem[];
+ pagination: PaginationInfo;
+ }
+}
+
+export {};
diff --git a/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/tsconfig.json b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/tsconfig.json
new file mode 100644
index 000000000..c4e6dfdd7
--- /dev/null
+++ b/examples/typescript/pipe-llama32-sync-user-conversation-to-notion/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "es2018",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "outDir": "./",
+ "rootDir": "./",
+ "strict": true,
+ "esModuleInterop": true
+ },
+ "include": [
+ "./**/*.ts"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}
\ No newline at end of file
diff --git a/screenpipe-app-tauri/components/meeting-history.tsx b/screenpipe-app-tauri/components/meeting-history.tsx
index bb8379d6a..46c5d977d 100644
--- a/screenpipe-app-tauri/components/meeting-history.tsx
+++ b/screenpipe-app-tauri/components/meeting-history.tsx
@@ -154,18 +154,8 @@ export default function MeetingHistory() {
console.log("fetching meetings...");
setLoading(true);
try {
- let startTime;
- const storedMeetings = (await getItem("meetings")) || [];
- if (storedMeetings.length > 0) {
- // get the start time of the last stored meeting
- const lastMeeting = storedMeetings[0]; // assuming meetings are sorted desc
- startTime = new Date(lastMeeting.meetingEnd).toISOString();
- } else {
- // if no stored meetings, search from 7 days ago
- startTime = new Date(
- Date.now() - 7 * 24 * 60 * 60 * 1000
- ).toISOString();
- }
+ // Always fetch from the last 24 hours
+ const startTime = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
console.log("searching from:", startTime);
const response = await fetch(
@@ -182,15 +172,22 @@ export default function MeetingHistory() {
const newMeetings = processMeetings(camelCaseResult.data);
console.log("processed new meetings:", newMeetings);
- // merge new meetings with stored meetings, avoiding duplicates
- let updatedMeetings = [...storedMeetings];
+ // merge new meetings with stored meetings, updating existing ones
+ let updatedMeetings = [...meetings];
newMeetings.forEach((newMeeting) => {
const existingMeetingIndex = updatedMeetings.findIndex(
(m) => m.meetingGroup === newMeeting.meetingGroup
);
if (existingMeetingIndex === -1) {
- // add new meeting only if it doesn't exist
+ // add new meeting if it doesn't exist
updatedMeetings.push(newMeeting);
+ } else {
+ // update existing meeting with new data
+ updatedMeetings[existingMeetingIndex] = {
+ ...updatedMeetings[existingMeetingIndex],
+ ...newMeeting,
+ fullTranscription: updatedMeetings[existingMeetingIndex].fullTranscription + newMeeting.fullTranscription,
+ };
}
});
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index 6b3b76c42..98597ff2c 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -67,6 +67,12 @@ interface CorePipe {
}
const corePipes: CorePipe[] = [
+ {
+ id: "pipe-meeting-summary-by-email",
+ description:
+ "send you regular emails summarizing your meetings using ollama+llama3.2",
+ url: "https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript/pipe-meeting-summary-by-email",
+ },
{
id: "pipe-phi3.5-engineering-team-logs",
description:
@@ -404,12 +410,16 @@ const PipeDialog: React.FC = () => {
view source
</Button>
)}
- <Button disabled variant="outline">
+ <Button
+ onClick={() =>
+ openUrl(
+ "https://twitter.com/intent/tweet?text=here's%20how%20i%20use%20@screen_pipe%20...%20%5Bscreenshot%5D%20an%20awesome%20tool%20for%20..."
+ )
+ }
+ variant="outline"
+ >
<Heart className="mr-2 h-4 w-4" />
- donate
- <Badge variant="secondary" className="ml-2">
- soon
- </Badge>
+ support us
</Button>
</div>
<Separator className="my-4" />
@@ -474,7 +484,59 @@ const PipeDialog: React.FC = () => {
/>
);
},
+ a({ href, children }) {
+ const isDirectVideo =
+ href?.match(/\.(mp4|webm|ogg)$/) ||
+ href?.includes("user-attachments/assets");
+ const youtubeMatch = href?.match(
+ /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/
+ );
+
+ if (isDirectVideo) {
+ return (
+ <video
+ src={href}
+ controls
+ className="max-w-full h-auto"
+ style={{ maxHeight: "400px" }}
+ >
+ your browser does not support the video tag.
+ </video>
+ );
+ } else if (youtubeMatch) {
+ const videoId = youtubeMatch[1];
+ return (
+ <iframe
+ width="100%"
+ height="315"
+ src={`https://www.youtube.com/embed/${videoId}`}
+ frameBorder="0"
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+ allowFullScreen
+ className="max-w-full"
+ style={{ maxHeight: "400px" }}
+ ></iframe>
+ );
+ }
+
+ return (
+ <a href={href} target="_blank" rel="noopener noreferrer">
+ {children}
+ </a>
+ );
+ },
+ video({ src }) {
+ console.log("vid", src);
+ return (
+ <video
+ src={src}
+ className="max-w-full h-auto"
+ style={{ maxHeight: "400px" }}
+ />
+ );
+ },
img({ src, alt }) {
+ console.log("img", src);
return (
<img
src={src}
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index 658b66bfd..e925eb929 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -130,31 +130,50 @@ export function RecordingSettings({
setAvailableAudioDevices(audioDevices);
console.log("localSettings", localSettings);
- // Update local settings if current values are default
+
+ // Update monitors
+ const availableMonitorIds = monitors.map((monitor) =>
+ monitor.id.toString()
+ );
+ let updatedMonitorIds = localSettings.monitorIds.filter((id) =>
+ availableMonitorIds.includes(id)
+ );
+
if (
- localSettings.monitorIds.length === 1 &&
- localSettings.monitorIds[0] === "default" &&
- monitors.length > 0
+ updatedMonitorIds.length === 0 ||
+ (localSettings.monitorIds.length === 1 &&
+ localSettings.monitorIds[0] === "default" &&
+ monitors.length > 0)
) {
- setLocalSettings({
- ...localSettings,
- monitorIds: [
- monitors.find((monitor) => monitor.is_default)!.id!.toString(),
- ],
- });
+ updatedMonitorIds = [
+ monitors.find((monitor) => monitor.is_default)!.id!.toString(),
+ ];
}
+
+ // Update audio devices
+ const availableAudioDeviceNames = audioDevices.map(
+ (device) => device.name
+ );
+ let updatedAudioDevices = localSettings.audioDevices.filter((device) =>
+ availableAudioDeviceNames.includes(device)
+ );
+
if (
- localSettings.audioDevices.length === 1 &&
- localSettings.audioDevices[0] === "default" &&
- audioDevices.length > 0
+ updatedAudioDevices.length === 0 ||
+ (localSettings.audioDevices.length === 1 &&
+ localSettings.audioDevices[0] === "default" &&
+ audioDevices.length > 0)
) {
- setLocalSettings({
- ...localSettings,
- audioDevices: audioDevices
- .filter((device) => device.is_default)
- .map((device) => device.name),
- });
+ updatedAudioDevices = audioDevices
+ .filter((device) => device.is_default)
+ .map((device) => device.name);
}
+
+ setLocalSettings({
+ ...localSettings,
+ monitorIds: updatedMonitorIds,
+ audioDevices: updatedAudioDevices,
+ });
} catch (error) {
console.error("Failed to load devices:", error);
}
diff --git a/screenpipe-app-tauri/components/updater.tsx b/screenpipe-app-tauri/components/updater.tsx
index 1b8868644..cb913f4ca 100644
--- a/screenpipe-app-tauri/components/updater.tsx
+++ b/screenpipe-app-tauri/components/updater.tsx
@@ -1,6 +1,8 @@
import { check } from "@tauri-apps/plugin-updater";
import { ask, message } from "@tauri-apps/plugin-dialog";
import { relaunch } from "@tauri-apps/plugin-process";
+import { invoke } from "@tauri-apps/api/core";
+import { platform } from "@tauri-apps/plugin-os";
export async function checkForAppUpdates({ toast }: { toast: any }) {
const update = await check();
@@ -20,6 +22,11 @@ Release notes: ${update.body}
);
if (yes) {
+ // on windows only - TODO shouldnt be necessary
+ // const os = platform();
+ // if (os === "windows") {
+ // await invoke("kill_all_sreenpipes");
+
const toastId = toast({
title: "Updating...",
description: "Downloading and installing update",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 400c1cfd0..54ac7e506 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.2.72"
+version = "0.2.73"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/auto_destruct.rs b/screenpipe-server/src/auto_destruct.rs
index 85fd15dfe..dc1bcb117 100644
--- a/screenpipe-server/src/auto_destruct.rs
+++ b/screenpipe-server/src/auto_destruct.rs
@@ -4,16 +4,24 @@ use tokio::time::sleep;
pub async fn watch_pid(pid: u32) -> bool {
loop {
- let output = Command::new("ps")
- .arg("-p")
- .arg(pid.to_string())
+ let (command, args) = if cfg!(target_os = "windows") {
+ (
+ "tasklist",
+ vec!["/FI".to_string(), format!("PID eq {}", pid)],
+ )
+ } else {
+ ("ps", vec!["-p".to_string(), pid.to_string()])
+ };
+
+ let output = Command::new(command)
+ .args(&args)
.output()
- .expect("failed to execute ps command");
+ .expect("failed to execute process check command");
- if !output.status.success() {
+ if !output.status.success() || output.stdout.is_empty() {
return true;
}
sleep(Duration::from_secs(1)).await;
}
-}
\ No newline at end of file
+}