@protobase/cli 0.95.15 → 0.96.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/dist/cli/package.js
CHANGED
|
@@ -6,6 +6,7 @@ import { capacitorOrigin } from "@protobase/schema/internal";
|
|
|
6
6
|
const protobasePlugin = "@protobase/mobile";
|
|
7
7
|
const keyboardPlugin = "@capacitor/keyboard";
|
|
8
8
|
const liveUpdatePlugin = "@capawesome/capacitor-live-update";
|
|
9
|
+
const splashPlugin = "@capacitor/splash-screen";
|
|
9
10
|
const pushPresentation = [
|
|
10
11
|
"badge",
|
|
11
12
|
"sound",
|
|
@@ -16,9 +17,9 @@ const readyTimeout = 3e4;
|
|
|
16
17
|
* The app's `capacitor.config.json`, every key it sets named here. It never sets `server.url`, the hostname or the
|
|
17
18
|
* schemes (the API's CORS list names Capacitor's default origins). WebView debugging is off in an iOS release by name:
|
|
18
19
|
* Capacitor's prebuilt simulator framework is a Debug build, so its default lists a Release app in Safari's Develop menu.
|
|
19
|
-
* `plugins` configures ProtobaseAuth, the keyboard plugin
|
|
20
|
-
*
|
|
21
|
-
* files, background updates off, a rolled-back bundle blocked and `readyTimeout`, within which the shell must call
|
|
20
|
+
* `plugins` configures ProtobaseAuth, the keyboard plugin, the splash screen, which stays up until the shell hides it,
|
|
21
|
+
* and, with the live updater, what its guard needs: the key releases are signed with, where they come from, the
|
|
22
|
+
* binary's fingerprint, shell version and the order of its own files, background updates off, a rolled-back bundle blocked and `readyTimeout`, within which the shell must call
|
|
22
23
|
* ready() or the app goes back to its own files. CapacitorHttp and CapacitorCookies stay off; the keyboard plugin
|
|
23
24
|
* resizes natively, its default, and fills the space beside the keyboard's rounded corners with the page's background
|
|
24
25
|
* instead of black. With `push`, Capacitor's push plugin is compiled in and shows a push while the app is open, and on
|
|
@@ -38,6 +39,7 @@ const capacitorConfig = ({ appId, appName, fingerprint, shellVersion, plugins, l
|
|
|
38
39
|
...liveUpdate ? [liveUpdatePlugin] : [],
|
|
39
40
|
...push ? [pushPlugin] : [],
|
|
40
41
|
keyboardPlugin,
|
|
42
|
+
splashPlugin,
|
|
41
43
|
protobasePlugin
|
|
42
44
|
],
|
|
43
45
|
plugins: {
|
|
@@ -46,6 +48,7 @@ const capacitorConfig = ({ appId, appName, fingerprint, shellVersion, plugins, l
|
|
|
46
48
|
origin: capacitorOrigin[platform]
|
|
47
49
|
},
|
|
48
50
|
Keyboard: { autoBackdropColor: "dom" },
|
|
51
|
+
SplashScreen: { launchAutoHide: false },
|
|
49
52
|
...push && { PushNotifications: { presentationOptions: pushPresentation } },
|
|
50
53
|
...apnsEnvironment && { ProtobasePush: { environment: apnsEnvironment } },
|
|
51
54
|
...liveUpdate && { LiveUpdate: {
|
package/dist/mobile/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.
|
|
47
|
-
"@protobase/layout": "0.
|
|
48
|
-
"@protobase/query": "0.
|
|
49
|
-
"@protobase/schema": "0.
|
|
50
|
-
"@protobase/server": "0.
|
|
51
|
-
"@protobase/ui": "0.
|
|
52
|
-
"@protobase/workflows": "0.
|
|
46
|
+
"@protobase/config": "0.96.0",
|
|
47
|
+
"@protobase/layout": "0.96.0",
|
|
48
|
+
"@protobase/query": "0.96.0",
|
|
49
|
+
"@protobase/schema": "0.96.0",
|
|
50
|
+
"@protobase/server": "0.96.0",
|
|
51
|
+
"@protobase/ui": "0.96.0",
|
|
52
|
+
"@protobase/workflows": "0.96.0",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -150,7 +150,7 @@ mobile: {
|
|
|
150
150
|
},
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Build the binary again. Each deploy of the app then reaches it: it downloads the files that changed in the background and runs them at its next start, or when it comes back to the foreground after 5 minutes or more away, on the page it showed and still signed in. It never switches while in use, within 5 minutes of leaving it, or over unsaved changes on the page, and it asks nobody to reload. A release that fails to start goes back to the files the binary carries. Releases come from a server of the same Protobase minor as the binary (below 1.0); a newer minor needs a store release. See [the live updater](../reference/cli.md#the-live-updater).
|
|
153
|
+
Build the binary again. Each deploy of the app then reaches it: it downloads the files that changed in the background and runs them at its next start, or when it comes back to the foreground after 5 minutes or more away, on the page it showed and still signed in, behind its splash screen. Right after someone signs in, it switches before the app opens. It never switches while in use, within 5 minutes of leaving it, or over unsaved changes on the page, and it asks nobody to reload. A release that fails to start goes back to the files the binary carries. Releases come from a server of the same Protobase minor as the binary (below 1.0) and the same native code; a newer minor, or a Protobase release that changes the native code, needs a store release. See [the live updater](../reference/cli.md#the-live-updater).
|
|
154
154
|
|
|
155
155
|
## 8. What the stores accept
|
|
156
156
|
|
|
@@ -477,20 +477,22 @@ Mobile releases and the live updater are in development.
|
|
|
477
477
|
|
|
478
478
|
With a `mobile` section, the server serves the [mobile app](../guides/mobile-app.md) a newer copy of its files, for its live updater, so the app gets UI changes without a store release. The release is what the server serves the web, composed at startup: every file of `public/`, with the server's own shell where `protobase serve` uses it, and `index.html` naming the API origin, the app's `url` (https, or plain http to `localhost`, `127.0.0.1` or `[::1]`). There is none when the server serves the API alone, has no such `url`, or the bundle names no `native`, and with `PROTOBASE_MOBILE_SIGNING_KEY` none for a bundle that names no build time (one built before Protobase recorded it: build it again). Where `protobase serve` serves its own shell, the release's fingerprint names the `native` of that shell's `protobase.shell.json`, and there is none when it names none.
|
|
479
479
|
|
|
480
|
-
- `GET /api/mobile/release?fingerprint=<native fingerprint>&shell_version=<x.y.z>` answers `{ "bundleId", "url", "required" }`: the release's id, a hash of its files, and its absolute base URL, both `null` when the release does not run on the asking binary, whose native fingerprint must equal the release's. `required` is true when the shell the app runs no longer works with the server's API: below 1.0 another minor, from 1.0 another major. A missing fingerprint or a shell version that is no x.y.z version gets 400.
|
|
480
|
+
- `GET /api/mobile/release?fingerprint=<native fingerprint>&shell_version=<x.y.z>` answers `{ "bundleId", "url", "required" }`: the release's id, a hash of its files, and its absolute base URL, both `null` when the release does not run on the asking binary, whose native fingerprint must equal the release's, or when the update is required, since the binary refuses a release of another shell version. `required` is true when the shell the app runs no longer works with the server's API: below 1.0 another minor, from 1.0 another major. A missing fingerprint or a shell version that is no x.y.z version gets 400.
|
|
481
481
|
- `GET /api/mobile/releases/<bundleId>?href=<file>` serves the release's file `<file>`, such as `assets/index-abc123.js`, and with `href=capawesome-live-update-manifest.json` its manifest, a JSON array of `{ "href", "checksum", "sizeInBytes" }`. Each comes with its sha256 in hex in `X-Checksum` and, with `PROTOBASE_MOBILE_SIGNING_KEY`, its signature in `X-Signature`. Any other file, or another release's id, gets 404.
|
|
482
482
|
- Signed, a release also serves `href=protobase-release.json`, its statement: `{ "payload", "signature" }`, the payload the hex of the JSON `{ "manifest", "order", "appId", "fingerprint", "shellVersion" }` and the signature the hex of its SHA256withRSA over the line `protobase-mobile-release` and the payload. It binds the manifest's sha256 to the release's order, when the bundle was built and then when the server's own shell it serves was built (0 with the bundle's copy), to the app id and native fingerprint of the binaries it runs on, and to the server's Protobase version. Its id is then a hash of the statement and the public key, so the same files built again get another id. A file of the app may not be named like the statement or start with that line.
|
|
483
483
|
- The app, on Android and iOS alike, downloads a release itself and takes it only when its statement is signed with the key the binary pins, names the release's id, this app, this binary and a server its shell works with, and its order is not below the highest it downloaded; then every file must hash to what the manifest lists, under a path inside the release, before any file is written. It follows no redirect and reads no file past the size its manifest lists. It runs a downloaded release only above the running one's order and holding nothing but the files its manifest lists. It never takes a release at or below the order of its own files, which `protobase mobile` records in the binary as the server would order the same bundle with its copy of the shell, so a reinstalled app is not taken below them, and a release built before the binary is not taken. <gap>A phone cannot take a rollback of the bundle or of the server's shell before a later build, because ordering releases by an explicit release number is not implemented.</gap> <gap>An app with no download recorded, such as after a reinstall, cannot refuse a genuine signed release older than the latest but newer than its own files, because a signed answer naming the latest release is not implemented.</gap>
|
|
484
484
|
|
|
485
485
|
#### The live updater
|
|
486
486
|
|
|
487
|
-
An Android or iOS app built with `mobile.publicKey` updates itself from the server it calls. The shell asks `GET /api/mobile/release`
|
|
487
|
+
An Android or iOS app built with `mobile.publicKey` updates itself from the server it calls, and never shows that it does. Launch waits on nothing: the app starts on the release it set next earlier, or its own files. The shell asks `GET /api/mobile/release` in the background each time the app comes back to the foreground and, while someone is signed in, once the app has drawn, every 15 minutes while it is in view and when the server's Protobase version changes under an open page. It downloads a release it does not run, only the files that changed, and runs it at the next cold start. The session stays in the device's cookie store, so the user stays signed in across the switch.
|
|
488
488
|
|
|
489
|
-
-
|
|
489
|
+
- The splash screen stays up from launch until the shell has drawn, and covers each reload into a release until the release has drawn.
|
|
490
|
+
- Right after someone signs in on the app, before it opens, the app takes the server's release and reloads into it, on the same page. Past 20 seconds it opens on the files it runs, and the download goes on for a later start or return.
|
|
491
|
+
- Coming back to the foreground after 5 minutes or more away, the app reloads into a release it downloaded, then returns to the page and scroll position it showed. It does not while a guard holds unsaved changes on the page, or when it was away for less. The app shows no prompt that it was updated: a reload would only start the files it runs again, so it checks for the server's release instead. A push tapped while the app reloads opens its page once the release has drawn.
|
|
490
492
|
|
|
491
493
|
- Once the shell has drawn, it tells the updater the release started. A release that does not within 30 seconds goes back to the app's own files at once and is never taken again.
|
|
492
494
|
- No answer, any status but 200, a body that is not the answer, or an answer naming no release changes nothing: the app keeps the files it runs, and never goes back to its own files because of the answer, which is not signed.
|
|
493
|
-
-
|
|
495
|
+
- A required update offers no release, so the app goes on with the files it runs. <gap>A required update across a Protobase minor below 1.0, or a major, cannot reach a phone by live update because taking a release of another shell version than the binary's is not implemented, so such a fix, a security fix included, reaches it only through a store release.</gap>
|
|
494
496
|
- The binary pins the public key: a new key needs a new store release, and a server whose `PROTOBASE_MOBILE_SIGNING_KEY` is not its private half serves releases the app refuses.
|
|
495
497
|
|
|
496
498
|
A host that serves bundles without running their config, such as a router in front of many apps or a static host, serves the same release from the files it already serves with `@protobase/server/mobile-release`, which loads none of the rest of the server: `protobase serve` composes its own release with the same exports.
|