Manages over-the-air web bundle updates for Capacitor applications. It handles background downloads and cold-start application strategies to ensure seamless user experience.
// Source: https://github.com/im4codes/imcodes | License: MIT | Copyright 2026 IM.codes
// Provided via justclaw.it.com; keep this notice with the code.
/**
* OTA update manager — checks for web bundle updates from the self-hosted server.
*
* Strategy:
* - On cold start: check + download + apply immediately (user sees splash briefly)
* - On resume from background: download only, apply on next cold start
* (avoids jarring reload mid-use)
*
* Uses @capgo/capacitor-updater in manual mode so we can point at the
* user's configured server URL (not a hardcoded Capgo endpoint).
*/
import { isNative, getServerUrl } from './native';
interface UpdateManifest {
version: number;
sha256: string;
url: string; // relative path, e.g. "/api/updates/bundle.zip"
buildTime: string;
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key