feat: support zero-config LAN access for local development

Auto-rewrite loopback API URLs to current page host in browser
Allow CORS for private LAN IPs when localhost origin is configured
Remove display limit for related Pokémon in detail view
This commit is contained in:
2026-05-13 10:55:31 +08:00
parent 231a7bb313
commit 8628bdf68b
6 changed files with 139 additions and 10 deletions

View File

@@ -4,9 +4,11 @@ POSTGRES_PASSWORD=pokopia
DATABASE_URL=postgres://pokopia:pokopia@localhost:5432/pokopia
BACKEND_PORT=3001
TRUST_PROXY=false
# The default localhost frontend origin also allows same-protocol, same-port private LAN aliases in development.
FRONTEND_ORIGIN=http://localhost:20015
APP_ORIGIN=http://localhost:20015
BACKEND_PUBLIC_ORIGIN=http://localhost:20016
# Browser requests rewrite localhost/loopback API hosts to the current page host for LAN access.
NUXT_PUBLIC_API_BASE_URL=http://localhost:20016
NUXT_SERVER_API_BASE_URL=http://localhost:3001
NUXT_PUBLIC_SITE_URL=https://pokopiawiki.tootaio.com
@@ -24,6 +26,10 @@ AI_MODERATION_API_KEY=
# NUXT_PUBLIC_API_BASE_URL=http://localhost:20016
# NUXT_SERVER_API_BASE_URL=http://backend:3001
# NUXT_PUBLIC_SITE_URL=http://localhost:20015
#
# Optional LAN access example from another device:
# FRONTEND_ORIGIN=http://localhost:20015,http://10.147.20.4:20015
# NUXT_PUBLIC_API_BASE_URL=http://10.147.20.4:20016
# Cloudflared tunnel deployment example:
# FRONTEND_ORIGIN=https://pokopiawiki.tootaio.com,http://localhost:20015