pi-web
pi-web copied to clipboard
CSRF check fails when running as PWA (Android "Add to Home Screen")
Environment
- pi-web version: 0.8.2
- pi version: 0.82.1
- Device: Android 16 (Termux)
- Node.js: 24.18.0
Steps to reproduce
- Open pi-web in Chrome on Android at
http://127.0.0.1:30141 - Click the menu → "Add to Home Screen" / "安装应用"
- Open the installed PWA shortcut
- Click the history button (counter-clockwise clock icon) in the top bar
Expected
History panel opens normally.
Actual
Returns error: {"error":"Untrusted API request"}
Additional context
- Works fine in the browser directly, only fails in PWA mode
- Likely caused by
Sec-Fetch-Siteheader being different in PWA WebView - Also related:
new URL(request.url)in the CSRF check uses a relative path (e.g./api/plugins) instead of a full URL in Next.js route handlers
fixed in d3627646887908a95890e3f09c5a08fc6b9d8d31