メイン コンテンツにスキップ

APIを更新するエンドポイント

GitHub

JavaScriptの例です。codeを使用してプラグインにアップデートを送信します。

interface AppInfos {
version_name: string
version_build: string
version_os: string
custom_id?: string
is_prod?: boolean
is_emulator?: boolean
plugin_version: string
platform: string
app_id: string
device_id: string
}
export const handler: Handler = async (event) => {
const body = JSON.parse(event.body || '{}') as AppInfos
const {
platform,
app_id,
version_os,
device_id,
version_name,
version_build,
plugin_version,
} = body
console.log('update asked', platform,
app_id,
version_os,
device_id,
version_name,
version_build,
plugin_version)
if (version_name === '1.0.0') {
return {
version: '1.0.1',
url: 'https://apiurl.com/mybuild_101.zip',
checksum: 'sha256_checksum_of_bundle',
}
}
else if (version_name === '1.0.1') {
return {
version: '1.0.2',
url: 'https://apiurl.com/mybuild_102.zip',
checksum: 'sha256_checksum_of_bundle',
}
}
else {
return {
message: 'Error version not found'
version: '',
url: '',
}
}
}

For 非暗号化のバンドルの場合、エンドポイントは次のように返す必要があります。

{
"version": "1.0.2",
"url": "https://apiurl.com/mybuild_102.zip",
"checksum": "sha256_checksum_of_bundle"
}

For 暗号化されたバンドル、セッション キーも含めてください。

{
"version": "1.0.2",
"url": "https://apiurl.com/mybuild_102.zip",
"checksum": "encrypted_checksum_from_encrypt_command",
"session_key": "ivSessionKey_from_encrypt_command"
}

エラーもしくはアップデートがなければ、 message キーと、暗号化されたバンドルの場合にのみ必要な error:

{
"message": "Version not found",
"error": "The backend crashed",
"version": "1.0.2",
}
  • checksum: バンドル zip ファイルの整合性検証用の SHA256 ハッシュ値
  • session_key: 暗号化されたバンドルの場合にのみ必要な - この値は、encrypt コマンドによって返される ivSessionKey : バージョン識別子
  • version__CAPGO_KEEP_0__ semver形式
  • url: __CAPGO_KEEP_0__ でダウンロードできる bundle の HTTPS URL

自動更新の詳細については、以下のドキュメントを参照してください。 暗号化された bundle の詳細については、以下のドキュメントを参照してください。.

暗号化された bundle の作成の詳細については、以下のドキュメントを参照してください。 Update __CAPGO_KEEP_0__ エンドポイントから続けてください。 以下のドキュメントを参照してください。

暗号化された bundle の作成の詳細については、以下のドキュメントを参照してください。 API をアップデート CI/CD の自動化計画に接続するには @capgo/capacitor-updater を使用 @capgo/capacitor-updater を使用して、ネイティブ機能を使用 Capgo CI/CD Capgo CI/CD を使用して製品ワークフロー Capgo Native Builds Capgo Native Builds を使用して製品ワークフロー Capgo Integrations Capgo Integrations を使用して製品ワークフロー CI/CD Integration CI/CD Integration の実装詳細