Electron Updater API 참조
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 명령어를 복사하세요.
이 페이지에서는 Electron Updater의 모든 사용 가능한 메서드, 이벤트 및 구성 옵션을 문서화합니다.
핵심 메서드
“핵심 메서드”라는 제목을 가진 섹션notifyAppReady()
notifyAppReady() 함수 호출Must be called on every app launch. 앱이 시작될 때마다 호출해야 합니다.
await updater.notifyAppReady();If not called within
(default 10 seconds), the update is considered failed and the app rolls back to the previous version.10초 이내에 호출하지 않으면 업데이트가 실패로 간주되어 이전 버전으로 롤백됩니다.
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_1__
| __CAPGO_KEEP_2__ | __CAPGO_KEEP_3__ | __CAPGO_KEEP_4__ | __CAPGO_KEEP_5__ |
|---|---|---|---|
url | __CAPGO_KEEP_6__ | __CAPGO_KEEP_7__ | __CAPGO_KEEP_8__ |
version | __CAPGO_KEEP_9__ | __CAPGO_KEEP_10__ | __CAPGO_KEEP_11__ |
checksum | string | 없음 | SHA256 체크섬을 사용하여 확인 |
sessionKey | string | 없음 | 암호화된 배너에 대한 세션 키 |
Returns: BundleInfo 객체에 id, version, status
next(options)
next(options) 섹션다음 앱 재시작 시 로드될 배너를 큐합니다.
await updater.next({ id: 'bundle-id' });__CAPGO_KEEP_0__
| __CAPGO_KEEP_1__ | __CAPGO_KEEP_2__ | __CAPGO_KEEP_3__ | __CAPGO_KEEP_4__ |
|---|---|---|---|
id | __CAPGO_KEEP_5__ | __CAPGO_KEEP_6__ | __CAPGO_KEEP_7__ |
__CAPGO_KEEP_8__
__CAPGO_KEEP_9____CAPGO_KEEP_10__
await updater.set({ id: 'bundle-id' });매개 변수:
| 선택 항목 | 형식 | 필수 | 설명 |
|---|---|---|---|
id | 문자열 | 예 | 활성화할 번들 ID |
reload()
reload() 섹션현재 번들을 사용하여 앱을 수동으로 다시 로드합니다.
await updater.reload();delete(options)
선택 항목 삭제스토리지에서 패키지를 삭제합니다.
await updater.delete({ id: 'bundle-id' });매개 변수:
| 옵션 | 타입 | 필수 | 설명 |
|---|---|---|---|
id | string | 예 | 삭제할 패키지 ID |
__CAPGO_KEEP_0__
__CAPGO_KEEP_1____CAPGO_KEEP_2__
// Reset to builtinawait updater.reset({ toLastSuccessful: false });
// Reset to last successful bundleawait updater.reset({ toLastSuccessful: true });__CAPGO_KEEP_4__
| __CAPGO_KEEP_5__ | __CAPGO_KEEP_6__ | __CAPGO_KEEP_7__ | __CAPGO_KEEP_8__ |
|---|---|---|---|
toLastSuccessful | __CAPGO_KEEP_9__ | __CAPGO_KEEP_10__ | __CAPGO_KEEP_11__ |
Bundle 정보
Bundle 정보 섹션current()
current() 섹션현재 Bundle 및 네이티브 버전 정보를 가져옵니다.
const info = await updater.current();// { bundle: { id, version, status }, native: '1.0.0' }list(options)
list(options) 섹션다운로드한 모든 Bundle 목록을 표시합니다.
const bundles = await updater.list();// [{ id, version, status, downloaded, checksum }, ...]getNextBundle()
getNextBundle() 섹션다음 재시작 시 배포를 큐에 넣습니다.
const next = await updater.getNextBundle();// { id, version, status } or nullgetFailedUpdate()
getFailedUpdate()지난 업데이트 실패 정보를 얻습니다. (롤백 디버깅에 유용합니다.)
const failed = await updater.getFailedUpdate();// { id, version, reason } or nullgetBuiltinVersion()
getBuiltinVersion()앱 바이너리와 함께 배포된 버전을 얻습니다.
const version = await updater.getBuiltinVersion();// '1.0.0'업데이트 확인
getBuiltinVersion()__CAPGO_KEEP_0__
__CAPGO_KEEP_1____CAPGO_KEEP_2__
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);}__CAPGO_KEEP_4__
| __CAPGO_KEEP_5__ | __CAPGO_KEEP_6__ | __CAPGO_KEEP_7__ |
|---|---|---|
url | __CAPGO_KEEP_8__ | __CAPGO_KEEP_9__ |
version | __CAPGO_KEEP_10__ | __CAPGO_KEEP_11__ |
checksum | string | SHA256 체크섬 |
sessionKey | string | 암호화 세션 키 |
error | string | 체크가 실패한 경우 오류 메시지 |
message | string | 서버 메시지 |
채널 관리
채널 관리 섹션setChannel(옵션)
setChannel(옵션) 섹션__CAPGO_KEEP_0__을 특정 채널에 할당합니다.
await updater.setChannel({ channel: 'beta' });unsetChannel(options)
__CAPGO_KEEP_2__ 제목: unsetChannel(options)__CAPGO_KEEP_0__ 할당을 취소하고 기본값을 사용합니다.
await updater.unsetChannel();getChannel()
__CAPGO_KEEP_2__ 제목: getChannel()__CAPGO_KEEP_0__의 현재 채널 할당을 가져옵니다.
const channel = await updater.getChannel();// { channel: 'production', status: 'set' }listChannels()
__CAPGO_KEEP_2__ 제목: listChannels()이 앱의 모든 사용 가능한 채널을 표시합니다.
const channels = await updater.listChannels();// ['production', 'beta', 'staging']다운로드 업데이트가 적용되는 시기를 제어합니다.
setMultiDelay(options) - 옵션을 설정합니다.다운로드 업데이트가 적용되는 시기를 제어합니다.
setMultiDelay(options) - 옵션을 설정합니다.
업데이트가 적용되기 전에 충족해야 하는 조건을 설정합니다.클립보드에 복사
// Wait for app to be backgroundedawait updater.setMultiDelay({ delayConditions: [{ kind: 'background' }]});
// Wait until specific dateawait updater.setMultiDelay({ delayConditions: [{ kind: 'date', value: '2024-12-25T00:00:00Z' }]});
// Wait for app to be killed and restartedawait 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 | - | 앱이 죽고 다시 시작될 때까지 기다리기 |
date | ISO 날짜 문자열 | 특정 날짜/시간까지 기다리기 |
nativeVersion | 버전 문자열 | 네이티브 앱 업데이트를 기다리기 |
cancelDelay()
cancelDelay() 섹션모든 지연 조건을 취소하고 다음 체크 시 즉시 업데이트를 적용하기
await updater.cancelDelay();__CAPGO_KEEP_0__
__CAPGO_KEEP_1____CAPGO_KEEP_2__
__CAPGO_KEEP_3____CAPGO_KEEP_4__
const deviceId = await updater.getDeviceId();// 'uuid-xxxx-xxxx-xxxx'__CAPGO_KEEP_6__
__CAPGO_KEEP_7____CAPGO_KEEP_8__
await updater.setCustomId({ customId: 'user-123' });__CAPGO_KEEP_10__
__CAPGO_KEEP_11__setUpdateUrl(options)
Section titled “setUpdateUrl(options)”런타임에 업데이트서버 URL을 변경합니다.
await updater.setUpdateUrl({ url: 'https://my-server.com/updates' });setStatsUrl(options)
Section titled “setStatsUrl(options)”통계 보고서 URL을 변경합니다.
await updater.setStatsUrl({ url: 'https://my-server.com/stats' });__CAPGO_KEEP_0__
__CAPGO_KEEP_1____CAPGO_KEEP_2__
await updater.setChannelUrl({ url: 'https://my-server.com/channel' });__CAPGO_KEEP_4__
__CAPGO_KEEP_5____CAPGO_KEEP_6__
await updater.setAppId({ appId: 'com.example.newapp' });getAppId()
getAppId()현재 App ID를 가져옵니다.
const appId = await updater.getAppId();Debug
DebugsetDebugMenu(options)
setDebugMenu(options)debug 메뉴를 활성화하거나 비활성화합니다.
await updater.setDebugMenu({ enabled: true });isDebugMenuEnabled()
isDebugMenuEnabled()__CAPGO_KEEP_0__을 확인합니다.
const enabled = await updater.isDebugMenuEnabled();__CAPGO_KEEP_2__를 사용하여 업데이트 이벤트를 듣습니다. addListener:
updater.addListener('eventName', (event) => { // Handle event});사용 가능한 이벤트
__CAPGO_KEEP_0__ 제목 ‘사용 가능한 이벤트’| 이벤트 | 페이로드 | 설명 |
|---|---|---|
download | { percent, status } | 다운로드 진행 상황 업데이트 |
updateAvailable | { bundle } | 새로운 업데이트가 있습니다. |
noNeedUpdate | { message } | 이미 최신 버전입니다. |
downloadComplete | { bundle } | 다운로드가 성공적으로 완료되었습니다. |
downloadFailed | { bundle, error } | 다운로드가 실패했습니다. |
breakingAvailable | { bundle } | 업데이트가 불일치합니다 (자연스러운 업데이트가 필요합니다). |
updateFailed | { bundle, reason } | 업데이트 설치가 실패했습니다. |
appReloaded | {} | 앱이 다시 로드되었습니다. |
appReady | {} | notifyAppReady() __CAPGO_KEEP_0__이 호출되었습니다. |
예시: 전체 이벤트 처리
__CAPGO_KEEP_0__ 제목: 예시: 전체 이벤트 처리// Progress trackingupdater.addListener('download', (event) => { updateProgressBar(event.percent);});
// Update available notificationupdater.addListener('updateAvailable', (event) => { showNotification(`Update ${event.bundle.version} available!`);});
// Handle completionupdater.addListener('downloadComplete', async (event) => { // Queue for next restart await updater.next({ id: event.bundle.id }); showNotification('Update will apply on next restart');});
// Handle failuresupdater.addListener('updateFailed', (event) => { console.error('Update failed:', event.reason); reportError(event);});__CAPGO_KEEP_0__ 옵션
생성자 옵션생성자 옵션의 전체 구성 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 참조를 사용하여 대시보드와 API 연산을 계획하고 있는 경우 대시보드와 capgo 연산을 계획하고 있는 경우 Electron Updater capgo 참조를 사용하여 Electron Updater API 참조를 사용하여 Electron Updater API 참조의 개요 소개 __CAPGO_KEEP_0__ 구현 세부 정보에 대한 소개 API 키 API 키의 구현 세부 정보 장치 __CAPGO_KEEP_0__ 장치의 구현 세부 정보