Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "game-services",
"version": "0.95.1",
"version": "0.96.0",
"description": "",
"main": "src/index.ts",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/entities/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Game from './game'
import User from './user'

export enum APIKeyScope {
READ_PLAYER_PRESENCE = 'read:playerPresence',
WRITE_PLAYER_PRESENCE = 'write:playerPresence',
READ_GAME_CHANNELS = 'read:gameChannels',
WRITE_GAME_CHANNELS = 'write:gameChannels',
READ_PLAYER_GROUPS = 'read:playerGroups',
Expand Down
2 changes: 1 addition & 1 deletion src/entities/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default class Player {

const conns = await socket.findConnectionsAsync(async (conn) => {
return (
conn.hasScope(APIKeyScope.READ_PLAYERS) &&
conn.hasScope(APIKeyScope.READ_PLAYER_PRESENCE) &&
!!conn.playerAliasId &&
this.game.id === (await conn.getPlayerAlias())?.player.game.id
)
Expand Down
3 changes: 2 additions & 1 deletion tests/services/_api/player-presence-api/put.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe('Player presence API service - put', () => {
it('should notify other players when presence is updated', async () => {
const { identifyMessage, ticket, player, token } = await createSocketIdentifyMessage([
APIKeyScope.READ_PLAYERS,
APIKeyScope.WRITE_PLAYERS
APIKeyScope.WRITE_PLAYERS,
APIKeyScope.READ_PLAYER_PRESENCE
])

await em.persistAndFlush(player)
Expand Down
Loading