@noldova/desktop.electron 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +55 -2
- package/api/index.d.ts +11138 -0
- package/api/index.js +144 -0
- package/api/index.js.map +1 -0
- package/enums/file-save-outcome.js +14 -0
- package/enums/file-save-outcome.js.map +1 -0
- package/enums/main-process-failure-kind.js +13 -0
- package/enums/main-process-failure-kind.js.map +1 -0
- package/enums/menu-bar-row-type.js +14 -0
- package/enums/menu-bar-row-type.js.map +1 -0
- package/enums/menu-check.js +14 -0
- package/enums/menu-check.js.map +1 -0
- package/enums/path-command-outcome.js +16 -0
- package/enums/path-command-outcome.js.map +1 -0
- package/enums/quit-choice.js +14 -0
- package/enums/quit-choice.js.map +1 -0
- package/enums/quit-outcome.js +14 -0
- package/enums/quit-outcome.js.map +1 -0
- package/enums/startup-state-kind.js +19 -0
- package/enums/startup-state-kind.js.map +1 -0
- package/enums/tray-icon-state.js +16 -0
- package/enums/tray-icon-state.js.map +1 -0
- package/enums/update-state-kind.js +18 -0
- package/enums/update-state-kind.js.map +1 -0
- package/enums/web-address-kind.js +16 -0
- package/enums/web-address-kind.js.map +1 -0
- package/enums/window-error-admission.js +14 -0
- package/enums/window-error-admission.js.map +1 -0
- package/exceptions/app-image-folder-unwritable.exception.js +18 -0
- package/exceptions/app-image-folder-unwritable.exception.js.map +1 -0
- package/exceptions/app-image-leftover-not-removed.exception.js +17 -0
- package/exceptions/app-image-leftover-not-removed.exception.js.map +1 -0
- package/exceptions/app-image-not-replaced.exception.js +18 -0
- package/exceptions/app-image-not-replaced.exception.js.map +1 -0
- package/exceptions/app-image-unreadable.exception.js +18 -0
- package/exceptions/app-image-unreadable.exception.js.map +1 -0
- package/exceptions/databases-not-backed-up.exception.js +18 -0
- package/exceptions/databases-not-backed-up.exception.js.map +1 -0
- package/exceptions/debian-installer-missing.exception.js +15 -0
- package/exceptions/debian-installer-missing.exception.js.map +1 -0
- package/exceptions/debian-package-not-installed.exception.js +18 -0
- package/exceptions/debian-package-not-installed.exception.js.map +1 -0
- package/exceptions/device-identity.exception.js +17 -0
- package/exceptions/device-identity.exception.js.map +1 -0
- package/exceptions/electron.exception.js +14 -0
- package/exceptions/electron.exception.js.map +1 -0
- package/exceptions/installer-not-copied.exception.js +15 -0
- package/exceptions/installer-not-copied.exception.js.map +1 -0
- package/exceptions/installer-not-held.exception.js +17 -0
- package/exceptions/installer-not-held.exception.js.map +1 -0
- package/exceptions/installer-not-started.exception.js +18 -0
- package/exceptions/installer-not-started.exception.js.map +1 -0
- package/exceptions/installer-unsigned.exception.js +19 -0
- package/exceptions/installer-unsigned.exception.js.map +1 -0
- package/exceptions/not-an-app-image.exception.js +15 -0
- package/exceptions/not-an-app-image.exception.js.map +1 -0
- package/exceptions/path-command.exception.js +18 -0
- package/exceptions/path-command.exception.js.map +1 -0
- package/exceptions/processes-not-exited.exception.js +19 -0
- package/exceptions/processes-not-exited.exception.js.map +1 -0
- package/exceptions/program.exception.js +18 -0
- package/exceptions/program.exception.js.map +1 -0
- package/exceptions/restart-arguments-not-written.exception.js +15 -0
- package/exceptions/restart-arguments-not-written.exception.js.map +1 -0
- package/exceptions/runtime-starter-ended.exception.js +15 -0
- package/exceptions/runtime-starter-ended.exception.js.map +1 -0
- package/exceptions/runtime-starter-failed.exception.js +17 -0
- package/exceptions/runtime-starter-failed.exception.js.map +1 -0
- package/exceptions/ship-it-not-found.exception.js +15 -0
- package/exceptions/ship-it-not-found.exception.js.map +1 -0
- package/exceptions/ship-it-not-removed.exception.js +16 -0
- package/exceptions/ship-it-not-removed.exception.js.map +1 -0
- package/exceptions/ship-it-unreadable.exception.js +16 -0
- package/exceptions/ship-it-unreadable.exception.js.map +1 -0
- package/exceptions/stale-update.exception.js +14 -0
- package/exceptions/stale-update.exception.js.map +1 -0
- package/exceptions/unusable-folder.exception.js +18 -0
- package/exceptions/unusable-folder.exception.js.map +1 -0
- package/exceptions/update-changed-before-handoff.exception.js +15 -0
- package/exceptions/update-changed-before-handoff.exception.js.map +1 -0
- package/exceptions/update-checker-unknown.exception.js +15 -0
- package/exceptions/update-checker-unknown.exception.js.map +1 -0
- package/exceptions/update-download-interrupted.exception.js +15 -0
- package/exceptions/update-download-interrupted.exception.js.map +1 -0
- package/exceptions/update-download-mismatch.exception.js +15 -0
- package/exceptions/update-download-mismatch.exception.js.map +1 -0
- package/exceptions/update-failed-unexpectedly.exception.js +15 -0
- package/exceptions/update-failed-unexpectedly.exception.js.map +1 -0
- package/exceptions/update-feed-redirected.exception.js +15 -0
- package/exceptions/update-feed-redirected.exception.js.map +1 -0
- package/exceptions/update-feed-refused.exception.js +17 -0
- package/exceptions/update-feed-refused.exception.js.map +1 -0
- package/exceptions/update-feed-unreachable.exception.js +15 -0
- package/exceptions/update-feed-unreachable.exception.js.map +1 -0
- package/exceptions/update-handoff.exception.js +14 -0
- package/exceptions/update-handoff.exception.js.map +1 -0
- package/exceptions/update-holder-not-found.exception.js +15 -0
- package/exceptions/update-holder-not-found.exception.js.map +1 -0
- package/exceptions/update-info-invalid.exception.js +15 -0
- package/exceptions/update-info-invalid.exception.js.map +1 -0
- package/exceptions/update-no-longer-offered.exception.js +17 -0
- package/exceptions/update-no-longer-offered.exception.js.map +1 -0
- package/exceptions/update-not-signed.exception.js +15 -0
- package/exceptions/update-not-signed.exception.js.map +1 -0
- package/exceptions/update-not-staged-in-time.exception.js +15 -0
- package/exceptions/update-not-staged-in-time.exception.js.map +1 -0
- package/exceptions/update-not-staged.exception.js +15 -0
- package/exceptions/update-not-staged.exception.js.map +1 -0
- package/exceptions/update-refused.exception.js +19 -0
- package/exceptions/update-refused.exception.js.map +1 -0
- package/exceptions/update-runtime-not-found.exception.js +17 -0
- package/exceptions/update-runtime-not-found.exception.js.map +1 -0
- package/exceptions/update-runtime-not-reached.exception.js +17 -0
- package/exceptions/update-runtime-not-reached.exception.js.map +1 -0
- package/exceptions/update-runtime-still-starting.exception.js +17 -0
- package/exceptions/update-runtime-still-starting.exception.js.map +1 -0
- package/exceptions/update-stop-failed-unexpectedly.exception.js +15 -0
- package/exceptions/update-stop-failed-unexpectedly.exception.js.map +1 -0
- package/exceptions/update-stop.exception.js +14 -0
- package/exceptions/update-stop.exception.js.map +1 -0
- package/exceptions/update-under-way.exception.js +15 -0
- package/exceptions/update-under-way.exception.js.map +1 -0
- package/exceptions/update-unsaved.exception.js +19 -0
- package/exceptions/update-unsaved.exception.js.map +1 -0
- package/exceptions/update.exception.js +14 -0
- package/exceptions/update.exception.js.map +1 -0
- package/exceptions/window-state-not-connected.exception.js +15 -0
- package/exceptions/window-state-not-connected.exception.js.map +1 -0
- package/exceptions/window-state-refused.exception.js +19 -0
- package/exceptions/window-state-refused.exception.js.map +1 -0
- package/exceptions/window-state-runtime-unreachable.exception.js +15 -0
- package/exceptions/window-state-runtime-unreachable.exception.js.map +1 -0
- package/exceptions/window-state-unavailable.exception.js +14 -0
- package/exceptions/window-state-unavailable.exception.js.map +1 -0
- package/exceptions/window-state.exception.js +14 -0
- package/exceptions/window-state.exception.js.map +1 -0
- package/exceptions/work-started-meanwhile.exception.js +17 -0
- package/exceptions/work-started-meanwhile.exception.js.map +1 -0
- package/interfaces/i-app-updater.js +9 -0
- package/interfaces/i-app-updater.js.map +1 -0
- package/interfaces/i-application-host.js +9 -0
- package/interfaces/i-application-host.js.map +1 -0
- package/interfaces/i-checked-path.js +9 -0
- package/interfaces/i-checked-path.js.map +1 -0
- package/interfaces/i-clipboard-host.js +9 -0
- package/interfaces/i-clipboard-host.js.map +1 -0
- package/interfaces/i-close-guard.js +9 -0
- package/interfaces/i-close-guard.js.map +1 -0
- package/interfaces/i-command-line-host.js +9 -0
- package/interfaces/i-command-line-host.js.map +1 -0
- package/interfaces/i-context-menu-params.js +9 -0
- package/interfaces/i-context-menu-params.js.map +1 -0
- package/interfaces/i-created-updater.js +9 -0
- package/interfaces/i-created-updater.js.map +1 -0
- package/interfaces/i-device-file-store.js +9 -0
- package/interfaces/i-device-file-store.js.map +1 -0
- package/interfaces/i-dialog-host.js +9 -0
- package/interfaces/i-dialog-host.js.map +1 -0
- package/interfaces/i-display-host.js +9 -0
- package/interfaces/i-display-host.js.map +1 -0
- package/interfaces/i-dock-host.js +9 -0
- package/interfaces/i-dock-host.js.map +1 -0
- package/interfaces/i-electron.js +9 -0
- package/interfaces/i-electron.js.map +1 -0
- package/interfaces/i-feed-net-session.js +9 -0
- package/interfaces/i-feed-net-session.js.map +1 -0
- package/interfaces/i-feed-response.js +9 -0
- package/interfaces/i-feed-response.js.map +1 -0
- package/interfaces/i-feed-runtime-options.js +9 -0
- package/interfaces/i-feed-runtime-options.js.map +1 -0
- package/interfaces/i-feed-web-request.js +9 -0
- package/interfaces/i-feed-web-request.js.map +1 -0
- package/interfaces/i-ipc-event.js +9 -0
- package/interfaces/i-ipc-event.js.map +1 -0
- package/interfaces/i-ipc-host.js +9 -0
- package/interfaces/i-ipc-host.js.map +1 -0
- package/interfaces/i-ipc-owners.js +9 -0
- package/interfaces/i-ipc-owners.js.map +1 -0
- package/interfaces/i-main-process-environment.js +9 -0
- package/interfaces/i-main-process-environment.js.map +1 -0
- package/interfaces/i-main-process-log.js +9 -0
- package/interfaces/i-main-process-log.js.map +1 -0
- package/interfaces/i-main-process-options.js +9 -0
- package/interfaces/i-main-process-options.js.map +1 -0
- package/interfaces/i-main-process-tray-parts.js +9 -0
- package/interfaces/i-main-process-tray-parts.js.map +1 -0
- package/interfaces/i-main-process-update-parts.js +9 -0
- package/interfaces/i-main-process-update-parts.js.map +1 -0
- package/interfaces/i-main-process-window.js +9 -0
- package/interfaces/i-main-process-window.js.map +1 -0
- package/interfaces/i-menu-host.js +9 -0
- package/interfaces/i-menu-host.js.map +1 -0
- package/interfaces/i-native-updater.js +9 -0
- package/interfaces/i-native-updater.js.map +1 -0
- package/interfaces/i-notification-host.js +9 -0
- package/interfaces/i-notification-host.js.map +1 -0
- package/interfaces/i-parent-port.js +9 -0
- package/interfaces/i-parent-port.js.map +1 -0
- package/interfaces/i-path-command-files.js +9 -0
- package/interfaces/i-path-command-files.js.map +1 -0
- package/interfaces/i-permission-host.js +9 -0
- package/interfaces/i-permission-host.js.map +1 -0
- package/interfaces/i-preload-channels.js +9 -0
- package/interfaces/i-preload-channels.js.map +1 -0
- package/interfaces/i-preload-settings.js +9 -0
- package/interfaces/i-preload-settings.js.map +1 -0
- package/interfaces/i-preventable-event.js +9 -0
- package/interfaces/i-preventable-event.js.map +1 -0
- package/interfaces/i-program-host.js +9 -0
- package/interfaces/i-program-host.js.map +1 -0
- package/interfaces/i-protocol-host.js +9 -0
- package/interfaces/i-protocol-host.js.map +1 -0
- package/interfaces/i-quit-control-parts.js +9 -0
- package/interfaces/i-quit-control-parts.js.map +1 -0
- package/interfaces/i-quit-host.js +9 -0
- package/interfaces/i-quit-host.js.map +1 -0
- package/interfaces/i-quit-prompt.js +9 -0
- package/interfaces/i-quit-prompt.js.map +1 -0
- package/interfaces/i-runtime-connection.js +9 -0
- package/interfaces/i-runtime-connection.js.map +1 -0
- package/interfaces/i-runtime-event-owners.js +9 -0
- package/interfaces/i-runtime-event-owners.js.map +1 -0
- package/interfaces/i-runtime-launcher.js +9 -0
- package/interfaces/i-runtime-launcher.js.map +1 -0
- package/interfaces/i-scheme-registry.js +9 -0
- package/interfaces/i-scheme-registry.js.map +1 -0
- package/interfaces/i-secret-storage-host.js +9 -0
- package/interfaces/i-secret-storage-host.js.map +1 -0
- package/interfaces/i-sender-frame.js +9 -0
- package/interfaces/i-sender-frame.js.map +1 -0
- package/interfaces/i-session-host.js +9 -0
- package/interfaces/i-session-host.js.map +1 -0
- package/interfaces/i-shell-host.js +9 -0
- package/interfaces/i-shell-host.js.map +1 -0
- package/interfaces/i-ship-it-process.js +9 -0
- package/interfaces/i-ship-it-process.js.map +1 -0
- package/interfaces/i-shortcut-host.js +9 -0
- package/interfaces/i-shortcut-host.js.map +1 -0
- package/interfaces/i-shown-path-files.js +9 -0
- package/interfaces/i-shown-path-files.js.map +1 -0
- package/interfaces/i-shown-path-status.js +9 -0
- package/interfaces/i-shown-path-status.js.map +1 -0
- package/interfaces/i-spell-check-host.js +9 -0
- package/interfaces/i-spell-check-host.js.map +1 -0
- package/interfaces/i-split-path.js +9 -0
- package/interfaces/i-split-path.js.map +1 -0
- package/interfaces/i-system-notification.js +9 -0
- package/interfaces/i-system-notification.js.map +1 -0
- package/interfaces/i-theme-host.js +9 -0
- package/interfaces/i-theme-host.js.map +1 -0
- package/interfaces/i-tray-actions.js +9 -0
- package/interfaces/i-tray-actions.js.map +1 -0
- package/interfaces/i-tray-host.js +9 -0
- package/interfaces/i-tray-host.js.map +1 -0
- package/interfaces/i-tray.js +9 -0
- package/interfaces/i-tray.js.map +1 -0
- package/interfaces/i-update-check-lock.js +9 -0
- package/interfaces/i-update-check-lock.js.map +1 -0
- package/interfaces/i-update-handoff.js +9 -0
- package/interfaces/i-update-handoff.js.map +1 -0
- package/interfaces/i-update-host.js +9 -0
- package/interfaces/i-update-host.js.map +1 -0
- package/interfaces/i-update-setup.js +9 -0
- package/interfaces/i-update-setup.js.map +1 -0
- package/interfaces/i-update-target.js +9 -0
- package/interfaces/i-update-target.js.map +1 -0
- package/interfaces/i-updater.js +9 -0
- package/interfaces/i-updater.js.map +1 -0
- package/interfaces/i-utility-process-host.js +9 -0
- package/interfaces/i-utility-process-host.js.map +1 -0
- package/interfaces/i-utility-process.js +9 -0
- package/interfaces/i-utility-process.js.map +1 -0
- package/interfaces/i-web-view-attach-params.js +9 -0
- package/interfaces/i-web-view-attach-params.js.map +1 -0
- package/interfaces/i-web-view-attach-preferences.js +9 -0
- package/interfaces/i-web-view-attach-preferences.js.map +1 -0
- package/interfaces/i-web-view-contents.js +9 -0
- package/interfaces/i-web-view-contents.js.map +1 -0
- package/interfaces/i-web-view-debugger.js +9 -0
- package/interfaces/i-web-view-debugger.js.map +1 -0
- package/interfaces/i-web-view-engine.js +9 -0
- package/interfaces/i-web-view-engine.js.map +1 -0
- package/interfaces/i-web-view-guest.js +9 -0
- package/interfaces/i-web-view-guest.js.map +1 -0
- package/interfaces/i-web-view-input-event.js +9 -0
- package/interfaces/i-web-view-input-event.js.map +1 -0
- package/interfaces/i-web-view-input.js +9 -0
- package/interfaces/i-web-view-input.js.map +1 -0
- package/interfaces/i-web-view-key-event.js +9 -0
- package/interfaces/i-web-view-key-event.js.map +1 -0
- package/interfaces/i-web-view-redirect.js +9 -0
- package/interfaces/i-web-view-redirect.js.map +1 -0
- package/interfaces/i-web-view-request.js +9 -0
- package/interfaces/i-web-view-request.js.map +1 -0
- package/interfaces/i-web-view-session.js +9 -0
- package/interfaces/i-web-view-session.js.map +1 -0
- package/interfaces/i-window-contents.js +9 -0
- package/interfaces/i-window-contents.js.map +1 -0
- package/interfaces/i-window-navigation.js +9 -0
- package/interfaces/i-window-navigation.js.map +1 -0
- package/interfaces/i-window-open-details.js +9 -0
- package/interfaces/i-window-open-details.js.map +1 -0
- package/interfaces/i-window-session.js +9 -0
- package/interfaces/i-window-session.js.map +1 -0
- package/interfaces/i-window-state-store.js +9 -0
- package/interfaces/i-window-state-store.js.map +1 -0
- package/main.js +160 -0
- package/main.js.map +1 -0
- package/models/caught-failure.js +15 -0
- package/models/caught-failure.js.map +1 -0
- package/models/detached-start-reply.js +51 -0
- package/models/detached-start-reply.js.map +1 -0
- package/models/detached-start-request.js +45 -0
- package/models/detached-start-request.js.map +1 -0
- package/models/error-code.js +22 -0
- package/models/error-code.js.map +1 -0
- package/models/feed-source.js +32 -0
- package/models/feed-source.js.map +1 -0
- package/models/file-grant-request.js +35 -0
- package/models/file-grant-request.js.map +1 -0
- package/models/file-path-choice.js +38 -0
- package/models/file-path-choice.js.map +1 -0
- package/models/issued-files.js +21 -0
- package/models/issued-files.js.map +1 -0
- package/models/known-device.js +32 -0
- package/models/known-device.js.map +1 -0
- package/models/longest-text.js +35 -0
- package/models/longest-text.js.map +1 -0
- package/models/main-process-phase.js +13 -0
- package/models/main-process-phase.js.map +1 -0
- package/models/main-process-settings.js +34 -0
- package/models/main-process-settings.js.map +1 -0
- package/models/menu-bar-menu.js +25 -0
- package/models/menu-bar-menu.js.map +1 -0
- package/models/menu-bar-row.js +49 -0
- package/models/menu-bar-row.js.map +1 -0
- package/models/menu-bar.js +20 -0
- package/models/menu-bar.js.map +1 -0
- package/models/offered-file.js +50 -0
- package/models/offered-file.js.map +1 -0
- package/models/pending-quit.js +26 -0
- package/models/pending-quit.js.map +1 -0
- package/models/preload-settings.js +21 -0
- package/models/preload-settings.js.map +1 -0
- package/models/quit-question.js +22 -0
- package/models/quit-question.js.map +1 -0
- package/models/screen-area.js +31 -0
- package/models/screen-area.js.map +1 -0
- package/models/sender-info.js +18 -0
- package/models/sender-info.js.map +1 -0
- package/models/started-program.js +17 -0
- package/models/started-program.js.map +1 -0
- package/models/startup-state.js +45 -0
- package/models/startup-state.js.map +1 -0
- package/models/taskbar-identity.js +48 -0
- package/models/taskbar-identity.js.map +1 -0
- package/models/update-ready-record.js +37 -0
- package/models/update-ready-record.js.map +1 -0
- package/models/update-status.js +40 -0
- package/models/update-status.js.map +1 -0
- package/models/update-stop-result.js +22 -0
- package/models/update-stop-result.js.map +1 -0
- package/models/update-version.js +43 -0
- package/models/update-version.js.map +1 -0
- package/models/web-view-history.js +19 -0
- package/models/web-view-history.js.map +1 -0
- package/models/window-appearance.js +52 -0
- package/models/window-appearance.js.map +1 -0
- package/models/window-page.js +23 -0
- package/models/window-page.js.map +1 -0
- package/models/window-registry.js +85 -0
- package/models/window-registry.js.map +1 -0
- package/models/window-state.js +93 -0
- package/models/window-state.js.map +1 -0
- package/package.json +78 -3
- package/preload.cjs +186 -0
- package/preload.cjs.map +1 -0
- package/resources.js +1549 -0
- package/resources.js.map +1 -0
- package/services/agent-controller.js +61 -0
- package/services/agent-controller.js.map +1 -0
- package/services/app-icons.js +49 -0
- package/services/app-icons.js.map +1 -0
- package/services/app-image-environment.js +34 -0
- package/services/app-image-environment.js.map +1 -0
- package/services/app-image-handoff.js +33 -0
- package/services/app-image-handoff.js.map +1 -0
- package/services/app-image-replacement.js +82 -0
- package/services/app-image-replacement.js.map +1 -0
- package/services/app-image-restart.js +71 -0
- package/services/app-image-restart.js.map +1 -0
- package/services/app-surface-feed.js +114 -0
- package/services/app-surface-feed.js.map +1 -0
- package/services/appearance-keeper.js +67 -0
- package/services/appearance-keeper.js.map +1 -0
- package/services/application-menu.js +14 -0
- package/services/application-menu.js.map +1 -0
- package/services/child-program-host.js +59 -0
- package/services/child-program-host.js.map +1 -0
- package/services/clipboard-copier.js +82 -0
- package/services/clipboard-copier.js.map +1 -0
- package/services/close-coordinator.js +47 -0
- package/services/close-coordinator.js.map +1 -0
- package/services/command-installer.js +58 -0
- package/services/command-installer.js.map +1 -0
- package/services/daily-check-mark.js +61 -0
- package/services/daily-check-mark.js.map +1 -0
- package/services/debian-handoff.js +41 -0
- package/services/debian-handoff.js.map +1 -0
- package/services/debian-package.js +24 -0
- package/services/debian-package.js.map +1 -0
- package/services/detached-start.js +27 -0
- package/services/detached-start.js.map +1 -0
- package/services/device-file-store.js +45 -0
- package/services/device-file-store.js.map +1 -0
- package/services/device-identity.js +39 -0
- package/services/device-identity.js.map +1 -0
- package/services/device-setting-follower.js +61 -0
- package/services/device-setting-follower.js.map +1 -0
- package/services/device-state.js +51 -0
- package/services/device-state.js.map +1 -0
- package/services/electron-web-view-contents.js +96 -0
- package/services/electron-web-view-contents.js.map +1 -0
- package/services/electron-web-view-engine.js +42 -0
- package/services/electron-web-view-engine.js.map +1 -0
- package/services/electron-web-view-session.js +47 -0
- package/services/electron-web-view-session.js.map +1 -0
- package/services/feed-provider.js +84 -0
- package/services/feed-provider.js.map +1 -0
- package/services/feed-request-guard.js +63 -0
- package/services/feed-request-guard.js.map +1 -0
- package/services/feed-session.js +30 -0
- package/services/feed-session.js.map +1 -0
- package/services/feed-updater.js +119 -0
- package/services/feed-updater.js.map +1 -0
- package/services/file-dialogs.js +180 -0
- package/services/file-dialogs.js.map +1 -0
- package/services/file-grant-issuer.js +119 -0
- package/services/file-grant-issuer.js.map +1 -0
- package/services/file-presence.js +14 -0
- package/services/file-presence.js.map +1 -0
- package/services/installer-handoff.js +75 -0
- package/services/installer-handoff.js.map +1 -0
- package/services/installer-start.js +35 -0
- package/services/installer-start.js.map +1 -0
- package/services/ipc-router.js +114 -0
- package/services/ipc-router.js.map +1 -0
- package/services/layout-keeper.js +52 -0
- package/services/layout-keeper.js.map +1 -0
- package/services/local-window-state-store.js +38 -0
- package/services/local-window-state-store.js.map +1 -0
- package/services/main-process-log.js +81 -0
- package/services/main-process-log.js.map +1 -0
- package/services/main-process-record.js +19 -0
- package/services/main-process-record.js.map +1 -0
- package/services/main-process-recovery.js +98 -0
- package/services/main-process-recovery.js.map +1 -0
- package/services/main-process-services.js +34 -0
- package/services/main-process-services.js.map +1 -0
- package/services/main-process-tray.js +64 -0
- package/services/main-process-tray.js.map +1 -0
- package/services/main-process-updates.js +69 -0
- package/services/main-process-updates.js.map +1 -0
- package/services/main-process.js +530 -0
- package/services/main-process.js.map +1 -0
- package/services/menu-bar-template.js +78 -0
- package/services/menu-bar-template.js.map +1 -0
- package/services/mirrored-window-state-store.js +26 -0
- package/services/mirrored-window-state-store.js.map +1 -0
- package/services/open-web-view.js +784 -0
- package/services/open-web-view.js.map +1 -0
- package/services/open-web-view.resources.js +13 -0
- package/services/open-web-view.resources.js.map +1 -0
- package/services/open-window.js +155 -0
- package/services/open-window.js.map +1 -0
- package/services/opened-file-policy.js +46 -0
- package/services/opened-file-policy.js.map +1 -0
- package/services/path-command.js +78 -0
- package/services/path-command.js.map +1 -0
- package/services/product-app-adapter.js +30 -0
- package/services/product-app-adapter.js.map +1 -0
- package/services/publisher-check.js +78 -0
- package/services/publisher-check.js.map +1 -0
- package/services/quit-control.js +78 -0
- package/services/quit-control.js.map +1 -0
- package/services/quit-coordinator.js +98 -0
- package/services/quit-coordinator.js.map +1 -0
- package/services/quit-flow.js +59 -0
- package/services/quit-flow.js.map +1 -0
- package/services/restart-arguments.js +58 -0
- package/services/restart-arguments.js.map +1 -0
- package/services/runtime-caller.js +31 -0
- package/services/runtime-caller.js.map +1 -0
- package/services/runtime-events.js +100 -0
- package/services/runtime-events.js.map +1 -0
- package/services/runtime-requests.js +92 -0
- package/services/runtime-requests.js.map +1 -0
- package/services/runtime-startup.js +228 -0
- package/services/runtime-startup.js.map +1 -0
- package/services/runtime-window-state-store.js +50 -0
- package/services/runtime-window-state-store.js.map +1 -0
- package/services/secret-answerer.js +57 -0
- package/services/secret-answerer.js.map +1 -0
- package/services/sender-policy.js +24 -0
- package/services/sender-policy.js.map +1 -0
- package/services/shared-file-server.js +71 -0
- package/services/shared-file-server.js.map +1 -0
- package/services/shell-opener.js +88 -0
- package/services/shell-opener.js.map +1 -0
- package/services/ship-it-process.js +54 -0
- package/services/ship-it-process.js.map +1 -0
- package/services/shown-file-policy.js +95 -0
- package/services/shown-file-policy.js.map +1 -0
- package/services/spell-checker.js +62 -0
- package/services/spell-checker.js.map +1 -0
- package/services/spelling-dictionaries.js +58 -0
- package/services/spelling-dictionaries.js.map +1 -0
- package/services/squirrel-handoff.js +98 -0
- package/services/squirrel-handoff.js.map +1 -0
- package/services/stop-key-controller.js +97 -0
- package/services/stop-key-controller.js.map +1 -0
- package/services/system-notifier.js +103 -0
- package/services/system-notifier.js.map +1 -0
- package/services/terminal-relaunch.js +52 -0
- package/services/terminal-relaunch.js.map +1 -0
- package/services/tray-controller.js +164 -0
- package/services/tray-controller.js.map +1 -0
- package/services/tray-host-watcher.js +86 -0
- package/services/tray-host-watcher.js.map +1 -0
- package/services/tray-menu-template.js +42 -0
- package/services/tray-menu-template.js.map +1 -0
- package/services/tray-notices.js +76 -0
- package/services/tray-notices.js.map +1 -0
- package/services/tray-refresher.js +72 -0
- package/services/tray-refresher.js.map +1 -0
- package/services/update-barrier-gate.js +78 -0
- package/services/update-barrier-gate.js.map +1 -0
- package/services/update-barrier-watch.js +83 -0
- package/services/update-barrier-watch.js.map +1 -0
- package/services/update-bridge.js +86 -0
- package/services/update-bridge.js.map +1 -0
- package/services/update-check-lock.js +120 -0
- package/services/update-check-lock.js.map +1 -0
- package/services/update-controller.js +325 -0
- package/services/update-controller.js.map +1 -0
- package/services/update-restart.js +139 -0
- package/services/update-restart.js.map +1 -0
- package/services/update-save-coordinator.js +48 -0
- package/services/update-save-coordinator.js.map +1 -0
- package/services/update-stop.js +222 -0
- package/services/update-stop.js.map +1 -0
- package/services/update-target-connector.js +84 -0
- package/services/update-target-connector.js.map +1 -0
- package/services/update-work-question.js +84 -0
- package/services/update-work-question.js.map +1 -0
- package/services/utility-process-starter.js +47 -0
- package/services/utility-process-starter.js.map +1 -0
- package/services/web-view-attach-guard.js +41 -0
- package/services/web-view-attach-guard.js.map +1 -0
- package/services/web-view-bridge.js +55 -0
- package/services/web-view-bridge.js.map +1 -0
- package/services/web-view-event-backlog.js +38 -0
- package/services/web-view-event-backlog.js.map +1 -0
- package/services/web-view-event-cut.js +42 -0
- package/services/web-view-event-cut.js.map +1 -0
- package/services/web-view-host.js +340 -0
- package/services/web-view-host.js.map +1 -0
- package/services/web-view-key-input.js +37 -0
- package/services/web-view-key-input.js.map +1 -0
- package/services/web-view-origin-check.js +150 -0
- package/services/web-view-origin-check.js.map +1 -0
- package/services/web-view-origin-check.resources.js +46 -0
- package/services/web-view-origin-check.resources.js.map +1 -0
- package/services/window-bounds-keeper.js +145 -0
- package/services/window-bounds-keeper.js.map +1 -0
- package/services/window-controls.js +97 -0
- package/services/window-controls.js.map +1 -0
- package/services/window-error-limit.js +32 -0
- package/services/window-error-limit.js.map +1 -0
- package/services/window-factory.js +87 -0
- package/services/window-factory.js.map +1 -0
- package/services/window-placement.js +67 -0
- package/services/window-placement.js.map +1 -0
- package/services/window-recovery.js +138 -0
- package/services/window-recovery.js.map +1 -0
- package/services/window-text-log.js +37 -0
- package/services/window-text-log.js.map +1 -0
- package/utility-entry.js +11 -0
- package/utility-entry.js.map +1 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { inspect } from "node:util";
|
|
9
|
+
import "@noldova/context.core";
|
|
10
|
+
import { ShellEvents, ShellMethods, StopPolicy, UpdateSaved } from "@noldova/desktop.protocol";
|
|
11
|
+
import { ConnectionException, LaunchException, PreShellDataFoundException, RuntimeHandoverException, UpdateInProgressException, WorkInProgressException } from "@noldova/desktop.runtime";
|
|
12
|
+
import { StartupStateKind } from "../enums/startup-state-kind.js";
|
|
13
|
+
import { StartupState } from "../models/startup-state.js";
|
|
14
|
+
import { Resources } from "../resources.js";
|
|
15
|
+
export class RuntimeStartup {
|
|
16
|
+
launcher;
|
|
17
|
+
publish;
|
|
18
|
+
handOver;
|
|
19
|
+
waitInterval;
|
|
20
|
+
forward;
|
|
21
|
+
log;
|
|
22
|
+
now;
|
|
23
|
+
wait;
|
|
24
|
+
updates;
|
|
25
|
+
listener;
|
|
26
|
+
closing = new AbortController();
|
|
27
|
+
state = StartupState.connecting();
|
|
28
|
+
beforeUpdate = StartupState.ready();
|
|
29
|
+
connectionValue = null;
|
|
30
|
+
readyAt = 0;
|
|
31
|
+
unstableEnds = 0;
|
|
32
|
+
barrierChange = Promise.withResolvers();
|
|
33
|
+
constructor(launcher, publish, handOver, waitInterval, forward, log, now, wait, updates) {
|
|
34
|
+
this.launcher = launcher;
|
|
35
|
+
this.publish = publish;
|
|
36
|
+
this.handOver = handOver;
|
|
37
|
+
this.waitInterval = waitInterval;
|
|
38
|
+
this.forward = forward;
|
|
39
|
+
this.log = log;
|
|
40
|
+
this.now = now;
|
|
41
|
+
this.wait = wait;
|
|
42
|
+
this.updates = updates;
|
|
43
|
+
this.listener = {
|
|
44
|
+
onEvent: t => this.receive(t),
|
|
45
|
+
onDisconnected: t => this.reconnect(t)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
get current() {
|
|
49
|
+
return this.state;
|
|
50
|
+
}
|
|
51
|
+
get connection() {
|
|
52
|
+
return this.connectionValue;
|
|
53
|
+
}
|
|
54
|
+
startAsync() {
|
|
55
|
+
return this.attachAsync(StopPolicy.IfIdle);
|
|
56
|
+
}
|
|
57
|
+
async actAsync(action) {
|
|
58
|
+
const kind = this.state.kind;
|
|
59
|
+
if (action === Resources.moveAsideAction && kind === StartupStateKind.PreShellData)
|
|
60
|
+
await this.runAsync(() => this.launcher.moveAsideAsync(Resources.clientName, this.listener, StopPolicy.IfIdle));
|
|
61
|
+
else if (action === Resources.stopWorkAction && kind === StartupStateKind.WorkInProgress)
|
|
62
|
+
await this.attachAsync(StopPolicy.StopWork);
|
|
63
|
+
else if (action === Resources.waitAction && kind === StartupStateKind.WorkInProgress)
|
|
64
|
+
await this.waitForWorkAsync();
|
|
65
|
+
else if (action === Resources.retryAction && kind === StartupStateKind.Failed) {
|
|
66
|
+
this.unstableEnds = 0;
|
|
67
|
+
await this.attachAsync(StopPolicy.IfIdle);
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
barrierChanged() {
|
|
74
|
+
this.barrierChange.resolve();
|
|
75
|
+
}
|
|
76
|
+
close() {
|
|
77
|
+
this.closing.abort();
|
|
78
|
+
this.connectionValue?.close();
|
|
79
|
+
this.connectionValue = null;
|
|
80
|
+
}
|
|
81
|
+
get isClosed() {
|
|
82
|
+
return this.closing.signal.aborted;
|
|
83
|
+
}
|
|
84
|
+
attach(policy) {
|
|
85
|
+
return this.launcher.attachAsync(Resources.clientName, this.listener, policy);
|
|
86
|
+
}
|
|
87
|
+
attachAsync(policy) {
|
|
88
|
+
return this.runAsync(() => this.attach(policy));
|
|
89
|
+
}
|
|
90
|
+
async waitForWorkAsync() {
|
|
91
|
+
while (!this.isClosed) {
|
|
92
|
+
try {
|
|
93
|
+
this.accept(await this.attach(StopPolicy.IfIdle));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (!(error instanceof WorkInProgressException))
|
|
98
|
+
return await this.refuseAsync(error);
|
|
99
|
+
this.update(StartupState.waitingForWork(error.work.descriptions));
|
|
100
|
+
}
|
|
101
|
+
await this.pauseAsync(this.waitInterval);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async pauseAsync(milliseconds, signal = this.closing.signal) {
|
|
105
|
+
try {
|
|
106
|
+
signal.throwIfAborted();
|
|
107
|
+
await this.wait(milliseconds, signal);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (!signal.aborted)
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async runAsync(attach) {
|
|
115
|
+
this.update(StartupState.connecting());
|
|
116
|
+
await this.connectAsync(attach);
|
|
117
|
+
}
|
|
118
|
+
async connectAsync(attach) {
|
|
119
|
+
try {
|
|
120
|
+
this.accept(await attach());
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
await this.refuseAsync(error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
accept(connection) {
|
|
127
|
+
if (this.isClosed) {
|
|
128
|
+
connection.close();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.connectionValue = connection;
|
|
132
|
+
this.readyAt = this.now();
|
|
133
|
+
this.update(StartupState.ready());
|
|
134
|
+
}
|
|
135
|
+
async refuseAsync(error) {
|
|
136
|
+
if (error instanceof UpdateInProgressException)
|
|
137
|
+
await this.passBarrierAsync(error.status);
|
|
138
|
+
else if (error instanceof PreShellDataFoundException)
|
|
139
|
+
this.update(StartupState.preShellData(error.data.location));
|
|
140
|
+
else if (error instanceof WorkInProgressException)
|
|
141
|
+
this.update(StartupState.workInProgress(error.work.descriptions));
|
|
142
|
+
else if (error instanceof RuntimeHandoverException) {
|
|
143
|
+
if (!this.handOver(error.handover))
|
|
144
|
+
this.update(StartupState.newerBuild(error.handover.identity.productVersion));
|
|
145
|
+
}
|
|
146
|
+
else if (error instanceof LaunchException || error instanceof ConnectionException) {
|
|
147
|
+
this.log(Resources.formatRuntimeNotStarted(error.message));
|
|
148
|
+
this.update(StartupState.failed(error.message));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.log(Resources.formatRuntimeNotStarted(inspect(error)));
|
|
152
|
+
this.update(StartupState.failed(String(error)));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async passBarrierAsync(status) {
|
|
156
|
+
if (await this.updates.passBarrierAsync(status))
|
|
157
|
+
await this.attachAsync(StopPolicy.IfIdle);
|
|
158
|
+
else
|
|
159
|
+
this.updates.quit();
|
|
160
|
+
}
|
|
161
|
+
receive(event) {
|
|
162
|
+
if (event.name.equals(ShellEvents.updating))
|
|
163
|
+
void this.freezeAsync(this.connectionValue);
|
|
164
|
+
else if (event.name.equals(ShellEvents.updateEnded) && this.state.kind === StartupStateKind.Updating && !Object.isNull(this.connectionValue))
|
|
165
|
+
this.update(this.beforeUpdate);
|
|
166
|
+
this.forward(event);
|
|
167
|
+
}
|
|
168
|
+
async freezeAsync(connection) {
|
|
169
|
+
if (Object.isNull(connection))
|
|
170
|
+
return;
|
|
171
|
+
if (this.state.kind !== StartupStateKind.Updating)
|
|
172
|
+
this.beforeUpdate = this.state;
|
|
173
|
+
this.update(StartupState.updating(String.empty));
|
|
174
|
+
const barrier = await this.updates.readBarrierAsync().catch(() => null);
|
|
175
|
+
if (this.state.kind !== StartupStateKind.Updating)
|
|
176
|
+
return;
|
|
177
|
+
if (!Object.isNull(barrier))
|
|
178
|
+
this.update(StartupState.updating(barrier.version));
|
|
179
|
+
const saved = new UpdateSaved(this.updates.processId, await this.updates.saveAsync());
|
|
180
|
+
await connection.callAsync(ShellMethods.updateSaved, saved.toJson())
|
|
181
|
+
.catch((error) => this.log(Resources.formatUpdateSavedUnsent(String(error))));
|
|
182
|
+
}
|
|
183
|
+
async followUpdateAsync() {
|
|
184
|
+
while (!this.isClosed) {
|
|
185
|
+
this.barrierChange = Promise.withResolvers();
|
|
186
|
+
if (await this.updates.hasUpdateEndedAsync().catch(() => false)) {
|
|
187
|
+
await this.attachAsync(StopPolicy.IfIdle);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const woken = new AbortController();
|
|
191
|
+
void this.barrierChange.promise.then(() => woken.abort());
|
|
192
|
+
await this.pauseAsync(Resources.updateBarrierInterval, AbortSignal.any([this.closing.signal, woken.signal]));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
reconnect(failure) {
|
|
196
|
+
if (Object.isNull(this.connectionValue) || this.isClosed)
|
|
197
|
+
return;
|
|
198
|
+
this.connectionValue = null;
|
|
199
|
+
if (this.state.kind === StartupStateKind.Updating) {
|
|
200
|
+
this.publish(this.state);
|
|
201
|
+
void this.followUpdateAsync();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.unstableEnds = this.now() - this.readyAt < Resources.stableConnectionPeriod ? this.unstableEnds + 1 : 1;
|
|
205
|
+
const delay = Resources.reconnectionDelays[this.unstableEnds - 1];
|
|
206
|
+
if (Object.isUndefined(delay))
|
|
207
|
+
return this.stopReconnecting(failure);
|
|
208
|
+
this.log(Object.isNull(failure) ? Resources.connectionEndedByRuntime : Resources.formatConnectionEnded(failure.code, failure.message));
|
|
209
|
+
void this.reconnectAsync(delay);
|
|
210
|
+
}
|
|
211
|
+
async reconnectAsync(delay) {
|
|
212
|
+
this.update(StartupState.connecting());
|
|
213
|
+
if (delay > 0)
|
|
214
|
+
await this.pauseAsync(delay);
|
|
215
|
+
if (!this.isClosed)
|
|
216
|
+
await this.connectAsync(() => this.attach(StopPolicy.IfIdle));
|
|
217
|
+
}
|
|
218
|
+
stopReconnecting(failure) {
|
|
219
|
+
const details = Resources.formatReconnectionStopped(Object.isNull(failure) ? Resources.endedByRuntime : Resources.formatEndedByMainProcess(failure.code, failure.message));
|
|
220
|
+
this.log(Resources.formatRuntimeNotStarted(details));
|
|
221
|
+
this.update(StartupState.failed(details));
|
|
222
|
+
}
|
|
223
|
+
update(state) {
|
|
224
|
+
this.state = state;
|
|
225
|
+
this.publish(state);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=runtime-startup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-startup.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/runtime-startup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAkD,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC/I,OAAO,EACL,mBAAmB,EAEnB,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EAExB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,cAAc;IACR,QAAQ,CAAmB;IAC3B,OAAO,CAAgC;IACvC,QAAQ,CAAyC;IACjD,YAAY,CAAS;IACrB,OAAO,CAAyB;IAChC,GAAG,CAA4B;IAC/B,GAAG,CAAe;IAClB,IAAI,CAA+D;IACnE,OAAO,CAAc;IACrB,QAAQ,CAAyB;IACjC,OAAO,GAAoB,IAAI,eAAe,EAAE,CAAC;IAC1D,KAAK,GAAiB,YAAY,CAAC,UAAU,EAAE,CAAC;IAChD,YAAY,GAAiB,YAAY,CAAC,KAAK,EAAE,CAAC;IAClD,eAAe,GAA8B,IAAI,CAAC;IAClD,OAAO,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code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { WindowStateValue, WindowStateWrite } from "@noldova/desktop.protocol";
|
|
10
|
+
import { ConnectionException } from "@noldova/desktop.runtime";
|
|
11
|
+
import { WindowStateNotConnectedException } from "../exceptions/window-state-not-connected.exception.js";
|
|
12
|
+
import { WindowStateRefusedException } from "../exceptions/window-state-refused.exception.js";
|
|
13
|
+
import { WindowStateRuntimeUnreachableException } from "../exceptions/window-state-runtime-unreachable.exception.js";
|
|
14
|
+
export class RuntimeWindowStateStore {
|
|
15
|
+
connection;
|
|
16
|
+
key;
|
|
17
|
+
readMethod;
|
|
18
|
+
writeMethod;
|
|
19
|
+
constructor(connection, key, readMethod, writeMethod) {
|
|
20
|
+
this.connection = connection;
|
|
21
|
+
this.key = key;
|
|
22
|
+
this.readMethod = readMethod;
|
|
23
|
+
this.writeMethod = writeMethod;
|
|
24
|
+
}
|
|
25
|
+
async readAsync() {
|
|
26
|
+
const response = await this.callAsync(this.readMethod, this.key.toJson());
|
|
27
|
+
return WindowStateValue.fromJson(response.payload).value;
|
|
28
|
+
}
|
|
29
|
+
async writeAsync(value) {
|
|
30
|
+
await this.callAsync(this.writeMethod, new WindowStateWrite(this.key, value).toJson());
|
|
31
|
+
}
|
|
32
|
+
async callAsync(method, payload) {
|
|
33
|
+
const connection = this.connection();
|
|
34
|
+
if (Object.isNull(connection))
|
|
35
|
+
throw new WindowStateNotConnectedException();
|
|
36
|
+
let response;
|
|
37
|
+
try {
|
|
38
|
+
response = await connection.callAsync(method, payload);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (!(error instanceof ConnectionException))
|
|
42
|
+
throw error;
|
|
43
|
+
throw new WindowStateRuntimeUnreachableException(error);
|
|
44
|
+
}
|
|
45
|
+
if (!Object.isUndefined(response.failure))
|
|
46
|
+
throw new WindowStateRefusedException(method, response.failure);
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=runtime-window-state-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-window-state-store.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/runtime-window-state-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAA0D,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACvI,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,sCAAsC,EAAE,MAAM,6DAA6D,CAAC;AAIrH,MAAM,OAAO,uBAAuB;IACjB,UAAU,CAAkC;IAC5C,GAAG,CAAiB;IACpB,UAAU,CAAgB;IAC1B,WAAW,CAAgB;IAE5C,YAAmB,UAA2C,EAAE,GAAmB,EAAE,UAAyB,EAAE,WAA0B;QACxI,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1E,OAAO,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,KAAiB;QACvC,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACzF,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,MAAqB,EAAE,OAAmB;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;YAC3B,MAAM,IAAI,gCAAgC,EAAE,CAAC;QAC/C,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAmB,CAAC;gBACzC,MAAM,KAAK,CAAC;YACd,MAAM,IAAI,sCAAsC,CAAC,KAAK,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;YACvC,MAAM,IAAI,2BAA2B,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { ArgumentNullException } from "@noldova/context.exceptions";
|
|
10
|
+
import { JsonException } from "@noldova/context.json";
|
|
11
|
+
import { SecretAction, SecretAnswered, SecretCommand, SecretFailureKind, ShellMethods } from "@noldova/desktop.protocol";
|
|
12
|
+
import { CaughtFailure } from "../models/caught-failure.js";
|
|
13
|
+
import { Resources } from "../resources.js";
|
|
14
|
+
export class SecretAnswerer {
|
|
15
|
+
storage;
|
|
16
|
+
platform;
|
|
17
|
+
readDeviceAsync;
|
|
18
|
+
runtime;
|
|
19
|
+
log;
|
|
20
|
+
constructor(storage, platform, readDeviceAsync, runtime, log) {
|
|
21
|
+
this.storage = storage;
|
|
22
|
+
this.platform = platform;
|
|
23
|
+
this.readDeviceAsync = readDeviceAsync;
|
|
24
|
+
this.runtime = runtime;
|
|
25
|
+
this.log = log;
|
|
26
|
+
}
|
|
27
|
+
async answerAsync(payload) {
|
|
28
|
+
let command;
|
|
29
|
+
try {
|
|
30
|
+
command = SecretCommand.fromJson(payload);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
this.log(Resources.formatSecretCommandInvalid(CaughtFailure.expect(error, JsonException).message));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const answer = await this.answerOfAsync(command);
|
|
37
|
+
await this.runtime.callAsync(ShellMethods.secretAnswered, answer.toJson());
|
|
38
|
+
}
|
|
39
|
+
async answerOfAsync(command) {
|
|
40
|
+
if (command.action === SecretAction.Device) {
|
|
41
|
+
const device = await this.readDeviceAsync();
|
|
42
|
+
return Object.isNull(device) ? new SecretAnswered(command.call, null, SecretFailureKind.NoDevice) : new SecretAnswered(command.call, device);
|
|
43
|
+
}
|
|
44
|
+
if (!this.storage.isEncryptionAvailable() || (this.platform === Resources.linuxPlatform && Resources.unprotectedStorageBackends.includes(this.storage.getSelectedStorageBackend())))
|
|
45
|
+
return new SecretAnswered(command.call, null, SecretFailureKind.Unprotected);
|
|
46
|
+
const value = command.value;
|
|
47
|
+
ArgumentNullException.throwIfNull(value, Resources.secretValueParameter);
|
|
48
|
+
try {
|
|
49
|
+
return command.action === SecretAction.Encrypt ? new SecretAnswered(command.call, this.storage.encryptString(value).toString(Resources.base64Encoding))
|
|
50
|
+
: new SecretAnswered(command.call, this.storage.decryptString(Buffer.from(value, Resources.base64Encoding)));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return new SecretAnswered(command.call, null, command.action === SecretAction.Encrypt ? SecretFailureKind.Unprotected : SecretFailureKind.Undecryptable);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=secret-answerer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-answerer.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/secret-answerer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAkB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,cAAc;IACR,OAAO,CAAqB;IAC5B,QAAQ,CAAS;IACjB,eAAe,CAA+B;IAC9C,OAAO,CAAgB;IACvB,GAAG,CAAyB;IAE7C,YAAmB,OAA2B,EAAE,QAAgB,EAAE,eAA6C,EAAE,OAAsB,EAAE,GAA2B;QAClK,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,OAAkB;QACzC,IAAI,OAAsB,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD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ACH,OAAO,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;gBACrJ,CAAC,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACjH,CAAC;QACD,MAAM,CAAC;YACL,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC3J,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { ArgumentException } from "@noldova/context.exceptions";
|
|
10
|
+
import { Resources } from "../resources.js";
|
|
11
|
+
export class SenderPolicy {
|
|
12
|
+
windowUrl;
|
|
13
|
+
constructor(windowUrl) {
|
|
14
|
+
ArgumentException.throwIfNullOrWhitespace(windowUrl, Resources.windowUrlParameter);
|
|
15
|
+
this.windowUrl = windowUrl;
|
|
16
|
+
}
|
|
17
|
+
isTrusted(sender) {
|
|
18
|
+
return sender.isTopLevel && this.isWindowUrl(sender.frameUrl);
|
|
19
|
+
}
|
|
20
|
+
isWindowUrl(url) {
|
|
21
|
+
return url === this.windowUrl || url.startsWith(`${this.windowUrl}${Resources.hashPrefix}`) || url.startsWith(`${this.windowUrl}${Resources.queryPrefix}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sender-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender-policy.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/sender-policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,YAAY;IACN,SAAS,CAAS;IAEnC,YAAmB,SAAiB;QAClC,iBAAiB,CAAC,uBAAuB,CAAC,SAAS,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAEnF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEM,SAAS,CAAC,MAAkB;QACjC,OAAO,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;IAEM,WAAW,CAAC,GAAW;QAC5B,OAAO,GAAG,KAAK,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7J,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { constants } from "node:fs";
|
|
9
|
+
import { open } from "node:fs/promises";
|
|
10
|
+
import "@noldova/context.core";
|
|
11
|
+
import { FileGrant } from "@noldova/desktop.protocol";
|
|
12
|
+
import { FileIdentity } from "@noldova/desktop.runtime";
|
|
13
|
+
import { ErrorCode } from "../models/error-code.js";
|
|
14
|
+
import { Resources } from "../resources.js";
|
|
15
|
+
export class SharedFileServer {
|
|
16
|
+
static scheme = { scheme: Resources.sharedFileScheme, privileges: { standard: true, secure: true } };
|
|
17
|
+
static OPEN_FLAGS = constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW;
|
|
18
|
+
resolveAsync;
|
|
19
|
+
isLive;
|
|
20
|
+
log;
|
|
21
|
+
constructor(resolveAsync, isLive, log) {
|
|
22
|
+
this.resolveAsync = resolveAsync;
|
|
23
|
+
this.isLive = isLive;
|
|
24
|
+
this.log = log;
|
|
25
|
+
}
|
|
26
|
+
serveOn(session) {
|
|
27
|
+
if (!session.protocol.isProtocolHandled(Resources.sharedFileScheme))
|
|
28
|
+
session.protocol.handle(Resources.sharedFileScheme, t => this.serveAsync(t));
|
|
29
|
+
}
|
|
30
|
+
async serveAsync(request) {
|
|
31
|
+
const grant = new URL(request.url).host;
|
|
32
|
+
if (request.method !== Resources.getMethod || !Resources.sharedFileHostPattern.test(grant) || request.url !== Resources.formatSharedFileAddress(grant))
|
|
33
|
+
return this.refuse(Resources.sharedFileAddressRefused);
|
|
34
|
+
const answer = await this.resolveAsync(grant);
|
|
35
|
+
if (!Object.isUndefined(answer.failure))
|
|
36
|
+
return this.refuse(answer.failure.code);
|
|
37
|
+
const file = FileGrant.fromJson(answer.payload);
|
|
38
|
+
if (!this.isLive(file.window, file.page))
|
|
39
|
+
return this.refuse(Resources.sharedFilePageEnded);
|
|
40
|
+
const handle = await open(file.path, SharedFileServer.OPEN_FLAGS).catch((error) => ErrorCode.of(error) ?? String(error));
|
|
41
|
+
if (Object.isString(handle))
|
|
42
|
+
return this.refuse(handle);
|
|
43
|
+
const stats = await handle.stat({ bigint: true });
|
|
44
|
+
if (FileIdentity.of(stats) !== file.identity) {
|
|
45
|
+
await handle.close();
|
|
46
|
+
return this.refuse(Resources.sharedFileChanged);
|
|
47
|
+
}
|
|
48
|
+
const mediaType = Resources.sharedImageTypes.includes(file.mediaType) ? file.mediaType : Resources.unknownMediaType;
|
|
49
|
+
return new Response(SharedFileServer.streamOf(handle), { headers: { ...Resources.sharedFileHeaders, [Resources.contentTypeHeader]: mediaType, [Resources.contentLengthHeader]: String(stats.size) } });
|
|
50
|
+
}
|
|
51
|
+
static streamOf(handle) {
|
|
52
|
+
const chunks = handle.createReadStream()[Symbol.asyncIterator]();
|
|
53
|
+
return new ReadableStream({
|
|
54
|
+
pull: async (controller) => {
|
|
55
|
+
const next = await chunks.next();
|
|
56
|
+
if (next.done === true)
|
|
57
|
+
controller.close();
|
|
58
|
+
else
|
|
59
|
+
controller.enqueue(new Uint8Array(next.value));
|
|
60
|
+
},
|
|
61
|
+
cancel: async () => {
|
|
62
|
+
await chunks.return?.();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
refuse(reason) {
|
|
67
|
+
this.log(Resources.formatSharedFileRefused(reason));
|
|
68
|
+
return new Response(null, { status: Resources.notFoundStatus, headers: Resources.sharedFileHeaders });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=shared-file-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-file-server.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/shared-file-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAmB,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAkC,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,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,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { mkdir } from "node:fs/promises";
|
|
9
|
+
import "@noldova/context.core";
|
|
10
|
+
import { LinkPolicy } from "@noldova/desktop.protocol";
|
|
11
|
+
import { Resources } from "../resources.js";
|
|
12
|
+
import { OpenedFilePolicy } from "./opened-file-policy.js";
|
|
13
|
+
import { ShownFilePolicy } from "./shown-file-policy.js";
|
|
14
|
+
export class ShellOpener {
|
|
15
|
+
shell;
|
|
16
|
+
platform;
|
|
17
|
+
files;
|
|
18
|
+
logsFolder;
|
|
19
|
+
log;
|
|
20
|
+
constructor(shell, platform, files, logsFolder, log) {
|
|
21
|
+
this.shell = shell;
|
|
22
|
+
this.platform = platform;
|
|
23
|
+
this.files = files;
|
|
24
|
+
this.logsFolder = logsFolder;
|
|
25
|
+
this.log = log;
|
|
26
|
+
}
|
|
27
|
+
async openLogFolderAsync() {
|
|
28
|
+
try {
|
|
29
|
+
await mkdir(this.logsFolder, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this.log(Resources.formatLogFolderNotOpened(String(error)));
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const failure = await this.shell.openPath(this.logsFolder);
|
|
36
|
+
if (failure.length > 0)
|
|
37
|
+
this.log(Resources.formatLogFolderNotOpened(failure));
|
|
38
|
+
return failure.length === 0;
|
|
39
|
+
}
|
|
40
|
+
async openLinkAsync(open, url) {
|
|
41
|
+
if (Object.isNull(open))
|
|
42
|
+
return false;
|
|
43
|
+
const link = LinkPolicy.findAllowed(url);
|
|
44
|
+
if (Object.isNull(link)) {
|
|
45
|
+
this.log(Resources.linkRefused);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
await this.shell.openExternal(link);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.log(Resources.formatLinkNotOpened(String(error)));
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async showInFolderAsync(open, file) {
|
|
58
|
+
if (Object.isNull(open))
|
|
59
|
+
return this.refuseShow(Resources.shownFileUntrusted);
|
|
60
|
+
if (!Object.isString(file))
|
|
61
|
+
return this.refuseShow(Resources.shownFileNotText);
|
|
62
|
+
const checked = await ShownFilePolicy.checkAsync(file, this.platform, this.files);
|
|
63
|
+
if (!Object.isNull(checked.refusal))
|
|
64
|
+
return this.refuseShow(checked.refusal);
|
|
65
|
+
this.shell.showItemInFolder(checked.path);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
async openFileAsync(open, file) {
|
|
69
|
+
if (Object.isNull(open))
|
|
70
|
+
return this.refuseOpen(Resources.shownFileUntrusted);
|
|
71
|
+
if (!Object.isString(file))
|
|
72
|
+
return this.refuseOpen(Resources.shownFileNotText);
|
|
73
|
+
const checked = await OpenedFilePolicy.checkAsync(file, this.platform, this.files);
|
|
74
|
+
if (!Object.isNull(checked.refusal))
|
|
75
|
+
return this.refuseOpen(checked.refusal);
|
|
76
|
+
const failure = await this.shell.openPath(checked.path);
|
|
77
|
+
return failure.length === 0 ? null : this.refuseOpen(Resources.openedFileFailed);
|
|
78
|
+
}
|
|
79
|
+
refuseShow(reason) {
|
|
80
|
+
this.log(Resources.formatFileNotShown(reason));
|
|
81
|
+
return reason;
|
|
82
|
+
}
|
|
83
|
+
refuseOpen(reason) {
|
|
84
|
+
this.log(Resources.formatFileNotOpened(reason));
|
|
85
|
+
return reason;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=shell-opener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-opener.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src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AAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { ShipItNotRemovedException } from "../exceptions/ship-it-not-removed.exception.js";
|
|
10
|
+
import { ShipItUnreadableException } from "../exceptions/ship-it-unreadable.exception.js";
|
|
11
|
+
import { Resources } from "../resources.js";
|
|
12
|
+
export class ShipItProcess {
|
|
13
|
+
label;
|
|
14
|
+
command;
|
|
15
|
+
constructor(bundleIdentifier, command) {
|
|
16
|
+
this.label = Resources.formatShipItLabel(bundleIdentifier);
|
|
17
|
+
this.command = command;
|
|
18
|
+
}
|
|
19
|
+
async findAsync() {
|
|
20
|
+
return ShipItProcess.processOf(await this.readAsync());
|
|
21
|
+
}
|
|
22
|
+
async removeAsync() {
|
|
23
|
+
if (!Object.isUndefined(await this.readAsync()))
|
|
24
|
+
await this.unloadAsync();
|
|
25
|
+
}
|
|
26
|
+
async removeStoppedAsync() {
|
|
27
|
+
const job = await this.readAsync();
|
|
28
|
+
if (!Object.isUndefined(job) && Object.isNull(ShipItProcess.processOf(job)))
|
|
29
|
+
await this.unloadAsync();
|
|
30
|
+
}
|
|
31
|
+
static processOf(job) {
|
|
32
|
+
const processId = Number(job?.[Resources.launchListProcessColumn]);
|
|
33
|
+
return Number.isSafeInteger(processId) && processId > 0 ? processId : null;
|
|
34
|
+
}
|
|
35
|
+
async unloadAsync() {
|
|
36
|
+
try {
|
|
37
|
+
await this.command.runAsync(Resources.launchControl, [Resources.launchControlRemove, this.label]);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new ShipItNotRemovedException(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async readAsync() {
|
|
44
|
+
let output;
|
|
45
|
+
try {
|
|
46
|
+
output = await this.command.runAsync(Resources.launchControl, [Resources.launchControlList]);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
throw new ShipItUnreadableException(error);
|
|
50
|
+
}
|
|
51
|
+
return output.split(Resources.lineBreak).map(t => t.split(Resources.launchListSeparator)).find(t => t[Resources.launchListLabelColumn] === this.label);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ship-it-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-it-process.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/ship-it-process.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,aAAa;IACP,KAAK,CAAS;IACd,OAAO,CAAkC;IAE1D,YAAmB,gBAAwB,EAAE,OAAwC;QACnF,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,OAAO,aAAa,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACzD,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CA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