# Local noconfirm + referrer test

Docs: [docs/POSPRINT-URL.md](../../docs/POSPRINT-URL.md).

Loopback (`127.0.0.1` / `localhost`) is allowed for referrer verification.

## 1. Start the verify server

```powershell
python scripts/test-noconfirm/server.py
```

- `GET http://127.0.0.1:8765/verify?code=84923` → **200**
- `GET http://127.0.0.1:8765/verify?code=wrong` → **403**

## 2. Build and open the test URL

```powershell
cargo build
$base = cargo run --quiet -- link examples/noconfirm-demo.pos
$ref = [uri]::EscapeDataString("http://127.0.0.1:8765/verify?code=84923")
$url = "$base&noconfirm=1&referrer=$ref"
$url
# Prefer the built GUI binary (no console flash):
Start-Process ".\target\debug\posprint.exe" $url
```

First run: trust dialog for `127.0.0.1`. After **Trust and print**, the next open should print without asking (while the server still returns 200).

Bad code (should fail verification):

```powershell
$refBad = [uri]::EscapeDataString("http://127.0.0.1:8765/verify?code=nope")
Start-Process ".\target\debug\posprint.exe" "$base&noconfirm=1&referrer=$refBad"
```
