Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(desktop): load GIF search results in the desktop app (#8938)

Eric Hayesc52fff9f142d
diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsx
index d85b9c1c0a..8bce11c741 100644
--- a/apps/web/src/index.tsx
+++ b/apps/web/src/index.tsx
@@ -22,6 +22,10 @@ import { Root } from './routes/Root';
perfMark('boot.entry-evaluated');
+// Third-party APIs that allow any origin and require requests from the user's
+// browser. The native HTTP client's scope doesn't list them and rejects them.
+const WEBVIEW_FETCH_HOSTS = new Set(['api.klipy.com']);
+
// Override global fetch with platformFetch for Tauri compatibility
// Skip localhost requests (dev server) to avoid breaking HMR
if (isTauri()) {
@@ -30,16 +34,19 @@ if (isTauri()) {
apply: (target, thisArg, args) => {
const url = args[0];
// Resolve bundled asset paths before checking the existing localhost bypass.
- let urlString: string;
+ let resolvedUrl: URL;
try {
- urlString = new URL(
+ resolvedUrl = new URL(
url instanceof Request ? url.url : String(url),
document.baseURI
- ).href;
+ );
} catch (error) {
return Promise.reject(error);
}
- if (urlString.includes('localhost')) {
+ if (
+ resolvedUrl.href.includes('localhost') ||
+ WEBVIEW_FETCH_HOSTS.has(resolvedUrl.hostname)
+ ) {
return target.apply(thisArg, args as Parameters<typeof fetch>);
}
return platformFetch.apply(thisArg, args as Parameters<typeof fetch>);