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

release-app fix windows build

Louis Beaumontbc122af9c028
diff --git a/Cargo.toml b/Cargo.toml
index 302e380c8..044ac285e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ resolver = "2"
[workspace.package]
-version = "0.2.36"
+version = "0.2.37"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/mediar-ai/screenpipe"
diff --git a/pipes/obsidian/package.json b/pipes/obsidian/package.json
index 0e61dd280..efd857b0e 100644
--- a/pipes/obsidian/package.json
+++ b/pipes/obsidian/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian",
- "version": "0.1.12",
+ "version": "0.1.13",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
diff --git a/pipes/obsidian/src/components/obsidian-settings.tsx b/pipes/obsidian/src/components/obsidian-settings.tsx
index 0922a0d95..fdd3c40ae 100644
--- a/pipes/obsidian/src/components/obsidian-settings.tsx
+++ b/pipes/obsidian/src/components/obsidian-settings.tsx
@@ -128,7 +128,6 @@ export function ObsidianSettings() {
description: "your obsidian settings have been updated",
});
} catch (err) {
- // dismiss loading toast and show error
loadingToast.update({
id: loadingToast.id,
title: "error",
@@ -198,17 +197,14 @@ export function ObsidianSettings() {
input.value = path;
}
- await updateSettings(
- {
- customSettings: {
- obsidian: {
- ...settings.customSettings?.obsidian,
- path,
- },
+ await updateSettings({
+ customSettings: {
+ obsidian: {
+ ...settings.customSettings?.obsidian,
+ path,
},
},
- "obsidian"
- );
+ });
toast({
title: "path updated",
diff --git a/pipes/obsidian/src/lib/hooks/use-settings.tsx b/pipes/obsidian/src/lib/hooks/use-settings.tsx
index 2598c05bf..efeb16c6b 100644
--- a/pipes/obsidian/src/lib/hooks/use-settings.tsx
+++ b/pipes/obsidian/src/lib/hooks/use-settings.tsx
@@ -3,6 +3,8 @@
import { useState, useEffect } from "react";
import { getDefaultSettings, type Settings } from "@screenpipe/browser";
+const SETTINGS_KEY = "screenpipe_settings";
+
export function useSettings() {
const defaultSettings = getDefaultSettings();
@@ -37,41 +39,18 @@ if you do your job well, i'll give you a 🍺 and $1m`,
},
};
- const [settings, setSettings] = useState<Settings | null>(null);
+ const [settings, setSettings] = useState<Settings | null>(() => {
+ if (typeof window !== "undefined") {
+ const saved = localStorage.getItem(SETTINGS_KEY);
+ return saved ? JSON.parse(saved) : null;
+ }
+ return null;
+ });
const [loading, setLoading] = useState(true);
const [error, setError] = useState<Error | null>(null);
useEffect(() => {
- const loadSettings = async () => {
- if (!loading) setLoading(true);
- try {
- const response = await fetch("/api/settings");
- const data = await response.json();
- console.log("useSettings data", data?.customSettings?.obsidian);
- setSettings({ ...defaultSettings, ...data });
- } catch (err) {
- console.error("failed to load settings:", err);
- setSettings(defaultSettings);
- setError(err as Error);
- } finally {
- setLoading(false);
- }
- };
-
- // Initial load
- loadSettings();
-
- // Refresh on window focus
- const onFocus = () => loadSettings();
- window.addEventListener("focus", onFocus);
-
- // Optional: periodic refresh every 30s
- const interval = setInterval(loadSettings, 2000);
-
- return () => {
- window.removeEventListener("focus", onFocus);
- clearInterval(interval);
- };
+ setLoading(false);
}, []);
const updateSetting = async <T extends keyof Settings>(
@@ -81,74 +60,30 @@ if you do your job well, i'll give you a 🍺 and $1m`,
) => {
if (!settings) return;
try {
- await fetch("/api/settings", {
- method: "PUT",
- body: JSON.stringify({ key, value, namespace }),
- });
-
- if (namespace) {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- return {
- ...prev,
- customSettings: {
- ...prev.customSettings,
- [namespace]: {
- ...(prev.customSettings?.[namespace] || {}),
- [key]: value,
- },
- },
- };
- });
- } else {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- return { ...prev, [key]: value };
- });
- }
+ const updatedSettings = {
+ ...settings,
+ customSettings: {
+ ...settings.customSettings,
+ [namespace || "default"]: {
+ ...(settings.customSettings?.[namespace || "default"] || {}),
+ [key]: value,
+ },
+ },
+ };
+ setSettings(updatedSettings);
+ localStorage.setItem(SETTINGS_KEY, JSON.stringify(updatedSettings));
} catch (err) {
setError(err as Error);
}
};
- const updateSettings = async (
- newSettings: Partial<Settings>,
- namespace?: string
- ) => {
- if (!settings) return;
- try {
- await fetch("/api/settings", {
- method: "PUT",
- body: JSON.stringify({
- value: newSettings,
- isPartialUpdate: true,
- namespace,
- }),
- });
-
- if (namespace) {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- return {
- ...prev,
- customSettings: {
- ...prev.customSettings,
- [namespace]: {
- ...(prev.customSettings?.[namespace] || {}),
- ...newSettings,
- },
- },
- };
- });
- } else {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- return { ...prev, ...newSettings };
- });
- }
- } catch (err) {
- setError(err as Error);
- }
+ const updateSettings = async (newSettings: any) => {
+ const updatedSettings = {
+ ...settings,
+ ...newSettings,
+ };
+ setSettings(updatedSettings);
+ localStorage.setItem(SETTINGS_KEY, JSON.stringify(updatedSettings));
};
const resetSettings = async (
@@ -157,48 +92,18 @@ if you do your job well, i'll give you a 🍺 and $1m`,
) => {
if (!settings) return;
try {
- await fetch("/api/settings", {
- method: "PUT",
- body: JSON.stringify({ reset: true, key: settingKey, namespace }),
- });
-
- if (namespace) {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- if (settingKey) {
- return {
- ...prev,
- customSettings: {
- ...prev.customSettings,
- [namespace]: {
- ...(prev.customSettings?.[namespace] || {}),
- [settingKey]: undefined,
- },
- },
- };
- } else {
- return {
- ...prev,
- customSettings: {
- ...prev.customSettings,
- [namespace]: {},
- },
- };
- }
- });
- } else {
- if (settingKey) {
- setSettings((prev) => {
- if (!prev) return defaultSettings;
- return {
- ...prev,
- [settingKey]: defaultSettings[settingKey],
- };
- });
- } else {
- setSettings(defaultSettings);
- }
- }
+ const updatedSettings = {
+ ...settings,
+ customSettings: {
+ ...settings.customSettings,
+ [namespace || ("default" as string)]: {
+ ...(settings.customSettings?.[namespace || "default"] || {}),
+ [settingKey as string]: undefined,
+ },
+ },
+ };
+ setSettings(updatedSettings);
+ localStorage.setItem(SETTINGS_KEY, JSON.stringify(updatedSettings));
} catch (err) {
setError(err as Error);
}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index b304d8714..cd018d9e3 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.32.1"
+version = "0.32.2"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index f2c6fd7d5..5360173de 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -181,7 +181,9 @@ done
tokio::fs::write(&script_path, script_content).await?;
- if !cfg!(windows) {
+ // Set executable permissions on Unix systems only
+ #[cfg(unix)]
+ {
use std::os::unix::fs::PermissionsExt;
let mut perms = tokio::fs::metadata(&script_path).await?.permissions();
perms.set_mode(0o755);