From 2b999b9a06617cbc624c2fc89684ccd6963a0ddd Mon Sep 17 00:00:00 2001 From: DongHoonYu96 Date: Thu, 28 Nov 2024 14:38:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20[BE]=20cors,=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=EC=84=A4=EC=A0=95=EB=AA=A8=EB=8B=AC=20=EB=9D=84?= =?UTF-8?q?=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 9 +++++---- BE/src/game/game.gateway.ts | 7 +++++-- BE/src/game/service/game.room.service.ts | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c1ff172..8eab7ee 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ on: branches: [ "release" ] env: - NODE_ENV: test + NODE_ENV: production DB_HOST_TEST: localhost DB_PORT_TEST: 3306 DB_PASSWD_TEST: test @@ -55,9 +55,9 @@ jobs: run: | echo '${{ secrets.ENV }}' > .env -# - name: BE 테스트 코드 실행 (unit test) -# working-directory: ./BE -# run: npm run test + # - name: BE 테스트 코드 실행 (unit test) + # working-directory: ./BE + # run: npm run test - name: BE 테스트 코드 실행2 (integration test) working-directory: ./BE @@ -83,6 +83,7 @@ jobs: BE/dist \ BE/package.json \ BE/package-lock.json \ + BE/ecosystem.config.js \ .env \ FE/dist \ FE/package.json \ diff --git a/BE/src/game/game.gateway.ts b/BE/src/game/game.gateway.ts index 73767b1..0968f55 100644 --- a/BE/src/game/game.gateway.ts +++ b/BE/src/game/game.gateway.ts @@ -31,9 +31,12 @@ import { ExceptionMessage } from '../common/constants/exception-message'; @UseInterceptors(GameActivityInterceptor) @UseFilters(new WsExceptionFilter()) @WebSocketGateway({ + // cors: { + // origin: ['*,', 'https://admin.socket.io'], //이러면 배포에서 cors오류 생김 + // credentials: true + // }, cors: { - origin: ['*,', 'https://admin.socket.io'], - credentials: true + origin: '*' //이러면 배포에서 admin ui 접근 안됨 }, namespace: '/game' }) diff --git a/BE/src/game/service/game.room.service.ts b/BE/src/game/service/game.room.service.ts index 8f8e3fb..959e5e6 100644 --- a/BE/src/game/service/game.room.service.ts +++ b/BE/src/game/service/game.room.service.ts @@ -109,7 +109,7 @@ export class GameRoomService { await this.redis.set(`${playerKey}:Changes`, 'Join'); await this.redis.hset(playerKey, { - playerName: '닉네임 설정 이전', + playerName: '', //이래야 프론트에서 모달을 띄워주는 조건 positionX: positionX.toString(), positionY: positionY.toString(), disconnected: '0', From 3ff35b6de436a29fd59b79b6f7e6c0c301e08433 Mon Sep 17 00:00:00 2001 From: DongHoonYu96 Date: Thu, 28 Nov 2024 15:23:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20[BE]=20=EA=B0=95=ED=87=B4=EC=95=88?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit client.id는 소켓의 uuid, room.host에는 쿠키값이 저장되어 있었음 --- BE/src/game/game.gateway.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/game/game.gateway.ts b/BE/src/game/game.gateway.ts index 0968f55..9ec1327 100644 --- a/BE/src/game/game.gateway.ts +++ b/BE/src/game/game.gateway.ts @@ -141,7 +141,7 @@ export class GameGateway { @SubscribeMessage(SocketEvents.KICK_ROOM) @UsePipes(new GameValidationPipe(SocketEvents.KICK_ROOM)) async handleKickRoom(@MessageBody() kickRoomDto: KickRoomDto, @ConnectedSocket() client: Socket) { - await this.gameRoomService.kickRoom(kickRoomDto, client.id); + await this.gameRoomService.kickRoom(kickRoomDto, client.data.playerId); } afterInit(nameSpace: Namespace) {