BlueGit

timfa posprint

Files

posprint / scripts / test-noconfirm
README.md

Local noconfirm + referrer test

Docs: docs/POSPRINT-URL.md.

Production blocks localhost referrers. For this harness set:

$env:POSPRINT_ALLOW_LOCAL_REFERRER = "1"

1. Start the verify server

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 a debug posprint with the feature branch / master

cargo build
$env:POSPRINT_ALLOW_LOCAL_REFERRER = "1"

3. Open the test URL

Generate (from repo root):

cargo run --quiet -- link examples/noconfirm-demo.pos

Then append (PowerShell):

$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
Start-Process $url

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

Try a bad code to confirm refusal:

$refBad = [uri]::EscapeDataString("http://127.0.0.1:8765/verify?code=nope")
Start-Process "$base&noconfirm=1&referrer=$refBad"