メインコンテンツにジャンプ

Auto Update

GitHub

このドキュメントでは、自動更新サーバーを実行する方法を説明します。

バンドルがHTTPSで配信されているか、そしてサーバーがアプリがアップデートをダウンロードできるようにするための適切なCORSヘッダーを持っていることを確認してください。 https://myserver.com/app/updates/updates.json

If you’re unfamiliar with serving a bundle, we recommend you try Capgo Cloud or see an example here:

バンドルを配信する

設定

「設定」のセクション updateUrl に追加する capacitor.config.json.

{
"plugins": {
"CapacitorUpdater": {
"updateUrl": "https://myserver.com/app/updates/updates.json",
}
}
}

プラグインは、各アプリ起動時に、APIにPOSTコールを実行します。

interface AppInfos {
"platform": "ios" | "android" | "electron",
"device_id": "UUID_of_device_unique_by_install",
"app_id": "APPID_FROM_CAPACITOR_CONFIG",
"custom_id": "your_custom_id_set_on_runtime",
"plugin_version": "PLUGIN_VERSION",
"version_build": "VERSION_NUMBER_FROM_NATIVE_CODE",
"version_code": "VERSION_CODE_FROM_NATIVE_CODE",
"version_name": "LAST_DOWNLOADER_VERSION" | "builtin"
"version_os": "VERSION_OF_SYSTEM_OS",
"is_emulator": boolean,
"is_prod": boolean,
}

APIサーバーは、capacitor-updater プラグインにJSON形式で、以下のデータを返す必要があります。

{
"version": "1.2.3",
"url": "https://myserver.com/app/updates/my-new-app-2.0.0.zip",
"checksum": "sha256_checksum_of_bundle"
}

自動更新モードでは、サーバーはバージョンを比較し、正しいバージョンを返す必要があります。URLキーが存在する場合、プラグインはダウンロードプロセスを開始します。

メッセージとエラーのキーを追加すると、バージョンは設定されず、ログに表示される代わりにメッセージが表示されます。

version __CAPGO_KEEP_1__ semver format.

zipファイルは index.html rootディレクトリに index.html rootディレクトリに

You can use the command of the CLI to zip your bundle:

zipアーカイブを作成するコマンド
npx @capgo/cli bundle zip --path [/path/to/my/bundle]

クリップボードにコピー

バンドルチェックサムを生成

バンドルチェックサムの生成 You must use the Capgo CLI to create your bundle zip file. The Capgo plugin requires a specific zip format and structure that is only guaranteed when using the official CLI tool. Standard zip utilities may create incompatible archives.

バンドルzipファイルを作成するには、Capgo CLIを使用する必要があります。__CAPGO_KEEP_2__プラグインは、公式の__CAPGO_KEEP_3__ツールを使用する場合にのみ、特定のzip形式と構造を保証します。標準のzipユーティリティは、互換性のないアーカイブを作成する可能性があります。 --json 旗印:

チェックサム情報を含むバンドルを作成する
npx @capgo/cli bundle zip [appId] --json

このコマンドは次のことを行います:

  • Capgo プラグインに互換性のある形式で整理されたzipファイルを作成する
  • SHA256チェックサムを生成して、インストール前にバンドルの整合性を確認する
  • JSON形式でバンドル情報を出力する

例:

{
"version": "1.2.3",
"checksum": "a1b2c3d4e5f6789...",
"size": 1234567
}

__CAPGO_KEEP_0__ のレスポンスに含まれる値を使用して、バンドルの整合性を確認するためにプラグインがインストール前にバンドルの整合性を確認できるようにしてください。 checksum value from this output in your API response to ensure the plugin can verify the bundle integrity before installation.

Use the value from this output in your __CAPGO_KEEP_0__ response to ensure the plugin can verify the bundle integrity before installation.

「Auto Update」から続けて進む

__CAPGO_KEEP_0__が利用されている場合 Auto Update __CAPGO_KEEP_0__と接続して capgo/capacitor-updaterを使用 capgo/capacitor-updaterのネイティブ機能を使用する場合 Capgo Enterprise Capgo Enterpriseの製品ワークフローを使用する場合 Ionic Enterprise Plugin Alternatives Ionic Enterprise Plugin Alternativesの製品ワークフローを使用する場合 Capgo Alternatives Capgo Alternativesの製品ワークフローを使用する場合 Capgo Consulting Capgo の製品ワークフロー向け