API 업데이트 엔드포인트
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
플러그인으로 업데이트를 전송하기 위한 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: '', } }}응답 형식
“Response Format” 섹션대상: 암호화되지 않은 번들, 엔드포인트에서 다음을 반환해야 합니다:
{ "version": "1.0.2", "url": "https://apiurl.com/mybuild_102.zip", "checksum": "sha256_checksum_of_bundle"}대상: 암호화된 번들, 세션 키도 함께 포함해야 합니다:
{ "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: 무결성 검증을 위한 bundle zip 파일의 SHA256 해시session_key: 암호화된 bundle의 경우에만 필수 - 이는ivSessionKeyencrypt 명령에서 반환됩니다version: semver 형식의 버전 식별자url: bundle을 다운로드할 수 있는 HTTPS URL
Bundle 생성
“Bundle 생성” 섹션호환 가능한 bundle을 생성하고 checksum을 만드는 방법은 Auto Update 문서.
암호화된 bundle에 대한 내용은 Encrypted Bundles 문서 를 참조하세요. 전체 암호화 워크플로우가 설명되어 있습니다.
다음 단계: Update API Endpoint
“다음 단계: Update API Endpoint” 섹션사용 중이라면 API 업데이트 엔드포인트 CI/CD 자동화를 계획하려면, 다음을 연결하세요 @capgo/capacitor-updater 사용하기 네이티브 기능의 경우 @capgo/capacitor-updater 사용하기에서, Capgo CI/CD 설정하기 Capgo CI/CD의 제품 워크플로우용, Capgo Native Build Capgo Native Builds의 제품 워크플로우용, Capgo 연동 서비스 제품 워크플로우는 Capgo 연동, CI/CD 통합 구현 세부 사항은 CI/CD 연동.