Skip to content

Commit f6042db

Browse files
committed
docs(copilot): clarify ?url= takes a SimplePDF document URL
Update the isEmbeddableUrl comment and the README example to use a real SimplePDF document URL (/documents/<id>?prefill=<id>) instead of an /editor link, so the expected ?url= shape is unambiguous.
1 parent 7402164 commit f6042db

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

copilot/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ See [`.env.example`](./.env.example) for the JSON shape, the per-share rate-limi
121121

122122
### Load a specific document via `?url=`
123123

124-
To open a specific editor URL instead of the bundled demo forms, append `?url=<editor-url>`. The value is used verbatim as the editor iframe `src`, so pass a full SimplePDF editor URL with whatever it needs (`?open=`, a locale prefix, signature-request params, a different tenant subdomain):
124+
To open a specific document instead of the bundled demo forms, append `?url=<document-url>`. The value is used verbatim as the editor iframe `src`, so pass a valid SimplePDF document URL (e.g. a `/documents/<id>` link, optionally with a `?prefill=<id>`):
125125

126126
```
127-
http://localhost:3001/?url=https%3A%2F%2Fspdf-copilot.simplepdf.com%2Feditor
127+
http://localhost:3001/?url=https%3A%2F%2Fdemo.simplepdf.com%2Fdocuments%2Fc28f061b-1974-4251-ba7a-d08bedc3ef28%3Fprefill%3D35fdf39e-2e06-4712-bb9d-f62d2f88ce50
128128
```
129129

130-
URL-encode the value whenever it carries its own query string (e.g. `?open=`), otherwise the nested params get parsed as part of the page URL and dropped.
130+
URL-encode the value whenever it carries its own query string (e.g. `?prefill=`), otherwise the nested params get parsed as part of the page URL and dropped.
131131

132132
The value must be an absolute `http(s)` URL on your configured base-domain family (`*.simplepdf.com` by default, or whatever host `VITE_SIMPLEPDF_BASE_DOMAIN` resolves to). Third-party origins are rejected on purpose: the iframe is granted clipboard access and is wired to the `postMessage` bridge, so framing an arbitrary site would hand it both. A malformed or off-domain `?url=` silently falls back to the default demo form. `?url=` combines with `?lang=` and `?share=`; when set, it wins for what the editor loads.
133133

copilot/src/routes/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ const isShowParam = (value: unknown): value is ShowParam =>
7272
typeof value === 'string' && SHOW_PARAMS.some((candidate) => candidate === value)
7373

7474
// A `?url=` value is dropped straight into the iframe `src` AND its origin
75-
// becomes the postMessage bridge target, so it must be an absolute http(s) URL
76-
// on the editor's own base-domain family (e.g. any `*.simplepdf.com` tenant).
75+
// becomes the postMessage bridge target, so it must be a valid SimplePDF
76+
// document URL on the editor's own base-domain family (e.g. any
77+
// `*.simplepdf.com` tenant), such as
78+
// https://demo.simplepdf.com/documents/c28f061b-1974-4251-ba7a-d08bedc3ef28?prefill=35fdf39e-2e06-4712-bb9d-f62d2f88ce50
7779
// Rejecting everything else keeps a crafted `?url=javascript:...`, a relative
7880
// path resolving against our own origin, or a third-party origin (which would
7981
// be framed with our clipboard permissions and wired to the bridge) out of the

0 commit comments

Comments
 (0)