@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 +1 -1
- package/dist/bus/protocol.js +8 -11
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
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
|
|
package/dist/bus/protocol.js
CHANGED
|
@@ -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
|
|
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
|
-
:
|
|
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.
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED