메뉴로 바로가기

Electron Updater API 참조

GitHub

__CAPGO_KEEP_8__

__CAPGO_KEEP_9__

__CAPGO_KEEP_10__

__CAPGO_KEEP_11__

notifyAppReady() 섹션

모든 앱 런치 시 호출해야 함. bundle 로드가 성공적으로 완료되었는지 확인하고 자동 롤백을 방지합니다.

await updater.notifyAppReady();

섹션 제목 “download(options)”

URL에서 bundle을 다운로드합니다.

클립보드 복사

const bundle = await updater.download({
url: 'https://example.com/bundle.zip',
version: '1.0.1',
checksum: 'sha256-hash', // Optional but recommended
sessionKey: '...', // For encrypted bundles
});

__CAPGO_KEEP_0__

__CAPGO_KEEP_1____CAPGO_KEEP_2____CAPGO_KEEP_3____CAPGO_KEEP_4__
url__CAPGO_KEEP_5____CAPGO_KEEP_6____CAPGO_KEEP_7__
version__CAPGO_KEEP_8____CAPGO_KEEP_9____CAPGO_KEEP_10__
checksum__CAPGO_KEEP_11__NoSHA256 체크섬을 사용하여 검증
sessionKey문자열No세션 키를 사용하여 암호화된 패키지를 암호화

반환: BundleInfo 다음 옵션을 포함하는 객체 id, version, status

다음(options)

다음(options) 제목

다음 앱 리스타트 시 로드될 패키지를 큐에 추가.

await updater.next({ id: 'bundle-id' });

매개변수:

옵션타입필수설명
id문자열queue에 등록할 Bundle ID를 설정합니다.

클립보드에 복사

await updater.set({ id: 'bundle-id' });

set(options)

Option타입필수설명
idstringYes앱 활성화에 필요한 Bundle ID

현재 Bundle로 앱을 수동으로 다시 로드합니다.

await updater.reload();

delete(options)

삭제(옵션)

스토리지에서 패키지를 삭제합니다.

await updater.delete({ id: 'bundle-id' });

매개 변수:

옵션타입필수설명
id문자열삭제할 패키지 ID

빌트인 버전 또는 마지막 성공적인 번들로 리셋합니다.

// Reset to builtin
await updater.reset({ toLastSuccessful: false });
// Reset to last successful bundle
await updater.reset({ toLastSuccessful: true });

매개 변수:

옵션타입필수설명
toLastSuccessfulboolean아니요true가면 마지막 성공적인 번들로 리셋합니다.

현재 Bundle 및 네이티브 버전 정보를 가져옵니다.

const info = await updater.current();
// { bundle: { id, version, status }, native: '1.0.0' }

다운로드 된 Bundle 목록을 표시합니다.

const bundles = await updater.list();
// [{ id, version, status, downloaded, checksum }, ...]

다음 재시작에 대기 중인 Bundle을 가져옵니다.

const next = await updater.getNextBundle();
// { id, version, status } or null

앱 롤백 시 디버깅을 위한 마지막 업데이트 정보를 가져옵니다.

const failed = await updater.getFailedUpdate();
// { id, version, reason } or null

앱 바이너리와 함께 배포된 버전을 가져옵니다.

const version = await updater.getBuiltinVersion();
// '1.0.0'

최신 버전이 제공되는지 서버를 확인합니다.

const latest = await updater.getLatest();
if (latest.url && !latest.error) {
// Update available
console.log('New version:', latest.version);
console.log('Download URL:', latest.url);
} else if (latest.error) {
console.error('Error checking updates:', latest.error);
}

반환값:

속성타입설명
url문자열다운로드 URL (업데이트가 없으면 빈 문자열)
version문자열사용 가능한 버전
checksum문자열SHA256 checksum
sessionKey문자열암호화 세션 키
error문자열체크 실패 시 오류 메시지
message문자열서버 메시지

채널 관리

채널 관리

채널에 특정 장치를 할당합니다.

setChannel(options)

setChannel(options)

await updater.setChannel({ channel: 'beta' });

unsetChannel(options)

unsetChannel(options) 제목

기본 채널을 사용하도록 채널 할당을 취소합니다.

await updater.unsetChannel();

현재 채널 할당을 가져옵니다.

const channel = await updater.getChannel();
// { channel: 'production', status: 'set' }

listChannels()

listChannels() 제목

이 앱에 사용 가능한 모든 채널을 목록화합니다.

const channels = await updater.listChannels();
// ['production', 'beta', 'staging']

다운로드 된 업데이트를 적용할 때 제어합니다.

setMultiDelay(options)

setMultiDelay(options) 섹션

업데이트가 적용되기 전에 충족해야 하는 조건을 설정합니다.

// Wait for app to be backgrounded
await updater.setMultiDelay({
delayConditions: [{ kind: 'background' }]
});
// Wait until specific date
await updater.setMultiDelay({
delayConditions: [{ kind: 'date', value: '2024-12-25T00:00:00Z' }]
});
// Wait for app to be killed and restarted
await updater.setMultiDelay({
delayConditions: [{ kind: 'kill' }]
});
// Multiple conditions (all must be met)
await updater.setMultiDelay({
delayConditions: [
{ kind: 'background' },
{ kind: 'date', value: '2024-12-25T00:00:00Z' }
]
});

지연 조건 유형:

종류설명
background선택적 지속 시간 (ms)앱이 백그라운드에 들어가기를 기다립니다.
kill-앱이 죽고 다시 시작될 때까지 기다립니다.
dateISO 날짜 문자열특정 날짜/시간까지 기다립니다.
nativeVersion버전 문자열네이티브 앱 업데이트를 기다립니다.

모든 지연 조건을 취소하고 다음 체크 시 즉시 업데이트를 적용합니다.

await updater.cancelDelay();

장치 식별

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

__CAPGO_KEEP_2__

__CAPGO_KEEP_3__

const deviceId = await updater.getDeviceId();
// 'uuid-xxxx-xxxx-xxxx'

__CAPGO_KEEP_5__

__CAPGO_KEEP_6__

__CAPGO_KEEP_7__

await updater.setCustomId({ customId: 'user-123' });

__CAPGO_KEEP_9__

__CAPGO_KEEP_10__

__CAPGO_KEEP_11__

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

await updater.setUpdateUrl({ url: 'https://my-server.com/updates' });

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

__CAPGO_KEEP_2__

await updater.setStatsUrl({ url: 'https://my-server.com/stats' });

__CAPGO_KEEP_4__

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

await updater.setChannelUrl({ url: 'https://my-server.com/channel' });

__CAPGO_KEEP_3__

__CAPGO_KEEP_4__

__CAPGO_KEEP_5__

await updater.setAppId({ appId: 'com.example.newapp' });

__CAPGO_KEEP_11__

getAppId()

현재 App ID를 가져옵니다.

const appId = await updater.getAppId();

Debug

Debug

Copy to clipboard

await updater.setDebugMenu({ enabled: true });

Debug 메뉴가 활성화되어 있는지 확인합니다.

__CAPGO_KEEP_0__

__CAPGO_KEEP_0__

const enabled = await updater.isDebugMenuEnabled();

업데이트 이벤트를 듣기 위해 addListener:

updater.addListener('eventName', (event) => {
// Handle event
});
이벤트페이로드설명
download{ percent, status }다운로드 진행 업데이트
updateAvailable{ bundle }새로운 업데이트가 사용 가능합니다.
noNeedUpdate{ message }업데이트가 이미 최신 상태입니다.
downloadComplete{ bundle }다운로드가 성공적으로 완료되었습니다.
downloadFailed{ bundle, error }다운로드가 실패했습니다.
breakingAvailable{ bundle }업데이트가 불일치(자연어 업데이트가 필요합니다).
updateFailed{ bundle, reason }업데이트 설치가 실패했습니다.
appReloaded{}앱이 다시 로드되었습니다.
appReady{}notifyAppReady() 호출되었습니다.

예시: 전체 이벤트 처리

예시: 전체 이벤트 처리
// Progress tracking
updater.addListener('download', (event) => {
updateProgressBar(event.percent);
});
// Update available notification
updater.addListener('updateAvailable', (event) => {
showNotification(`Update ${event.bundle.version} available!`);
});
// Handle completion
updater.addListener('downloadComplete', async (event) => {
// Queue for next restart
await updater.next({ id: event.bundle.id });
showNotification('Update will apply on next restart');
});
// Handle failures
updater.addListener('updateFailed', (event) => {
console.error('Update failed:', event.reason);
reportError(event);
});

생성자 옵션

생성자 옵션

전체 구성 옵션 ElectronUpdater:

const updater = new ElectronUpdater({
// Required
appId: 'com.example.app',
// Version override
version: '1.0.0', // Override builtin version detection
// Server URLs
updateUrl: 'https://plugin.capgo.app/updates',
channelUrl: 'https://plugin.capgo.app/channel_self',
statsUrl: 'https://plugin.capgo.app/stats',
// Behavior
autoUpdate: true, // Enable automatic update checks
appReadyTimeout: 10000, // Milliseconds before rollback (default: 10000)
autoDeleteFailed: true, // Auto-delete failed bundles
autoDeletePrevious: true, // Auto-delete old bundles
resetWhenUpdate: true, // Reset to builtin on native update
// Channels
defaultChannel: 'production',
// Direct Update Mode
directUpdate: false, // 'atInstall' | 'onLaunch' | 'always' | false
// Security
publicKey: '...', // RSA public key for E2E encryption
// Dynamic Configuration
allowModifyUrl: false, // Allow runtime URL changes
allowModifyAppId: false, // Allow runtime App ID changes
persistCustomId: false, // Persist custom ID across updates
persistModifyUrl: false, // Persist URL changes
// Debug
debugMenu: false, // Enable debug menu (Ctrl+Shift+D)
disableJSLogging: false, // Disable console logs
// Periodic Updates
periodCheckDelay: 0, // Seconds between auto-checks (0 = disabled, min 600)
});

Electron Updater API 참조에서 계속

Electron Updater API 참조에서 계속하는 제목

Electron Updater __CAPGO_KEEP_0__ 참조를 사용하는 경우 Electron Updater API 참조 Electron Updater API 참조와 함께 Electron Updater capgo 참조를 사용하여 Electron Updater capgo 참조를 사용하여 Electron Updater API 참조를 사용하여 Electron Updater API 참조를 사용하여 Electron Updater __CAPGO_KEEP_0__ 참조를 사용하여 __CAPGO_KEEP_0__ 소개에서 구현 세부 정보를 위한 API 키 API 키의 소개에서 구현 세부 정보를 위한 장치 __CAPGO_KEEP_0__ 소개에서 구현 세부 정보를 위한