@crowdedkingdoms/crowdyjs 13.9.0 → 14.1.0
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/MIGRATION.md +44 -0
- package/README.md +68 -33
- package/dist/binary-relay.d.ts +1 -1
- package/dist/binary-relay.js +1 -1
- package/dist/client.d.ts +27 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +61 -2
- package/dist/crowdy-client.d.ts +29 -34
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +67 -40
- package/dist/datacenter-redirect.d.ts +49 -0
- package/dist/datacenter-redirect.d.ts.map +1 -0
- package/dist/datacenter-redirect.js +62 -0
- package/dist/domains/appAccess.d.ts +3 -3
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +16 -16
- package/dist/domains/apps.d.ts +4 -8
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +19 -23
- package/dist/domains/auth.d.ts +1 -1
- package/dist/domains/billing.d.ts +3 -3
- package/dist/domains/billing.d.ts.map +1 -1
- package/dist/domains/billing.js +9 -9
- package/dist/domains/controlPlane.d.ts +2 -2
- package/dist/domains/controlPlane.d.ts.map +1 -1
- package/dist/domains/controlPlane.js +4 -4
- package/dist/domains/discovery.d.ts +50 -0
- package/dist/domains/discovery.d.ts.map +1 -0
- package/dist/domains/discovery.js +35 -0
- package/dist/domains/marketplace.d.ts +4 -5
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +25 -26
- package/dist/domains/organizations.d.ts +3 -3
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +22 -22
- package/dist/domains/payments.d.ts +3 -3
- package/dist/domains/payments.d.ts.map +1 -1
- package/dist/domains/payments.js +11 -11
- package/dist/domains/platform.d.ts +5 -6
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +6 -7
- package/dist/domains/portal.d.ts +19 -2
- package/dist/domains/portal.d.ts.map +1 -1
- package/dist/domains/portal.js +12 -12
- package/dist/domains/quotas.d.ts +3 -3
- package/dist/domains/quotas.d.ts.map +1 -1
- package/dist/domains/quotas.js +8 -8
- package/dist/domains/serverStatus.d.ts +1 -2
- package/dist/domains/serverStatus.d.ts.map +1 -1
- package/dist/domains/serverStatus.js +1 -2
- package/dist/domains/sharedEnvironment.d.ts +3 -3
- package/dist/domains/sharedEnvironment.d.ts.map +1 -1
- package/dist/domains/sharedEnvironment.js +15 -15
- package/dist/domains/udp.d.ts +1 -1
- package/dist/domains/udp.js +1 -1
- package/dist/domains/usage.d.ts +2 -2
- package/dist/domains/usage.d.ts.map +1 -1
- package/dist/domains/usage.js +5 -5
- package/dist/domains/users.d.ts +1 -1
- package/dist/domains/users.js +1 -1
- package/dist/errors.d.ts +56 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +64 -0
- package/dist/generated/graphql.d.ts +65 -16
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +1 -0
- package/dist/index.d.ts +13 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -17
- package/dist/kit/decks.d.ts +1 -1
- package/dist/kit/npcs.d.ts +2 -2
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/worldsim.d.ts +1 -1
- package/dist/realtime.d.ts +26 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +83 -0
- package/dist/rediscover.d.ts +7 -3
- package/dist/rediscover.d.ts.map +1 -1
- package/dist/rediscover.js +7 -3
- package/dist/session.d.ts +21 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +23 -0
- package/package.json +1 -1
package/dist/session.js
CHANGED
|
@@ -8,6 +8,10 @@ export class BrowserLocalStorageTokenStore {
|
|
|
8
8
|
constructor(key = 'crowdyjs:token') {
|
|
9
9
|
this.key = key;
|
|
10
10
|
}
|
|
11
|
+
/** The key a game's app-scoped token belongs under. Per game, on purpose. */
|
|
12
|
+
static appKey(basePath) {
|
|
13
|
+
return `crowdyjs:app:${basePath}`;
|
|
14
|
+
}
|
|
11
15
|
get() {
|
|
12
16
|
if (typeof localStorage === 'undefined')
|
|
13
17
|
return null;
|
|
@@ -24,6 +28,25 @@ export class BrowserLocalStorageTokenStore {
|
|
|
24
28
|
localStorage.removeItem(this.key);
|
|
25
29
|
}
|
|
26
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The key an IDENTITY session token belongs under: one per origin, shared by every
|
|
33
|
+
* game on it.
|
|
34
|
+
*
|
|
35
|
+
* WHY THIS EXISTS AS A NAMED CONSTANT. Games were storing their credential under
|
|
36
|
+
* `'crowdyjs:app:' + import.meta.env.BASE_URL` — the game's own PATH — so two games on
|
|
37
|
+
* `crowdy.games` had different keys on the SAME origin and could not see each other's
|
|
38
|
+
* login. What was stored was an app token anyway, which is per-game by definition, so
|
|
39
|
+
* there was nothing cross-app to share even if the key had matched. A player who
|
|
40
|
+
* signed in for one game was anonymous to the next and got bounced back to the portal.
|
|
41
|
+
*
|
|
42
|
+
* The schema split makes the fix structural rather than a workaround: the identity
|
|
43
|
+
* session token is now its own object with its own lifetime, so it belongs under one
|
|
44
|
+
* origin-wide key, while app tokens stay per-game. The storage split mirrors the
|
|
45
|
+
* database split.
|
|
46
|
+
*
|
|
47
|
+
* Deliberately NOT parameterised by BASE_URL. That parameter was the bug.
|
|
48
|
+
*/
|
|
49
|
+
BrowserLocalStorageTokenStore.SESSION_KEY = 'crowdyjs:session';
|
|
27
50
|
/**
|
|
28
51
|
* In-memory token holder with change notifications and optional persistence via
|
|
29
52
|
* a {@link TokenStore}. Setting the token fans out to every {@link onChange}
|
package/package.json
CHANGED