@protobase/cli 0.94.32 → 0.94.33
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
package/dist/mobile/generate.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { dataExtractionRules, dataExtractionRulesPath, withoutBackup } from "./android-backup.js";
|
|
2
2
|
import { copyGoogleServices } from "./google-services.js";
|
|
3
3
|
import { withLocalNetworking } from "./info-plist.js";
|
|
4
|
+
import { withFreshInstall } from "./ios-fresh-install.js";
|
|
4
5
|
import { setUpIosPush } from "./ios-push.js";
|
|
5
6
|
import { withProtobaseIcon } from "./native-icon.js";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
8
9
|
//#region src/mobile/generate.ts
|
|
9
10
|
const infoPlist = (ws) => path.join(ws, "ios", "App", "App", "Info.plist");
|
|
11
|
+
const appDelegate = (ws) => path.join(ws, "ios", "App", "App", "AppDelegate.swift");
|
|
10
12
|
const androidManifest = (ws) => path.join(ws, "android", "app", "src", "main", "AndroidManifest.xml");
|
|
11
13
|
/**
|
|
12
14
|
* Generates the platform's native project in the workspace from its capacitor.config.json and app files, replacing
|
|
13
15
|
* the last one: it is never edited by hand. Its home-screen icon is Protobase's, an Android app with push gets the
|
|
14
16
|
* project's google-services.json from `googleServicesFrom`, an iOS app with push its entitlement in `apnsEnvironment` and
|
|
15
17
|
* the token forwarding, and an iOS app calling the API over plain http may reach local addresses. Android apps opt out
|
|
16
|
-
* of backup and device transfer,
|
|
18
|
+
* of backup and device transfer, and iOS apps start as a fresh install after a restore or a move, so nothing carries
|
|
19
|
+
* over to another phone.
|
|
17
20
|
*/
|
|
18
21
|
const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom, apnsEnvironment }, cap) => {
|
|
19
22
|
await rm(path.join(ws, platform), {
|
|
@@ -30,6 +33,7 @@ const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom, a
|
|
|
30
33
|
await writeFile(rules, dataExtractionRules);
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
36
|
+
await writeFile(appDelegate(ws), withFreshInstall(await readFile(appDelegate(ws), "utf8")));
|
|
33
37
|
if (apnsEnvironment !== void 0) await setUpIosPush(ws, apnsEnvironment);
|
|
34
38
|
if (!cleartext) return;
|
|
35
39
|
await writeFile(infoPlist(ws), withLocalNetworking(await readFile(infoPlist(ws), "utf8")));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/mobile/ios-fresh-install.ts
|
|
2
|
+
const importLine = "import Capacitor\n";
|
|
3
|
+
const launchLine = " // Override point for customization after application launch.\n";
|
|
4
|
+
/**
|
|
5
|
+
* Capacitor's AppDelegate.swift preparing a fresh install first thing at launch, before the bridge reads what a live
|
|
6
|
+
* update left: an app a backup restored, or one moved to another iPhone, starts signed out with no drafts and no live
|
|
7
|
+
* update. Throws on any other AppDelegate rather than build an app that skips it.
|
|
8
|
+
*/
|
|
9
|
+
const withFreshInstall = (delegate) => {
|
|
10
|
+
if (delegate.split(importLine).length !== 2 || delegate.split(launchLine).length !== 2 || delegate.includes("ProtobaseMobile")) throw new Error("AppDelegate.swift is not Capacitor's template: it needs its one `import Capacitor` and one launch comment, and no ProtobaseMobile");
|
|
11
|
+
return delegate.replace(importLine, `${importLine}import ProtobaseMobile\n`).replace(launchLine, " ProtobaseFreshInstall.prepare()\n");
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { withFreshInstall };
|
package/dist/mobile/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.33",
|
|
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.94.
|
|
47
|
-
"@protobase/layout": "0.94.
|
|
48
|
-
"@protobase/query": "0.94.
|
|
49
|
-
"@protobase/schema": "0.94.
|
|
50
|
-
"@protobase/server": "0.94.
|
|
51
|
-
"@protobase/ui": "0.94.
|
|
52
|
-
"@protobase/workflows": "0.94.
|
|
46
|
+
"@protobase/config": "0.94.33",
|
|
47
|
+
"@protobase/layout": "0.94.33",
|
|
48
|
+
"@protobase/query": "0.94.33",
|
|
49
|
+
"@protobase/schema": "0.94.33",
|
|
50
|
+
"@protobase/server": "0.94.33",
|
|
51
|
+
"@protobase/ui": "0.94.33",
|
|
52
|
+
"@protobase/workflows": "0.94.33",
|
|
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",
|
|
@@ -45,7 +45,7 @@ Signing in works in the app as on the web, with nothing more to set up:
|
|
|
45
45
|
|
|
46
46
|
- Emailed codes, passwords and the second step of two-factor authentication work. <gap>Passkeys do not work in the app yet.</gap> <gap>Sign-in with another provider does not work in the app yet.</gap>
|
|
47
47
|
- The app calls `/api/auth` through the device's native HTTP, naming its Capacitor origin. With a mobile section, sign-in trusts the Capacitor origin a request names, for that request only, without CORS. A POST from a Capacitor origin must send a JSON body: any other is refused with 415, as only a page in the app sends one.
|
|
48
|
-
- The session lives in the device's cookie store
|
|
48
|
+
- The session survives reloads, updates and relaunches. On Android it lives in the device's cookie store; on iOS in a keychain item that stays on the device, out of the WebView and the device's cookie store.
|
|
49
49
|
- <gap>"Forgot password?" is not offered in the app, as the emailed link cannot lead back into it.</gap>
|
|
50
50
|
- Page script cannot reach the session cookie, on iOS and Android alike: Capacitor's `CapacitorHttp`, `CapacitorCookies` and `WebView` plugins are refused to it, and so are the app's local file routes. A plugin that reads files for its JavaScript, such as `@capacitor/filesystem`, could still hand the cookie over.
|
|
51
51
|
- While you develop over plain `http://localhost` with a mobile section, a page served on `https://localhost` in the same browser can send sign-in requests that carry your dev session, as some browsers treat the two as the same site. Do not open untrusted pages on `https://localhost` while you develop.
|
|
@@ -111,7 +111,7 @@ makes a signed release binary: an `.aab` to upload to Google Play, an `.ipa` to
|
|
|
111
111
|
- A release calls its server over https, at `--api` or the app's `url`: plain http, `localhost` and `10.0.2.2` are refused.
|
|
112
112
|
- `--app-version` is the version the stores show, one to three numbers such as `1.2.3`. `--build-number` is a whole number that must rise with every upload, such as your CI's run number.
|
|
113
113
|
- Extra plugins run at build time with access to your signing key, so add only plugins you trust.
|
|
114
|
-
- Android apps built by `protobase mobile run` and `protobase mobile build` opt out of
|
|
114
|
+
- iOS and Android apps built by `protobase mobile run` and `protobase mobile build` carry nothing over to a new phone or from a backup, so no working session sits in a backup or on another phone. Android apps opt out of backup and device-to-device transfer; an iOS app keeps its session in a keychain item that never leaves the device, and its first launch after a restore, even on the same iPhone, or a move to a new one, removes everything the app kept before its page loads. On a new phone, or after restoring a backup, the app starts as a fresh install: your users sign in again, and unsent drafts and downloaded live updates are gone. Reinstalling an iOS app starts it as a fresh install too.
|
|
115
115
|
|
|
116
116
|
**Android.** Make an upload key once, outside the project, and never commit it:
|
|
117
117
|
|