Files
kopia/app/public/auto-launch.js
dependabot[bot] 6235ba5c6b build(deps): bump the kopia-ui-npm-dependencies group across 1 directory with 9 updates + upgraded 'app' to ESM modules (#3978)
* build(deps): bump the kopia-ui-npm-dependencies group across 1 directory with 9 updates

Bumps the kopia-ui-npm-dependencies group with 7 updates in the /app directory:

| Package | From | To |
| --- | --- | --- |
| [electron-log](https://github.com/megahertz/electron-log) | `5.1.2` | `5.1.5` |
| [electron-store](https://github.com/sindresorhus/electron-store) | `8.2.0` | `10.0.0` |
| [electron-updater](https://github.com/electron-userland/electron-builder/tree/HEAD/packages/electron-updater) | `6.3.0-alpha.6` | `6.3.0-alpha.7` |
| [uuid](https://github.com/uuidjs/uuid) | `9.0.1` | `10.0.0` |
| [@electron/notarize](https://github.com/electron/notarize) | `2.3.0` | `2.3.2` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.42.1` | `1.45.1` |
| [electron](https://github.com/electron/electron) | `29.1.6` | `31.2.0` |



Updates `electron-log` from 5.1.2 to 5.1.5
- [Changelog](https://github.com/megahertz/electron-log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/megahertz/electron-log/compare/v5.1.2...v5.1.5)

Updates `electron-store` from 8.2.0 to 10.0.0
- [Release notes](https://github.com/sindresorhus/electron-store/releases)
- [Commits](https://github.com/sindresorhus/electron-store/compare/v8.2.0...v10.0.0)

Updates `electron-updater` from 6.3.0-alpha.6 to 6.3.0-alpha.7
- [Release notes](https://github.com/electron-userland/electron-builder/releases)
- [Changelog](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/CHANGELOG.md)
- [Commits](https://github.com/electron-userland/electron-builder/commits/electron-updater@6.3.0-alpha.7/packages/electron-updater)

Updates `uuid` from 9.0.1 to 10.0.0
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.1...v10.0.0)

Updates `@electron/notarize` from 2.3.0 to 2.3.2
- [Release notes](https://github.com/electron/notarize/releases)
- [Changelog](https://github.com/electron/notarize/blob/main/.releaserc.json)
- [Commits](https://github.com/electron/notarize/compare/v2.3.0...v2.3.2)

Updates `@playwright/test` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

Updates `electron` from 29.1.6 to 31.2.0
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v29.1.6...v31.2.0)

Updates `playwright` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

Updates `playwright-core` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

---
updated-dependencies:
- dependency-name: electron-log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron-store
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron-updater
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: "@electron/notarize"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: playwright
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: playwright-core
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* upgraded app to ES modules

* renamed notarize.js and sign.js to CommonJS

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
2024-07-13 02:31:41 +00:00

42 lines
1.2 KiB
JavaScript

import { ipcMain } from 'electron';
import log from "electron-log";
import AutoLaunch from 'auto-launch';
const autoLauncher = new AutoLaunch({
name: 'Kopia',
mac: {
useLaunchAgent: true,
},
});
let enabled = false;
export function willLaunchAtStartup() {
return enabled;
}
export function toggleLaunchAtStartup() {
if (enabled) {
log.info('disabling autorun');
autoLauncher.disable()
.then(() => { enabled = false; ipcMain.emit('launch-at-startup-updated'); })
.catch((err) => log.info(err));
} else {
log.info('enabling autorun');
autoLauncher.enable()
.then(() => { enabled = true; ipcMain.emit('launch-at-startup-updated'); })
.catch((err) => log.info(err));
}
}
export function refreshWillLaunchAtStartup() {
autoLauncher.isEnabled()
.then((isEnabled) => {
enabled = isEnabled;
ipcMain.emit('launch-at-startup-updated');
})
.catch(function (err) {
log.info('unable to get autoLauncher state', err);
});
}