Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/main' into standalone-ios

Elian Doran006712f6a779
diff --cc apps/mobile/package.json
index 345219870a,db80dddea0..3b000e0564
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@@ -12,10 -12,8 +12,10 @@@
"run:android": "cap run android"
},
"dependencies": {
- "@capacitor/android": "8.4.0",
- "@capacitor/core": "8.4.0",
- "@capacitor/ios": "8.4.0",
+ "@capacitor/android": "8.4.1",
+ "@capacitor/core": "8.4.1",
++ "@capacitor/ios": "8.4.1",
+ "@capacitor/keyboard": "8.0.1",
"@capacitor/splash-screen": "8.0.1"
},
"devDependencies": {
diff --cc apps/standalone/src/local-server-worker.ts
index e8a752ddf5,60f3d0cbd7..d07cb59d62
--- a/apps/standalone/src/local-server-worker.ts
+++ b/apps/standalone/src/local-server-worker.ts
@@@ -308,27 -308,9 +308,28 @@@ async function initialize(): Promise<vo
}
} else {
logService.info("[Worker] Database not initialized, skipping becca load (will be loaded during DB initialization)");
+
+ // Auto-resume an interrupted initial sync. If the schema is
+ // present and the user already configured sync in a previous
+ // session that didn't finish, restart sync from `lastSyncedPull`
+ // so the user stays on the sync-in-progress screen without
+ // re-entering credentials. The DB will only be marked initialized
+ // once `sync()` returns success (handled inside `triggerSync`).
+ if (coreModule.sql_init.schemaExists()) {
+ const lastSyncedPull = parseInt(
+ coreModule.options.getOptionOrNull("lastSyncedPull") ?? "0"
+ );
+ const syncServerHost = coreModule.options.getOptionOrNull("syncServerHost") ?? "";
+ if (lastSyncedPull > 0 && syncServerHost) {
+ logService.info(
+ `[Worker] Resuming interrupted sync: lastSyncedPull=${lastSyncedPull}, host=${syncServerHost}`
+ );
+ coreModule.setup.triggerSync();
+ }
+ }
}
+ coreModule.sync.startSyncTimer();
coreModule.scheduler.startScheduler();
logService.info("[Worker] Initialization complete");
diff --cc apps/standalone/src/services/capacitor_http_handler.ts
index 2cd464a459,7ed28425ad..afe576ea7c
--- a/apps/standalone/src/services/capacitor_http_handler.ts
+++ b/apps/standalone/src/services/capacitor_http_handler.ts
@@@ -31,16 -139,20 +139,27 @@@ async function nativeProxyFetch(request
*
* This bypasses the WebView's fetch — no CORS preflight, no SameSite cookie
* restrictions, and plain HTTP targets work from an HTTPS WebView origin.
+ *
+ * Memory-critical: for JSON responses we pass `response.data` (already parsed
+ * by Capacitor) directly through postMessage instead of re-stringifying. The
+ * worker receives a structured-clone copy and skips its own JSON.parse. This
+ * avoids holding two ~60 MB strings (one on each side of the bridge) plus the
+ * parsed object simultaneously, which was OOM-killing the iOS Web Worker on
+ * large blob sync batches.
*/
export const capacitorHttpHandler: NativeHttpHandler = async (request) => {
- const response = await getCapacitorHttp().request({
+ if (canUseNativeProxy(request) && await isNativeProxyAvailable()) {
+ try {
+ return await nativeProxyFetch(request);
+ } catch (e) {
+ // Idempotent GET — retrying once over the plugin transport is safe and keeps
+ // sync alive if the proxy misbehaves in ways the availability probe missed.
+ console.warn("Native HTTP proxy failed, falling back to the plugin transport", e);
+ }
+ }
+
+ const responseType = request.responseType ?? "text";
+ const response = await getHttpPlugin().request({
method: request.method,
url: request.url,
headers: request.headers,
diff --cc pnpm-lock.yaml
index ce4aad6f8a,3df46003fb..639722b29c
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@@ -563,24 -575,18 +575,24 @@@ importers
apps/mobile:
dependencies:
'@capacitor/android':
- specifier: 8.4.0
- version: 8.4.0(@capacitor/[email protected])
+ specifier: 8.4.1
+ version: 8.4.1(@capacitor/[email protected])
'@capacitor/core':
- specifier: 8.4.0
- version: 8.4.0
+ specifier: 8.4.1
+ version: 8.4.1
+ '@capacitor/ios':
- specifier: 8.4.0
- version: 8.4.0(@capacitor/[email protected])
++ specifier: 8.4.1
++ version: 8.4.1(@capacitor/[email protected])
+ '@capacitor/keyboard':
+ specifier: 8.0.1
- version: 8.0.1(@capacitor/[email protected])
++ version: 8.0.1(@capacitor/[email protected])
'@capacitor/splash-screen':
specifier: 8.0.1
- version: 8.0.1(@capacitor/[email protected])
+ version: 8.0.1(@capacitor/[email protected])
devDependencies:
'@capacitor/cli':
- specifier: 8.4.0
- version: 8.4.0
+ specifier: 8.4.1
+ version: 8.4.1
apps/script-deployer:
devDependencies:
@@@ -1936,19 -1966,9 +1972,19 @@@ packages
engines: {node: '>=22.0.0'}
hasBin: true
- '@capacitor/[email protected]':
- resolution: {integrity: sha512-LrS1xPIrqLtJABBIPDGXxxKmI9OyesrzWw8DiHbxhSC9JoiLUleUAJlX1a0LWIVLRbuY4Szgf9huFeRqYH2SAQ==}
+ '@capacitor/[email protected]':
+ resolution: {integrity: sha512-xqhOGLbTAYeOWK+IDUNSjQJAPapQjRHrIcgk9PYp52or9zFTaaMko31uNi16N6W+CRJ8VrRram6fOYILkBG2Hg==}
- '@capacitor/[email protected]':
- resolution: {integrity: sha512-tnwstEdbTJ2nHAfoAwnurXgYRscWeLY+IIGdz69o24gN2Crfj9Xc0TWo8L5uFLF1LmpbUywH1IT0U1oHV8c+CA==}
++ '@capacitor/[email protected]':
++ resolution: {integrity: sha512-EgcAk7NYheHMTyP3CUrA65qKs4D2UEAKgw44HI6Uk3dTw6KjLQkdLOQWvbeRncHaZ2gklfOojUoc5DlSw2lhYg==}
+ peerDependencies:
+ '@capacitor/core': ^8.4.0
+
+ '@capacitor/[email protected]':
+ resolution: {integrity: sha512-HDf4qrvvhLRMsgBoqeqIld6hP8JMK/WPbCYMvz8ajhY6TaibYt6B+NQyky4oIPCOfHTz5OcVsuHkbb8fQvGDAg==}
+ peerDependencies:
+ '@capacitor/core': '>=8.0.0'
+
'@capacitor/[email protected]':
resolution: {integrity: sha512-c/ew/Z3eA7z8l06WoRAtzVF16VwYYrExmHmfGq1Cg675pVzaC/yuucB8/1xG1vhEfnW4fZ1KhSf/kzR1RiVYgg==}
peerDependencies:
@@@ -14025,17 -14086,9 +14102,17 @@@ snapshots
dependencies:
tslib: 2.8.1
- '@capacitor/[email protected](@capacitor/[email protected])':
++ '@capacitor/[email protected](@capacitor/[email protected])':
+ dependencies:
- '@capacitor/core': 8.4.0
++ '@capacitor/core': 8.4.1
+
- '@capacitor/[email protected](@capacitor/[email protected])':
++ '@capacitor/[email protected](@capacitor/[email protected])':
+ dependencies:
- '@capacitor/core': 8.4.0
++ '@capacitor/core': 8.4.1
+
- '@capacitor/[email protected](@capacitor/[email protected])':
+ '@capacitor/[email protected](@capacitor/[email protected])':
dependencies:
- '@capacitor/core': 8.4.0
+ '@capacitor/core': 8.4.1
'@catppuccin/[email protected]':
dependencies: