@arcadible/sdk 1.0.0 → 1.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/README.md CHANGED
@@ -46,7 +46,7 @@ const progress = saved ? JSON.parse(saved) : { level: 1 };
46
46
  await arcadible.saves.write("progress", JSON.stringify(progress));
47
47
  ```
48
48
 
49
- A save is a name holding one string. `ready` settles once the game's saves have loaded, and never fails; from then on, `readSync` answers from memory. Every call that fails rejects with an `ArcadibleError`, whose `code` says what to do.
49
+ A save is a name holding one string. `ready` settles once the game's saves have loaded, and never fails; from then on, `readSync` answers from memory. Every call that fails rejects (or, for `readSync`, throws) with an `ArcadibleError`, whose `code` says what to do.
50
50
 
51
51
  Off Arcadible, such as on your dev server, the package works on its own, with the same rules and limits: saves are kept on the page's own origin, and `arcadible.build` is `null`.
52
52
 
@@ -9,22 +9,19 @@ export const BUS_VERSION = 1;
9
9
  export const HANDSHAKE_TIMEOUT = 1000;
10
10
  // How long a request waits for its response.
11
11
  export const REQUEST_TIMEOUT = 10_000;
12
- // The play pages a game accepts a welcome from: production's, and `arc
13
- // serve`'s on this machine. Another development page (play.arcadible.test)
14
- // is passed with `createClient({ origins })`, never trusted by what games
15
- // ship, since a hostile network could pose as an http one.
16
- const HOST_ORIGINS = ["https://play.arcadible.com"];
17
- // `arc serve`'s play page, on any port. The network can't pose as loopback,
18
- // and on Arcadible a build's `frame-ancestors` lets only the play page frame
19
- // it, so no local page can reach a player's saves there.
20
- const LOCAL_ORIGIN = /^http:\/\/localhost:\d+$/u;
21
12
  // [function]
22
13
  // Whether a game accepts a welcome from `origin`: one of `origins` when it
23
- // was given, or else production's or `arc serve`'s.
14
+ // was given (tests, and development pages), or else any real origin, `http`
15
+ // included, whatever framed it. Who may frame a build is decided outside the
16
+ // game, where it can change: on Arcadible by each build's `frame-ancestors`,
17
+ // which the browser enforces before the game runs, and elsewhere by whoever
18
+ // serves it. So the host is never trusted with anything of value (DESIGN.md,
19
+ // section 4). Only `null` is refused: a `file://` page or a sandboxed frame,
20
+ // which can't be told apart.
24
21
  export function isHostOrigin(origin, origins) {
25
22
  return origins
26
23
  ? origins.includes(origin)
27
- : HOST_ORIGINS.includes(origin) || LOCAL_ORIGIN.test(origin);
24
+ : origin !== "null" && origin !== "";
28
25
  }
29
26
  // The most requests one game can have waiting on the page; past it, a
30
27
  // request fails with `busy`.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.0.0";
1
+ export declare const VERSION = "1.1.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // The client's version, sent in its hello and shown as `arcadible.version`,
2
2
  // for bug reports. It matches package.json (test/unit/protocol.test.ts).
3
- export const VERSION = "1.0.0";
3
+ export const VERSION = "1.1.0";
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  ],
44
44
  "type": "module",
45
45
  "types": "./dist/index.d.ts",
46
- "version": "1.0.0"
46
+ "version": "1.1.0"
47
47
  }