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 error

shaik-zeeshan5a4349eacd1e
diff --git a/openrewind/components/rewind/custom-dialog-content.tsx b/openrewind/components/rewind/custom-dialog-content.tsx
index 842baa5b4..e758da06b 100644
--- a/openrewind/components/rewind/custom-dialog-content.tsx
+++ b/openrewind/components/rewind/custom-dialog-content.tsx
@@ -29,3 +29,5 @@ export const CustomDialogContent = React.forwardRef<
</DialogPrimitive.Content>
</DialogPortal>
));
+
+CustomDialogContent.displayName = "CustomDialogContent";
diff --git a/openrewind/components/rewind/settings-provider.tsx b/openrewind/components/rewind/settings-provider.tsx
deleted file mode 100644
index 0456c477d..000000000
--- a/openrewind/components/rewind/settings-provider.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-"use client";
-
-import {
- getScreenpipeAppSettings,
- updateScreenpipeAppSettings,
-} from "@/lib/actions/get-screenpipe-app-settings";
-import { Settings } from "@screenpipe/js";
-import { createContext, ReactNode, useEffect, useState } from "react";
-
-export const SettingsContext = createContext<{
- settings: Partial<Settings> | null;
- loading: boolean;
- updateSettings: (value: Partial<Settings>) => Promise<boolean>;
-} | null>(null);
-
-export const SettingsProvider = ({ children }: { children: ReactNode }) => {
- const [settings, setSettings] = useState<Partial<Settings> | null>(null);
- const [loading, setLoading] = useState(true);
-
- useEffect(() => {
- loadSettings();
- console.log("fetched");
- }, []);
-
- const loadSettings = async () => {
- try {
- // Load screenpipe app settings
- const screenpipeSettings = await getScreenpipeAppSettings();
-
- // Merge everything together
- setSettings({
- ...screenpipeSettings,
- });
- } catch (error) {
- console.error("failed to load settings:", error);
- } finally {
- setLoading(false);
- }
- };
-
- const updateSettings = async (screenpipeAppSettings: Partial<Settings>) => {
- try {
- // Update screenpipe settings if provided
- if (screenpipeAppSettings) {
- await updateScreenpipeAppSettings({
- ...settings,
- ...screenpipeAppSettings,
- });
- }
-
- // Update state with everything
- setSettings({
- ...screenpipeAppSettings,
- });
- return true;
- } catch (error) {
- console.error("failed to update settings:", error);
- return false;
- }
- };
-
- return (
- <SettingsContext.Provider value={{ settings, loading, updateSettings }}>
- {children}
- </SettingsContext.Provider>
- );
-};
diff --git a/openrewind/components/rewind/timeline/timeline-search.tsx b/openrewind/components/rewind/timeline/timeline-search.tsx
index 7e14df5c1..1030562e3 100644
--- a/openrewind/components/rewind/timeline/timeline-search.tsx
+++ b/openrewind/components/rewind/timeline/timeline-search.tsx
@@ -12,7 +12,7 @@ import {
DialogOverlay,
} from "@/components/ui/dialog";
import { motion, AnimatePresence } from "framer-motion";
-import { StreamTimeSeriesResponse } from "@/app/page";
+import { StreamTimeSeriesResponse } from "@/components/rewind/timeline";
import OpenAI from "openai";
import { useSettings } from "@/lib/hooks/use-settings";
import {
diff --git a/openrewind/lib/actions/get-start-date.ts b/openrewind/lib/actions/get-start-date.ts
index 2f92d0af2..2d3b2f696 100644
--- a/openrewind/lib/actions/get-start-date.ts
+++ b/openrewind/lib/actions/get-start-date.ts
@@ -1,5 +1,3 @@
-"use server";
-
import { isAfter } from "date-fns";
export async function getStartDate() {
diff --git a/openrewind/lib/actions/has-frames-date.ts b/openrewind/lib/actions/has-frames-date.ts
index 2bf6d73d4..843614796 100644
--- a/openrewind/lib/actions/has-frames-date.ts
+++ b/openrewind/lib/actions/has-frames-date.ts
@@ -1,5 +1,3 @@
-"use server";
-
export async function hasFramesForDate(date: Date) {
try {
// Set up start and end of the day
diff --git a/openrewind/lib/actions/video-actions.ts b/openrewind/lib/actions/video-actions.ts
index 449e64b64..eeef66bf3 100644
--- a/openrewind/lib/actions/video-actions.ts
+++ b/openrewind/lib/actions/video-actions.ts
@@ -1,43 +1,14 @@
-"use server";
-
-import { readFile } from "node:fs/promises";
-import { resolve } from "node:path";
+import { invoke } from '@tauri-apps/api/core';
export async function getMediaFile(
filePath: string,
): Promise<{ data: string; mimeType: string }> {
try {
- const absolutePath = resolve(filePath);
- const buffer = await readFile(absolutePath);
- // convert to base64
- const data = buffer.toString("base64");
-
- const getMimeType = (path: string): string => {
- const ext = path.split(".").pop()?.toLowerCase();
- const isAudio =
- path.toLowerCase().includes("input") ||
- path.toLowerCase().includes("output");
-
- switch (ext) {
- case "mp4":
- return "video/mp4";
- case "webm":
- return "video/webm";
- case "ogg":
- return "video/ogg";
- case "mp3":
- return "audio/mpeg";
- case "wav":
- return "audio/wav";
- default:
- return isAudio ? "audio/mpeg" : "video/mp4";
- }
- };
+ const result = await invoke<{ data: string; mimeType: string }>('get_media_file', {
+ filePath: filePath,
+ });
- return {
- data,
- mimeType: getMimeType(filePath),
- };
+ return result;
} catch (error) {
console.error("failed to read media file:", error);
throw new Error(
diff --git a/openrewind/src-tauri/src/main.rs b/openrewind/src-tauri/src/main.rs
index 562ca2a4b..8c4548699 100755
--- a/openrewind/src-tauri/src/main.rs
+++ b/openrewind/src-tauri/src/main.rs
@@ -68,6 +68,7 @@ use tauri_plugin_global_shortcut::{Code, Modifiers, Shortcut};
use tauri_plugin_sentry::sentry;
mod health;
use health::start_health_check;
+use base64::Engine;
// New struct to hold shortcut configuration
#[derive(Debug, Default)]
@@ -375,6 +376,55 @@ fn get_data_dir(app: &tauri::AppHandle) -> anyhow::Result<PathBuf> {
use tokio::time::{sleep, Duration};
+#[tauri::command]
+async fn get_media_file(file_path: &str) -> Result<serde_json::Value, String> {
+ use std::path::Path;
+
+ debug!("Reading media file: {}", file_path);
+
+ let path = Path::new(file_path);
+ if !path.exists() {
+ return Err(format!("File does not exist: {}", file_path));
+ }
+
+ // Read file contents
+ let file_contents = match tokio::fs::read(path).await {
+ Ok(contents) => {
+ debug!("Successfully read file of size: {} bytes", contents.len());
+ contents
+ }
+ Err(e) => {
+ error!("Failed to read file: {}", e);
+ return Err(format!("Failed to read file: {}", e));
+ }
+ };
+
+ // Convert to base64
+ let data = base64::prelude::BASE64_STANDARD.encode(&file_contents);
+
+ // Determine MIME type
+ let mime_type = get_mime_type(file_path);
+
+ Ok(serde_json::json!({
+ "data": data,
+ "mimeType": mime_type
+ }))
+}
+
+fn get_mime_type(path: &str) -> String {
+ let ext = path.split('.').last().unwrap_or("").to_lowercase();
+ let is_audio = path.to_lowercase().contains("input") || path.to_lowercase().contains("output");
+
+ match ext.as_str() {
+ "mp4" => "video/mp4".to_string(),
+ "webm" => "video/webm".to_string(),
+ "ogg" => "video/ogg".to_string(),
+ "mp3" => "audio/mpeg".to_string(),
+ "wav" => "audio/wav".to_string(),
+ _ => if is_audio { "audio/mpeg".to_string() } else { "video/mp4".to_string() }
+ }
+}
+
#[tauri::command]
async fn upload_file_to_s3(file_path: &str, signed_url: &str) -> Result<bool, String> {
debug!("Starting upload for file: {}", file_path);
@@ -610,6 +660,7 @@ async fn main() {
commands::get_disk_usage,
commands::open_pipe_window,
get_log_files,
+ get_media_file,
upload_file_to_s3,
update_global_shortcuts,
get_env,