diff --git a/client/src/components/website/ExplanationText.tsx b/client/src/components/website/ExplanationText.tsx index 2c32bbf..283e98e 100644 --- a/client/src/components/website/ExplanationText.tsx +++ b/client/src/components/website/ExplanationText.tsx @@ -162,7 +162,7 @@ export function ExplanationText() { {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID });`} +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID });`}

Use auth client to generate player tokens (needed to create rooms) @@ -181,7 +181,7 @@ const { loginResponse } = await hathoraSdk.authV1.loginNickname({ nickname: "nam

{`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const appId = process.env.HATHORA_APP_ID; +const appId = env_variable.HATHORA_APP_ID; const hathoraSdk = new HathoraCloud({ appId }); // Custom hook to access auth token @@ -288,7 +288,7 @@ const token = useAuthToken(googleIdToken);`} {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID });`} +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID });`}

Authenticated players (via client) can create lobbies @@ -309,7 +309,7 @@ const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID });`}

Create game button

{`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID }); +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID }); // Inside create game component
{`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID }); +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID }); function useLobbies(appId: string): LobbyV3[] { const [lobbies, setLobbies] = React.useState([]); @@ -420,7 +420,7 @@ function useLobbies(appId: string): LobbyV3[] { } // Usage -const appId = process.env.HATHORA_APP_ID; +const appId = env_variable.HATHORA_APP_ID; const lobbies = useLobbies(appId);`} {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID });`} +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID });`}

Fetch lobby information, see{" "} @@ -495,7 +495,7 @@ const connection = new HathoraConnection(roomId, connectionInfoV2);`}{`import { HathoraConnection } from "@hathora/client-sdk"; import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID }); +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID }); // For Bullet Mania, we grab roomId from URL const roomIdFromUrl = getRoomIdFromUrl(); @@ -557,7 +557,7 @@ if ( roomIdFromUrl != null ) {

{`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; -const hathoraSdk = new HathoraCloud({ appId: process.env.HATHORA_APP_ID }); +const hathoraSdk = new HathoraCloud({ appId: env_variable.HATHORA_APP_ID }); // subscribeUser is called when a new user enters a room, it's an ideal place to do any player-specific initialization steps async subscribeUser(roomId: RoomId, userId: string): Promise { @@ -636,8 +636,8 @@ async subscribeUser(roomId: RoomId, userId: string): Promise { {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; const hathoraSdk = new HathoraCloud({ - appId: process.env.HATHORA_APP_ID!, - security: { hathoraDevToken: process.env.DEVELOPER_TOKEN! }, + appId: env_variable.HATHORA_APP_ID!, + security: { hathoraDevToken: env_variable.DEVELOPER_TOKEN! }, }); // RoomConfig is meant to hold custom objects @@ -650,8 +650,8 @@ const res = await hathoraSdk.roomV2.updateRoomConfig({ {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; const hathoraSdk = new HathoraCloud({ - appId: process.env.HATHORA_APP_ID!, - security: { hathoraDevToken: process.env.DEVELOPER_TOKEN! }, + appId: env_variable.HATHORA_APP_ID!, + security: { hathoraDevToken: env_variable.DEVELOPER_TOKEN! }, }); async function updateRoomConfig(game: InternalState, roomId: string) { @@ -693,8 +693,8 @@ async function updateRoomConfig(game: InternalState, roomId: string) { {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; const hathoraSdk = new HathoraCloud({ - appId: process.env.HATHORA_APP_ID!, - security: { hathoraDevToken: process.env.DEVELOPER_TOKEN! }, + appId: env_variable.HATHORA_APP_ID!, + security: { hathoraDevToken: env_variable.DEVELOPER_TOKEN! }, }); // ...Disconnect players... @@ -705,8 +705,8 @@ const lobby = hathoraSdk.roomV2.destroyRoom(roomId);`} {`import { HathoraCloud } from "@hathora/cloud-sdk-typescript"; const hathoraSdk = new HathoraCloud({ - appId: process.env.HATHORA_APP_ID!, - security: { hathoraDevToken: process.env.DEVELOPER_TOKEN! }, + appId: env_variable.HATHORA_APP_ID!, + security: { hathoraDevToken: env_variable.DEVELOPER_TOKEN! }, }); async function endGameCleanup(roomId: string, game: InternalState, winningPlayerId: string) {