Compare commits

...

1 Commits

Author SHA1 Message Date
72fc763101 Prepare Airship frontend for ChatGPT Sites portability test 2026-10-02 01:13:27 +00:00
3 changed files with 38 additions and 5 deletions

5
.env.example Normal file
View File

@ -0,0 +1,5 @@
VITE_AIRSHIP_API_BASE=https://game.arrowstack.dev
VITE_AIRSHIP_WS_BASE=wss://game.arrowstack.dev
VITE_KEYCLOAK_URL=https://auth.arrowstack.dev
VITE_KEYCLOAK_REALM=dev
VITE_KEYCLOAK_CLIENT_ID=airship-web

27
SITES.md Normal file
View File

@ -0,0 +1,27 @@
# ChatGPT Sites portability test
This branch keeps ChatGPT Sites at the presentation boundary only.
## Ownership boundary
- Sites: built Phaser/Vite frontend and static assets.
- Arrowstack: Keycloak identity, API, authoritative multiplayer simulation, PostgreSQL state, and WebSocket transport.
The browser defaults still point to:
- API: https://game.arrowstack.dev
- WebSocket: wss://game.arrowstack.dev
- Identity: https://auth.arrowstack.dev, realm `dev`, client `airship-web`
They can be overridden with the Vite variables in `.env.example`.
## First deployment
Ask Sites to build this existing Vite project without moving the Go server or game state into Sites.
Once Sites returns its production origin, add that exact HTTPS origin to:
1. the Airship Go server `ALLOWED_ORIGINS` value, and
2. the Keycloak `airship-web` client's redirect URIs and web origins.
Until those origin allow-lists are updated, the game should still render and remain usable in solo mode; authenticated multiplayer is expected to fail closed.

View File

@ -1,11 +1,12 @@
import Keycloak from 'keycloak-js'; import Keycloak from 'keycloak-js';
const API_BASE = 'https://game.arrowstack.dev'; const env = import.meta.env || {};
const WS_BASE = 'wss://game.arrowstack.dev'; const API_BASE = env.VITE_AIRSHIP_API_BASE || 'https://game.arrowstack.dev';
const WS_BASE = env.VITE_AIRSHIP_WS_BASE || 'wss://game.arrowstack.dev';
const KEYCLOAK_CONFIG = { const KEYCLOAK_CONFIG = {
url: 'https://auth.arrowstack.dev', url: env.VITE_KEYCLOAK_URL || 'https://auth.arrowstack.dev',
realm: 'dev', realm: env.VITE_KEYCLOAK_REALM || 'dev',
clientId: 'airship-web', clientId: env.VITE_KEYCLOAK_CLIENT_ID || 'airship-web',
}; };
const clamp = (value, min, max) => Math.max(min, Math.min(max, value)); const clamp = (value, min, max) => Math.max(min, Math.min(max, value));