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(integrations): proxy pipedream catalog icons through image proxy (#5727)

Eric Hayes111d5f75fb59
diff --git a/apps/web/src/features/settings/PipedreamIntegrations.tsx b/apps/web/src/features/settings/PipedreamIntegrations.tsx
index e8f1d376d4..fb735acb4a 100644
--- a/apps/web/src/features/settings/PipedreamIntegrations.tsx
+++ b/apps/web/src/features/settings/PipedreamIntegrations.tsx
@@ -4,6 +4,7 @@ import {
pipedreamAppAvailableInEnv,
} from '@core/component/AI/constant/mcpServers';
import { toast } from '@core/component/Toast/Toast';
+import { proxyImageUrl } from '@core/util/imageProxy';
import PlugIcon from '@phosphor-icons/core/regular/plug.svg?component-solid';
import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
import {
@@ -155,6 +156,8 @@ function CatalogRow(props: { entry: PipedreamCatalogEntryResponse }) {
/**
* Connector icon: our bundled SVG for the apps we ship icons for, the
* directory-provided icon otherwise, and a generic plug as the fallback.
+ * Directory icons load through the image proxy — the app's COEP blocks
+ * cross-origin images from hosts that don't send CORP headers.
*/
function CatalogIcon(props: { entry: PipedreamCatalogEntryResponse }) {
const BundledIcon = () => PIPEDREAM_ICON_MAP.get(props.entry.app_slug);
@@ -168,7 +171,7 @@ function CatalogIcon(props: { entry: PipedreamCatalogEntryResponse }) {
>
{(iconUrl) => (
<img
- src={iconUrl()}
+ src={proxyImageUrl(iconUrl())}
alt=""
loading="lazy"
class="size-5 rounded object-contain"
diff --git a/apps/web/src/lib/core/email/proxy-email-images.ts b/apps/web/src/lib/core/email/proxy-email-images.ts
index d096fdf24d..ae744d235f 100644
--- a/apps/web/src/lib/core/email/proxy-email-images.ts
+++ b/apps/web/src/lib/core/email/proxy-email-images.ts
@@ -1,4 +1,4 @@
-import { SERVER_HOSTS } from '../constant/servers';
+import { proxyImageUrl } from '../util/imageProxy';
/**
* Serves images through image proxy service to avoid storing data.
@@ -13,10 +13,10 @@ export function proxyEmailImages(html: string): string {
for (const img of images) {
const src = img.getAttribute('src')?.replace(/\s/g, '');
if (!src) continue;
- if (!src.startsWith('http://') && !src.startsWith('https://')) continue;
+ const proxied = proxyImageUrl(src);
+ if (proxied === src) continue;
- const proxiedUrl = `${SERVER_HOSTS['image-proxy-service']}/proxy?url=${encodeURIComponent(src)}`;
- img.setAttribute('src', proxiedUrl);
+ img.setAttribute('src', proxied);
}
return container.innerHTML;
diff --git a/apps/web/src/lib/core/util/imageProxy.ts b/apps/web/src/lib/core/util/imageProxy.ts
new file mode 100644
index 0000000000..6ef6d652c3
--- /dev/null
+++ b/apps/web/src/lib/core/util/imageProxy.ts
@@ -0,0 +1,15 @@
+import { SERVER_HOSTS } from '../constant/servers';
+
+/**
+ * Rewrite an external image URL to load through the image proxy service.
+ *
+ * The app is served with `Cross-Origin-Embedder-Policy: require-corp`, so
+ * cross-origin images are blocked unless the host opts in via CORP/CORS
+ * headers. The proxy fetches the upstream image server-side and responds
+ * with `Cross-Origin-Resource-Policy: cross-origin`, so proxied images
+ * always render. Non-HTTP(S) URLs (e.g. `data:`) are returned unchanged.
+ */
+export function proxyImageUrl(src: string): string {
+ if (!src.startsWith('http://') && !src.startsWith('https://')) return src;
+ return `${SERVER_HOSTS['image-proxy-service']}/proxy?url=${encodeURIComponent(src)}`;
+}