glitchgrab 1.43.0 → 1.45.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 +53 -0
- package/dist/index.d.mts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +701 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +731 -104
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +29 -22
- package/dist/server.d.ts +29 -22
- package/dist/server.js +26 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +26 -1
- package/dist/server.mjs.map +1 -1
- package/dist/{types-YpA_jHFp.d.mts → types-Lldp5noh.d.mts} +7 -0
- package/dist/{types-YpA_jHFp.d.ts → types-Lldp5noh.d.ts} +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,12 +67,65 @@ interface GlitchgrabSession {
|
|
|
67
67
|
name: string; // required - reporter's display name
|
|
68
68
|
email?: string | null; // optional
|
|
69
69
|
phone?: string | null; // optional
|
|
70
|
+
signature?: string | null; // optional - signSession() from "glitchgrab/server"
|
|
70
71
|
[key: string]: unknown; // any extra fields
|
|
71
72
|
}
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
The `userId` is stored with every report. Use it to look up which user reported a bug in your own database.
|
|
75
76
|
|
|
77
|
+
## How do I protect my token?
|
|
78
|
+
|
|
79
|
+
Your `gg_` token ships in your app's JavaScript, so anyone can copy it. That is by design — it can only file reports into one repo — but the AI features (the assistant, AI enhance, voice input, "already reported?") cost money on every call. Three things stop a copied token being abused:
|
|
80
|
+
|
|
81
|
+
- **Rate limits.** Every token route is limited per token and per IP address. Nothing to configure.
|
|
82
|
+
- **Allowed domains.** On the **Tokens** page, list the sites allowed to use a token from a browser (`https://app.example.com` — subdomains are included). Requests from any other website are refused. Empty means any site. A server-side script can fake the `Origin` header, so this stops the token being pasted into another website, not a determined attacker. Report filing from `glitchgrab/server`, MCP and CI is never affected.
|
|
83
|
+
- **Signed users.** On the repo card, generate a signing secret and set **Signed users** to *Warn* or *Enforce*. Your server signs the logged-in user's id; the SDK sends that signature with its AI requests.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// app/layout.tsx — a server component
|
|
87
|
+
import { signSession } from "glitchgrab/server";
|
|
88
|
+
import { auth } from "@/lib/auth"; // your auth library
|
|
89
|
+
import { Providers } from "./providers";
|
|
90
|
+
|
|
91
|
+
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
92
|
+
const user = (await auth())?.user;
|
|
93
|
+
|
|
94
|
+
const session = user
|
|
95
|
+
? {
|
|
96
|
+
userId: user.id,
|
|
97
|
+
name: user.name ?? "User",
|
|
98
|
+
email: user.email,
|
|
99
|
+
// Reads GLITCHGRAB_SIGNING_SECRET. Server env only — never NEXT_PUBLIC_.
|
|
100
|
+
signature: signSession({ userId: user.id }),
|
|
101
|
+
}
|
|
102
|
+
: null;
|
|
103
|
+
|
|
104
|
+
return <Providers session={session}>{children}</Providers>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// app/providers.tsx — "use client"
|
|
108
|
+
// <GlitchgrabProvider token={process.env.NEXT_PUBLIC_GLITCHGRAB_TOKEN!} session={session}>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Mode | Signed user | Unsigned or anonymous caller |
|
|
112
|
+
|------|-------------|------------------------------|
|
|
113
|
+
| Off | everything works | everything works |
|
|
114
|
+
| Warn | everything works | everything works; the SDK logs a warning in development |
|
|
115
|
+
| Enforce | everything works | AI features are hidden — **the plain report form still files** |
|
|
116
|
+
|
|
117
|
+
- A signature lasts 24 hours by default (`signSession({ userId, ttlSeconds })`). Build it per request so it refreshes.
|
|
118
|
+
- Rotating the secret breaks signatures already issued until your pages render again with the new one.
|
|
119
|
+
- `signSession` throws when the secret or `userId` is missing — it runs on your server, where that is a deploy mistake worth seeing. The rest of the SDK never throws.
|
|
120
|
+
|
|
121
|
+
## What data does Glitchgrab collect about reporters?
|
|
122
|
+
|
|
123
|
+
Besides what the reporter types and the `session` you pass, every report records the **IP address it came from, an approximate location (city, region, country) and the network (ISP / ASN)**. Only you, the repo owner, can see it in Glitchgrab — it is never written into the GitHub issue. The raw IP is deleted after 90 days; a one-way hash, the location and the network are kept so repeat reports from one address can still be grouped.
|
|
124
|
+
|
|
125
|
+
Reports sent from `glitchgrab/server` record your server's address, not an end user's.
|
|
126
|
+
|
|
127
|
+
If your users are in India or the EU, mention this in your privacy policy (DPDP Act / GDPR treat an IP address as personal data).
|
|
128
|
+
|
|
76
129
|
## How do I add a report button?
|
|
77
130
|
|
|
78
131
|
### Default floating button
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, h as ReportPayload, i as ReportResult } from './types-
|
|
3
|
-
export { G as GlitchgrabConfig, j as ReportSeverity, k as ReportType, l as RuntimeInfo } from './types-
|
|
2
|
+
import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, h as ReportPayload, i as ReportResult } from './types-Lldp5noh.mjs';
|
|
3
|
+
export { G as GlitchgrabConfig, j as ReportSeverity, k as ReportType, l as RuntimeInfo } from './types-Lldp5noh.mjs';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
|
@@ -364,12 +364,24 @@ interface EnhanceContext {
|
|
|
364
364
|
message: string;
|
|
365
365
|
}>;
|
|
366
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* The signed-in user as the host's server vouched for them (`signSession`).
|
|
369
|
+
*
|
|
370
|
+
* Rides in the request BODY, never a header: every token route sets its own
|
|
371
|
+
* CORS allow-list of headers, so a new header would fail preflight on all of
|
|
372
|
+
* them. Omitted entirely when there is no signature — an unsigned id proves
|
|
373
|
+
* nothing, and the server reads its absence as "unsigned".
|
|
374
|
+
*/
|
|
375
|
+
interface SignedIdentity {
|
|
376
|
+
userId?: string | null;
|
|
377
|
+
signature?: string | null;
|
|
378
|
+
}
|
|
367
379
|
/**
|
|
368
380
|
* Polish raw description text via the Glitchgrab AI enhance endpoint.
|
|
369
381
|
* Returns the polished text on success, or the original text on any failure.
|
|
370
382
|
* Never throws.
|
|
371
383
|
*/
|
|
372
|
-
declare function enhanceText(text: string, token: string, baseUrl?: string, screenshot?: string | null, context?: EnhanceContext | null): Promise<string>;
|
|
384
|
+
declare function enhanceText(text: string, token: string, baseUrl?: string, screenshot?: string | null, context?: EnhanceContext | null, identity?: SignedIdentity | null): Promise<string>;
|
|
373
385
|
|
|
374
386
|
declare function computeSignature(params: {
|
|
375
387
|
errorMessage: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, h as ReportPayload, i as ReportResult } from './types-
|
|
3
|
-
export { G as GlitchgrabConfig, j as ReportSeverity, k as ReportType, l as RuntimeInfo } from './types-
|
|
2
|
+
import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, h as ReportPayload, i as ReportResult } from './types-Lldp5noh.js';
|
|
3
|
+
export { G as GlitchgrabConfig, j as ReportSeverity, k as ReportType, l as RuntimeInfo } from './types-Lldp5noh.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
|
@@ -364,12 +364,24 @@ interface EnhanceContext {
|
|
|
364
364
|
message: string;
|
|
365
365
|
}>;
|
|
366
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* The signed-in user as the host's server vouched for them (`signSession`).
|
|
369
|
+
*
|
|
370
|
+
* Rides in the request BODY, never a header: every token route sets its own
|
|
371
|
+
* CORS allow-list of headers, so a new header would fail preflight on all of
|
|
372
|
+
* them. Omitted entirely when there is no signature — an unsigned id proves
|
|
373
|
+
* nothing, and the server reads its absence as "unsigned".
|
|
374
|
+
*/
|
|
375
|
+
interface SignedIdentity {
|
|
376
|
+
userId?: string | null;
|
|
377
|
+
signature?: string | null;
|
|
378
|
+
}
|
|
367
379
|
/**
|
|
368
380
|
* Polish raw description text via the Glitchgrab AI enhance endpoint.
|
|
369
381
|
* Returns the polished text on success, or the original text on any failure.
|
|
370
382
|
* Never throws.
|
|
371
383
|
*/
|
|
372
|
-
declare function enhanceText(text: string, token: string, baseUrl?: string, screenshot?: string | null, context?: EnhanceContext | null): Promise<string>;
|
|
384
|
+
declare function enhanceText(text: string, token: string, baseUrl?: string, screenshot?: string | null, context?: EnhanceContext | null, identity?: SignedIdentity | null): Promise<string>;
|
|
373
385
|
|
|
374
386
|
declare function computeSignature(params: {
|
|
375
387
|
errorMessage: string | undefined;
|