메인 콘텐츠로 건너뛰기

API 업데이트

GitHub

자바스크립트에서 플러그인 업데이트를 전송하기 위한 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: '',
}
}
}

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

비밀번호가 없는 배포본의 경우복사

{
"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"
}

__CAPGO_KEEP_0__ message __CAPGO_KEEP_1__ error:

{
"message": "Version not found",
"error": "The backend crashed",
"version": "1.0.2",
}

Field Descriptions

Field Descriptions 섹션
  • checksum: 파일 압축(zip) 파일의 SHA256 해시를 통해 무결성 확인
  • session_key: 암호화된 파일만 해당 - 이 값은 encrypt 명령어로 반환 ivSessionKey : 버전 식별자 - semver 형식
  • version: 다운로드 가능한 파일의 HTTPS URL Bundle Creation
  • urlBundle Creation 섹션

Compatible한 파일을 생성하고 체크섬을 생성하는 방법을 알아보려면

Compatible한 파일을 생성하고 체크섬을 생성하는 방법을 알아보려면

To learn how to create compatible bundles and generate checksums, see the 자동 업데이트 문서.

암호화된 번들에 대한 자세한 내용은 암호화된 번들 문서 암호화된 번들의 완전한 암호화 워크플로를 설명합니다.

Update API 엔드포인트에서 계속

Update API 엔드포인트에서 계속하기

CI/CD 자동화 계획을 위해 Update API 엔드포인트를 사용하여 CI/CD 자동화를 계획하고 CI/CD 자동화 계획을 위해 Update __CAPGO_KEEP_0__ 엔드포인트를 사용하여 Using @capgo/capacitor-updater for the native capability in Using @capgo/capacitor-updater, Capgo CI/CD 제품 워크플로우에 대한 Capgo CI/CD에 대해 Capgo 네이티브 빌드 Capgo 제품 워크플로우에 대한 네이티브 빌드에 대해 Capgo 통합 Capgo 제품 워크플로우에 대한 통합에 대해, 그리고 CI/CD 통합 CI/CD 통합에 대한 구현 세부 정보.