@colyseus/core 0.18.12 → 0.18.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/MatchMaker.cjs +1 -0
- package/build/MatchMaker.cjs.map +2 -2
- package/build/MatchMaker.mjs +1 -0
- package/build/MatchMaker.mjs.map +2 -2
- package/build/Room.cjs +6 -3
- package/build/Room.cjs.map +2 -2
- package/build/Room.mjs +6 -3
- package/build/Room.mjs.map +2 -2
- package/package.json +4 -4
- package/src/MatchMaker.ts +4 -0
- package/src/Room.ts +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/core",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.14",
|
|
4
4
|
"description": "Multiplayer Framework for Node.js.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"input": "./src/index.ts",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"debug": "^4.3.4",
|
|
52
52
|
"msgpackr": "^2.0.1",
|
|
53
53
|
"nanoid": "^3.3.11",
|
|
54
|
-
"@colyseus/shared-types": "^0.18.2",
|
|
55
54
|
"@colyseus/better-call": "^1.3.1",
|
|
55
|
+
"@colyseus/shared-types": "^0.18.2",
|
|
56
56
|
"@colyseus/greeting-banner": "^4.0.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"@pm2/io": "^6.1.0",
|
|
69
69
|
"express": "^4.16.0 || ^5.0.0",
|
|
70
70
|
"zod": "^4.1.12",
|
|
71
|
+
"@colyseus/better-call": "^1.3.1",
|
|
71
72
|
"@colyseus/auth": "^0.18.2",
|
|
72
|
-
"@colyseus/ws-transport": "^0.18.2"
|
|
73
|
-
"@colyseus/better-call": "^1.3.1"
|
|
73
|
+
"@colyseus/ws-transport": "^0.18.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@colyseus/auth": {
|
package/src/MatchMaker.ts
CHANGED
|
@@ -618,6 +618,10 @@ export async function handleCreateRoom(roomName: string, clientOptions: ClientOp
|
|
|
618
618
|
|
|
619
619
|
} catch (e: any) {
|
|
620
620
|
debugAndPrintError(e);
|
|
621
|
+
|
|
622
|
+
// no matchMaker listeners yet, so this only releases the room's own timers and presence
|
|
623
|
+
room['_events'].emit('dispose');
|
|
624
|
+
|
|
621
625
|
throw new ServerError(
|
|
622
626
|
e.code || ErrorCode.MATCHMAKE_UNHANDLED,
|
|
623
627
|
e.message,
|
package/src/Room.ts
CHANGED
|
@@ -1790,15 +1790,22 @@ export class Room<T extends RoomOptions = RoomOptions> {
|
|
|
1790
1790
|
try {
|
|
1791
1791
|
if (authData) {
|
|
1792
1792
|
client.auth = authData;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
// only an own static onAuth() skips instance/plugin onAuth, not @colyseus/auth's default
|
|
1796
|
+
const authedStatically = authData && (this.constructor as typeof Room).onAuth !== Room.onAuth;
|
|
1793
1797
|
|
|
1794
|
-
|
|
1798
|
+
if (!authedStatically && this.onAuth !== Room.prototype.onAuth) {
|
|
1795
1799
|
try {
|
|
1796
|
-
|
|
1800
|
+
const result = await this.onAuth(client, joinOptions, authContext);
|
|
1797
1801
|
|
|
1798
|
-
if (!
|
|
1802
|
+
if (!result) {
|
|
1799
1803
|
throw new ServerError(ErrorCode.AUTH_FAILED, 'onAuth failed');
|
|
1800
1804
|
}
|
|
1801
1805
|
|
|
1806
|
+
// `true` adds nothing: keep the payload the default static onAuth decoded
|
|
1807
|
+
client.auth = (result === true && authData) || result;
|
|
1808
|
+
|
|
1802
1809
|
} catch (e) {
|
|
1803
1810
|
// remove seat reservation
|
|
1804
1811
|
delete this._reservedSeats[sessionId];
|