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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: gracefully handle Intercom blocked in China
Louis Beaumont0fbab413fee1
diff --git a/apps/screenpipe-app-tauri/components/settings/feedback-section.tsx b/apps/screenpipe-app-tauri/components/settings/feedback-section.tsxindex 85e9b0dfc..a10ac3a44 100644--- a/apps/screenpipe-app-tauri/components/settings/feedback-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/feedback-section.tsx@@ -13,13 +13,13 @@ const INTERCOM_APP_ID = "exoiquii";function useIntercom() {const loadedRef = useRef(false);+ const [available, setAvailable] = useState(false);const { settings } = useSettings();useEffect(() => {if (loadedRef.current) return;loadedRef.current = true;- // Load Intercom scriptconst w = window as any;w.intercomSettings = {api_base: "https://api-iam.intercom.io",@@ -30,6 +30,7 @@ function useIntercom() {if (typeof w.Intercom === "function") {w.Intercom("reattach_activator");w.Intercom("update", w.intercomSettings);+ setAvailable(true);} else {const ic = function (...args: any[]) {ic.q.push(args);@@ -44,11 +45,27 @@ function useIntercom() {s.type = "text/javascript";s.async = true;s.src = `https://widget.intercom.io/widget/${INTERCOM_APP_ID}`;+ s.onload = () => setAvailable(true);+ s.onerror = () => {+ console.warn("intercom script failed to load (blocked or offline)");+ setAvailable(false);+ };++ // Timeout: if script hasn't loaded in 5s, assume blocked+ const timeout = setTimeout(() => {+ if (!s.onload) return; // already resolved+ if (typeof w.Intercom !== "function" || !w.Intercom.booted) {+ console.warn("intercom load timed out, hiding chat button");+ setAvailable(false);+ }+ }, 5000);+document.head.appendChild(s);++ return () => clearTimeout(timeout);}return () => {- // Hide messenger on unmount (don't fully shut down — script stays loaded)if (typeof w.Intercom === "function") {w.Intercom("hide");}@@ -56,6 +73,7 @@ function useIntercom() {}, [settings.user?.email]);return {+ available,show: () => {const w = window as any;if (typeof w.Intercom === "function") {@@ -92,23 +110,25 @@ export function FeedbackSection() {<ShareLogsButton showShareLink={true} /></div>- <div className="px-3 py-2.5 bg-card border border-border">- <div className="flex items-center justify-between">- <div className="flex items-center gap-2.5">- <MessageSquare className="h-4 w-4 text-muted-foreground shrink-0" />- <div>- <h3 className="text-sm font-medium text-foreground">Live chat with us</h3>- <p className="text-xs text-muted-foreground">talk to the team directly</p>+ {intercom.available && (+ <div className="px-3 py-2.5 bg-card border border-border">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2.5">+ <MessageSquare className="h-4 w-4 text-muted-foreground shrink-0" />+ <div>+ <h3 className="text-sm font-medium text-foreground">Live chat with us</h3>+ <p className="text-xs text-muted-foreground">talk to the team directly</p>+ </div></div>+ <button+ onClick={() => intercom.show()}+ className="text-xs text-muted-foreground hover:text-foreground transition-colors duration-150"+ >+ open chat →+ </button></div>- <button- onClick={() => intercom.show()}- className="text-xs text-muted-foreground hover:text-foreground transition-colors duration-150"- >- open chat →- </button></div>- </div>+ )}<div className="px-3 py-2.5 bg-card border border-border"><div className="flex items-center justify-between">diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex 9fe03b5ec..b61882c82 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -8223,7 +8223,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.2.0"+version = "2.2.1"dependencies = ["anyhow","arboard",