glitchgrab 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/index.js +253 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +253 -275
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -455,6 +455,23 @@ import { GlitchgrabErrorBoundary } from "glitchgrab";
|
|
|
455
455
|
| `onReportSent` | `(result: ReportResult) => void` | - | Called after a report is sent |
|
|
456
456
|
| `fallback` | `ReactNode` | - | Error boundary fallback UI |
|
|
457
457
|
|
|
458
|
+
## Do I need a Content-Security-Policy allowance?
|
|
459
|
+
|
|
460
|
+
If your app sets a CSP header (e.g. via `proxy.ts` / `middleware.ts` in Next.js), allow Glitchgrab's API host so `fetch` calls from the SDK aren't blocked:
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
// proxy.ts / middleware.ts
|
|
464
|
+
response.headers.set(
|
|
465
|
+
"Content-Security-Policy",
|
|
466
|
+
"connect-src 'self' https://glitchgrab.dev; ..." // plus your existing directives
|
|
467
|
+
);
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
- `connect-src https://glitchgrab.dev` — required for `sendReport`, `enhanceText`, `transcribeAudio`, and the report-fetching hooks/REST calls. All SDK requests go to this single host by default.
|
|
471
|
+
- If you pass a custom `baseUrl` prop, allow that host instead (self-hosted or proxied deployments).
|
|
472
|
+
- Screenshot capture (`html2canvas-pro`) runs entirely client-side against `document.body` — no network request, no extra `img-src`/`connect-src` needed for it.
|
|
473
|
+
- No `script-src`, `style-src`, or `frame-src` allowances are required — the SDK doesn't load remote scripts, styles, or iframes.
|
|
474
|
+
|
|
458
475
|
## How does auto-capture work?
|
|
459
476
|
|
|
460
477
|
In production (`NODE_ENV=production`), the SDK automatically captures:
|