import { i18n } from './i18n' import { sdk } from './sdk' import { uiPort } from './utils' // One interface: the server serves the browser client, the lobby/intent HTTP API, and the SSE // game stream all from this single port (deployment.md's same-origin rule in the game repo — // baking in a second origin would break relative URLs). type: 'ui' is a label the client is // meant for a browser; it does not stop the same port from also carrying the API calls that // client makes back to itself. export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => { const uiMulti = sdk.MultiHost.of(effects, 'ui-multi') const uiMultiOrigin = await uiMulti.bindPort(uiPort, { protocol: 'http' }) const ui = sdk.createInterface(effects, { name: i18n('Multiplayer Table'), id: 'ui', description: i18n('Create or join a game, and play in the browser'), type: 'ui', masked: false, schemeOverride: null, username: null, // The splash at `/`, which is the front door to all three ways to play: solitaire, the // replay viewer, and multiplayer. Its multiplayer door probes `/api/health` on load, so // served from here it opens the lobby, and served as a plain static site it says plainly // that it needs a server. This briefly pointed at `/play.html` instead, back when that door // was hardcoded to "Coming soon" and the splash was a dead end on a real server. path: '', query: {}, }) const uiReceipt = await uiMultiOrigin.export([ui]) return [uiReceipt] })