diff --git a/.github/workflows/aws_dev_release.yml b/.github/workflows/aws_dev_release.yml index 9674563..46ddb74 100644 --- a/.github/workflows/aws_dev_release.yml +++ b/.github/workflows/aws_dev_release.yml @@ -62,8 +62,6 @@ jobs: - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 - with: - mask-password: 'false' - name: Image Metadata id: metadata diff --git a/.github/workflows/aws_prod_release.yml b/.github/workflows/aws_prod_release.yml index 4484006..8c9f0c7 100644 --- a/.github/workflows/aws_prod_release.yml +++ b/.github/workflows/aws_prod_release.yml @@ -50,7 +50,7 @@ jobs: cache: 'npm' - run: git config --global user.email devops@topia.io - run: git config --global user.name Devops - - run: npm version ${{ github.event.release.tag_name }} + - run: npm version --no-git-tag-version ${{ github.event.release.tag_name }} - run: npm i - run: CI=false npm run build @@ -66,8 +66,6 @@ jobs: - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 - with: - mask-password: 'false' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/package-lock.json b/package-lock.json index f7ec56c..c56c986 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@googleapis/sheets": "^7.0.0", - "@rtsdk/topia": "^0.15.8", + "@rtsdk/topia": "^0.15.9", "@types/cors": "^2.8.13", "axios": "^1.5.0", "body-parser": "^1.20.2", @@ -296,9 +296,9 @@ "dev": true }, "node_modules/@rtsdk/topia": { - "version": "0.15.8", - "resolved": "https://registry.npmjs.org/@rtsdk/topia/-/topia-0.15.8.tgz", - "integrity": "sha512-T0+pZxqMn6OcDzNIGk50B3lgRWoDBOXSmwShOepNGUyM9t7Yuu7NAMsYHKYEUfXN7X948bW5CetfwWk9Cd2K4w==" + "version": "0.15.9", + "resolved": "https://registry.npmjs.org/@rtsdk/topia/-/topia-0.15.9.tgz", + "integrity": "sha512-f8P6Teee0pca9+VIcQJcnZBCNaCjc3EzDosppeYQhI+y4HC0V/YPArp6vVjVRjVKrjd1gnz7H8QArpN7L5ICSg==" }, "node_modules/@rushstack/eslint-patch": { "version": "1.10.4", diff --git a/package.json b/package.json index 4c49c34..c90f27e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "main": "src/index.ts", "dependencies": { "@googleapis/sheets": "^7.0.0", - "@rtsdk/topia": "^0.15.8", + "@rtsdk/topia": "^0.15.9", "@types/cors": "^2.8.13", "axios": "^1.5.0", "body-parser": "^1.20.2", diff --git a/src/controllers/handleDropPiece.ts b/src/controllers/handleDropPiece.ts index fe347ff..b4ade97 100644 --- a/src/controllers/handleDropPiece.ts +++ b/src/controllers/handleDropPiece.ts @@ -16,7 +16,7 @@ import { DroppedAssetInterface } from "@rtsdk/topia"; export const handleDropPiece = async (req: Request, res: Response) => { try { - const credentials = getCredentials(req.body); + const credentials = req.credentials; const { displayName, identityId, sceneDropId, urlSlug, visitorId } = credentials; const { username } = req.body; @@ -67,8 +67,7 @@ export const handleDropPiece = async (req: Request, res: Response) => { try { try { - const timestamp = new Date(Math.round(new Date().getTime() / 5000) * 5000); - await lockDataObject(`${keyAssetId}-${resetCount}-${turnCount}-${timestamp}`, keyAsset); + await lockDataObject(`${keyAssetId}-${resetCount}-${turnCount}`, keyAsset); } catch (error) { return res.status(409).json({ message: "Move already in progress." }); } @@ -93,9 +92,12 @@ export const handleDropPiece = async (req: Request, res: Response) => { } const world = World.create(urlSlug, { credentials }); - const droppedAssets: DroppedAssetInterface[] = await world.fetchDroppedAssetsBySceneDropId({ sceneDropId }); - const gameText = droppedAssets.find((droppedAsset) => droppedAsset.uniqueName === "gameText"); + const droppedAssets: DroppedAssetInterface[] = await world.fetchDroppedAssetsBySceneDropId({ + sceneDropId, + uniqueName: "gameText", + }); + const gameText = droppedAssets[0]; if (!shouldUpdateGame) { if (gameText) gameText.updateCustomTextAsset({}, text); throw text; diff --git a/src/controllers/handlePlayerSelection.ts b/src/controllers/handlePlayerSelection.ts index 5b9ed09..1afaded 100644 --- a/src/controllers/handlePlayerSelection.ts +++ b/src/controllers/handlePlayerSelection.ts @@ -7,7 +7,7 @@ export const handlePlayerSelection = async (req: Request, res: Response) => { try { const playerId = req.params.player; const isPlayer2 = parseInt(playerId) === 2; - const credentials = getCredentials(req.body); + const credentials = req.credentials; const { profileId, sceneDropId, urlSlug, visitorId } = credentials; const { username } = req.body; diff --git a/src/utils/droppedAssets/getDroppedAssetDataObject.ts b/src/utils/droppedAssets/getDroppedAssetDataObject.ts index f95bf37..8f42aca 100644 --- a/src/utils/droppedAssets/getDroppedAssetDataObject.ts +++ b/src/utils/droppedAssets/getDroppedAssetDataObject.ts @@ -1,6 +1,5 @@ import { errorHandler, DroppedAsset, initializeDroppedAssetDataObject, World } from "../index.js"; import { Credentials, WorldDataObjectType } from "../../types/index.js"; -import { DroppedAssetInterface } from "@rtsdk/topia"; export const getDroppedAssetDataObject = async (credentials: Credentials, isKeyAsset: boolean) => { try { @@ -18,8 +17,7 @@ export const getDroppedAssetDataObject = async (credentials: Credentials, isKeyA keyAssetId = dataObject[sceneDropId].keyAssetId; } else { // find key asset by sceneDropId and unique name - const droppedAssets: DroppedAssetInterface[] = await world.fetchDroppedAssetsBySceneDropId({ sceneDropId }); - keyAsset = droppedAssets.find((droppedAsset) => droppedAsset.uniqueName === "reset"); + keyAsset = await DroppedAsset.getWithUniqueName("reset", urlSlug, process.env.INTERACTIVE_SECRET!, credentials); if (!keyAsset) throw "No key asset with the unique name 'reset' found."; keyAssetId = keyAsset?.id; } diff --git a/src/utils/lockDataObject.ts b/src/utils/lockDataObject.ts index 17a7a7f..ca6ac3d 100644 --- a/src/utils/lockDataObject.ts +++ b/src/utils/lockDataObject.ts @@ -1,3 +1,3 @@ export const lockDataObject = async (lockId, recordToLock) => { - await recordToLock.updateDataObject({}, { lock: { lockId, releaseLock: false } }); + return await recordToLock.updateDataObject({}, { lock: { lockId, releaseLock: false } }); };