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

chore: warning removal, feat

Louis Beaumontc6fcb43eb3b4
diff --git a/screenpipe-app-tauri/components/settings/account-section.tsx b/screenpipe-app-tauri/components/settings/account-section.tsx
index dd9ce72c6..97a6bb836 100644
--- a/screenpipe-app-tauri/components/settings/account-section.tsx
+++ b/screenpipe-app-tauri/components/settings/account-section.tsx
@@ -88,11 +88,11 @@ export function AccountSection() {
const { settings, updateSettings } = useSettings();
const [isRefreshing, setIsRefreshing] = useState(false);
const [selectedPlan, setSelectedPlan] = useState<string | null>(null);
+ const [isConnectingStripe, setIsConnectingStripe] = useState(false);
useEffect(() => {
- // Listen for deep link URL opens
const setupDeepLink = async () => {
- const unsubscribeDeepLink = await onOpenUrl((urls) => {
+ const unsubscribeDeepLink = await onOpenUrl(async (urls) => {
console.log("received deep link urls:", urls);
for (const url of urls) {
if (url.includes("api_key=")) {
@@ -105,6 +105,24 @@ export function AccountSection() {
});
}
}
+ if (url.includes("return") || url.includes("refresh")) {
+ console.log("stripe connect url:", url);
+ if (url.includes("/return")) {
+ if (user) {
+ const updatedUser = { ...user, stripe_connected: true };
+ updateSettings({ user: updatedUser });
+ }
+ toast({
+ title: "stripe connected!",
+ description: "your account is now set up for payments",
+ });
+ } else if (url.includes("/refresh")) {
+ toast({
+ title: "stripe setup incomplete",
+ description: "please complete the stripe onboarding process",
+ });
+ }
+ }
}
});
return unsubscribeDeepLink;
@@ -118,7 +136,7 @@ export function AccountSection() {
return () => {
if (deepLinkUnsubscribe) deepLinkUnsubscribe();
};
- }, []);
+ }, [settings.user?.token, loadUser, updateSettings]);
const handleRefreshCredits = async () => {
if (!settings.user?.token) return;
@@ -175,6 +193,33 @@ export function AccountSection() {
},
];
+ const handleConnectStripe = async () => {
+ setIsConnectingStripe(true);
+ try {
+ const host = "https://screenpi.pe/api/dev-stripe";
+ const response = await fetch(host, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ user_id: user?.id,
+ }),
+ });
+
+ const { url } = await response.json();
+ await openUrl(url);
+ } catch (error) {
+ toast({
+ title: "failed to connect stripe",
+ description: "please try again later",
+ variant: "destructive",
+ });
+ } finally {
+ setIsConnectingStripe(false);
+ }
+ };
+
return (
<div className="w-full space-y-6 py-4">
<div className="flex items-center justify-between">
@@ -314,12 +359,6 @@ export function AccountSection() {
build and sell custom pipes
</p>
</div>
- <Badge
- variant={"secondary"}
- className="uppercase text-[10px] font-medium"
- >
- COMING SOON
- </Badge>
</div>
<div className="space-y-6">
@@ -338,32 +377,70 @@ export function AccountSection() {
<div className="space-y-1">
<div className="text-sm font-medium">stripe connect</div>
<p className="text-xs text-muted-foreground">
- set up payments to receive earnings from your pipes
+ receive earnings from your pipes (
+ <a
+ href={`mailto:[email protected]?subject=${encodeURIComponent(
+ "i want to create and monetize a pipe"
+ )}&body=${encodeURIComponent(
+ "hi louis,\n\nI'm interested in creating a pipe for screenpipe.\n\n- what I want to build:\n- I'm a programmer: [yes/no]\n- my github: "
+ )}`}
+ className="underline hover:text-primary"
+ target="_blank"
+ >
+ </a>{" "}
+ for private beta access)
</p>
</div>
</div>
<Button
variant="secondary"
size="sm"
- onClick={() =>
- openUrl(
- "https://connect.stripe.com/oauth/authorize?client_id=YOUR_CLIENT_ID"
- )
- }
+ onClick={handleConnectStripe}
className="h-9"
- disabled
+ disabled={true} // for now
+ // disabled={isConnectingStripe || user?.stripe_connected}
>
- connect
+ {isConnectingStripe ? (
+ <RefreshCw className="w-4 h-4 animate-spin" />
+ ) : user?.stripe_connected ? (
+ "connected ✓"
+ ) : (
+ "connect"
+ )}
</Button>
</div>
</div>
- <div className="space-y-2">
- <Label className="text-xs text-muted-foreground">
- publish your pipe with cli
- </Label>
- <div className="font-mono text-xs bg-gray-50 rounded-lg p-4 border border-border/50">
- $ screenpipe publish my-awesome-pipe
+ <div className="space-y-4">
+ <div className="p-4 border border-border/50 rounded-lg bg-secondary/5">
+ <div className="flex items-center justify-between mb-4">
+ <span className="text-sm text-muted-foreground">
+ estimated earnings
+ </span>
+ <span className="text-lg font-mono">$1,385.00</span>
+ </div>
+ <div className="h-[60px] w-full flex items-end gap-1">
+ {[40, 35, 55, 45, 60, 75, 65].map((height, i) => (
+ <div
+ key={i}
+ className="flex-1 bg-gray-900/20"
+ style={{ height: `${height}%` }}
+ />
+ ))}
+ </div>
+ <div className="mt-2 text-xs text-center text-muted-foreground">
+ pending payout - coming soon
+ </div>
+ </div>
+
+ <div className="space-y-2">
+ <Label className="text-xs text-muted-foreground">
+ publish your pipe with cli
+ </Label>
+ <div className="font-mono text-xs bg-gray-50 rounded-lg p-4 border border-border/50">
+ $ screenpipe publish my-awesome-pipe
+ </div>
</div>
</div>
</div>
diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 0c34b9704..2009d2b66 100644
--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -44,6 +44,7 @@ export type User = {
credits?: {
amount: number;
};
+ stripe_connected?: boolean;
}
export type Settings = {
@@ -331,4 +332,4 @@ export function useSettings() {
resetSetting,
getDataDir,
};
-}
\ No newline at end of file
+}
diff --git a/screenpipe-app-tauri/lib/hooks/use-user.ts b/screenpipe-app-tauri/lib/hooks/use-user.ts
index 5be2a86d4..538fccb79 100644
--- a/screenpipe-app-tauri/lib/hooks/use-user.ts
+++ b/screenpipe-app-tauri/lib/hooks/use-user.ts
@@ -17,7 +17,10 @@ async function verifyUserToken(token: string): Promise<User> {
}
const data = await response.json();
- return data.user as User;
+ return {
+ ...data.user,
+ stripe_connected: data.user.stripe_connected ?? false,
+ } as User;
}
export function useUser() {
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 5c14581a6..2744e8bee 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -4966,7 +4966,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.22.8"
+version = "0.23.1"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/src/health.rs b/screenpipe-app-tauri/src-tauri/src/health.rs
index 6e47b64aa..6ee8ab9fd 100644
--- a/screenpipe-app-tauri/src-tauri/src/health.rs
+++ b/screenpipe-app-tauri/src-tauri/src/health.rs
@@ -1,7 +1,6 @@
use anyhow::Result;
use serde::Deserialize;
use tokio::time::{interval, Duration};
-use tracing::info;
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
diff --git a/screenpipe-app-tauri/src-tauri/src/store.rs b/screenpipe-app-tauri/src-tauri/src/store.rs
index 0476ae0c4..4139dcf34 100644
--- a/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -64,19 +64,3 @@ pub fn get_store(
.map_err(|e| anyhow::anyhow!(e))?)
}
-pub async fn get_profiles_config(app: &AppHandle) -> anyhow::Result<ProfilesConfig> {
- let base_dir = get_base_dir(app, None)?;
- let profiles_path = base_dir.join("profiles.bin");
- let profiles_store = StoreBuilder::new(app, profiles_path).build()?;
-
- Ok(ProfilesConfig {
- active_profile: profiles_store
- .get("activeProfile")
- .and_then(|v| v.as_str().map(String::from))
- .unwrap_or_else(|| "default".to_string()),
- profiles: profiles_store
- .get("profiles")
- .and_then(|v| serde_json::from_value(v.clone()).ok())
- .unwrap_or_else(|| vec!["default".to_string()]),
- })
-}
diff --git a/screenpipe-app-tauri/src-tauri/tauri.conf.json b/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 512eacae3..6d31fe041 100644
--- a/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -81,6 +81,10 @@
{
"host": "screenpi.pe",
"pathPrefix": ["/auth"]
+ },
+ {
+ "host": "screenpi.pe",
+ "pathPrefix": ["/stripe-connect"]
}
]
}