Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

719 B
Raw Blame
/**
 * Privacy utilities — route all external requests through local proxies
 * so external servers never see the user's IP or browsing behavior.
 */

import { isTauri } from '../api/backend'

/** Proxy an external image URL through the local server */
export function proxyImageUrl(url: string | undefined): string | undefined {
  if (!url) return undefined
  // Already local — no proxy needed
  if (url.startsWith('/') || url.startsWith('blob:') || url.startsWith('data:')) return url
  // In Tauri mode: CSP allows these domains directly (images loaded via img tag, no CORS)
  if (isTauri()) return url
  // Dev mode: route through local proxy
  return `/local-api/proxy-image?url=${encodeURIComponent(url)}`
}