diff --git a/package-lock.json b/package-lock.json index 28435be9..f8f1be1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "remark-gfm": "^2.0.0", "semver": "7.3.5", "simplebar-react": "^3.2.4", + "source-map": "^0.7.4", "styled-components": "^5.2.1", "tabler-icons-react": "~1.33.0", "tailwind-merge": "^2.2.1", @@ -192,6 +193,15 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/core/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@babel/generator": { "version": "7.13.9", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz", @@ -202,6 +212,14 @@ "source-map": "^0.5.0" } }, + "node_modules/@babel/generator/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@babel/helper-annotate-as-pure": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz", @@ -1504,15 +1522,6 @@ "postcss": "^8.4.6" } }, - "node_modules/@csstools/postcss-sass/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/@csstools/sass-import-resolve": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@csstools/sass-import-resolve/-/sass-import-resolve-1.0.0.tgz", @@ -14322,6 +14331,15 @@ "node": ">=0.12" } }, + "node_modules/postcss-atroot/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/postcss-atroot/node_modules/strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -16815,14 +16833,6 @@ "node": ">=4.0.0" } }, - "node_modules/react-hot-loader/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "engines": { - "node": ">= 8" - } - }, "node_modules/react-intersection-observer": { "version": "8.33.1", "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-8.33.1.tgz", @@ -18286,11 +18296,11 @@ "dev": true }, "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", "engines": { - "node": ">=0.10.0" + "node": ">= 8" } }, "node_modules/source-map-js": { @@ -19254,14 +19264,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, - "node_modules/terser/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "engines": { - "node": ">= 8" - } - }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -21041,6 +21043,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true } } }, @@ -21052,6 +21060,13 @@ "@babel/types": "^7.13.0", "jsesc": "^2.5.1", "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==" + } } }, "@babel/helper-annotate-as-pure": { @@ -22117,14 +22132,6 @@ "@csstools/sass-import-resolve": "^1.0.0", "sass": "^1.49.7", "source-map": "~0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - } } }, "@csstools/sass-import-resolve": { @@ -31680,6 +31687,12 @@ "supports-color": "^3.2.3" } }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -33538,11 +33551,6 @@ "emojis-list": "^3.0.0", "json5": "^1.0.1" } - }, - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" } } }, @@ -34727,9 +34735,9 @@ } }, "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==" }, "source-map-js": { "version": "1.0.2", @@ -35424,11 +35432,6 @@ "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" } } }, diff --git a/package.json b/package.json index 97653a0c..91729d34 100644 --- a/package.json +++ b/package.json @@ -145,6 +145,7 @@ "remark-gfm": "^2.0.0", "semver": "7.3.5", "simplebar-react": "^3.2.4", + "source-map": "^0.7.4", "styled-components": "^5.2.1", "tabler-icons-react": "~1.33.0", "tailwind-merge": "^2.2.1", diff --git a/src/common/settings.ts b/src/common/settings.ts index 8c11f7ca..defc2dbe 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -96,7 +96,8 @@ interface Settings { useDarkTheme: boolean; allowSeasonalEffects: boolean; msfsPackagePath: string; - configDownloadUrl: string; + configDownloadUrl: string, + useAutoUpdate: boolean; }; cache: { main: { @@ -260,4 +261,4 @@ const store = new Store({ schema, clearInvalidConfig: true }); // Workaround to flush the defaults store.set('metaInfo.lastLaunch', Date.now()); -export default store; +export default store; \ No newline at end of file diff --git a/src/renderer/components/AddonSection/index.tsx b/src/renderer/components/AddonSection/index.tsx index 8bacabd9..2c0ccd90 100644 --- a/src/renderer/components/AddonSection/index.tsx +++ b/src/renderer/components/AddonSection/index.tsx @@ -290,6 +290,13 @@ export const AddonSection = (): JSX.Element => { } }, [addonDiscovered, hiddenAddon]); + useEffect(() => { + const autoUpdateEnabled = settings.get("mainSettings.useAutoUpdate"); + if (autoUpdateEnabled && status === InstallStatus.NeedsUpdate) { + handleInstall(); + } + }, [status]); + const { showModal, showModalAsync } = useModals(); const handleTrackSelection = (track: AddonTrack) => { diff --git a/src/renderer/components/SettingsSection/Download.tsx b/src/renderer/components/SettingsSection/Download.tsx index c867067b..dee99af0 100644 --- a/src/renderer/components/SettingsSection/Download.tsx +++ b/src/renderer/components/SettingsSection/Download.tsx @@ -107,6 +107,20 @@ const UseCdnSettingItem = ({ value, setValue }: SettingItemProps) => { ); }; +const AutoUpdateSettingItem = ({ value, setValue }: SettingItemProps) => { + const handleClick = () => { + const newState = !value; + setValue(newState); + settings.set('mainSettings.useAutoUpdate', newState); + }; + + return ( + + + + ); +}; + export const DownloadSettings = (): JSX.Element => { const [communityPath, setCommunityPath] = useSetting('mainSettings.msfsCommunityPath'); const [installPath, setInstallPath] = useSetting('mainSettings.installPath'); @@ -116,6 +130,7 @@ export const DownloadSettings = (): JSX.Element => { 'mainSettings.disableExperimentalWarning', ); const [useCdnCache, setUseCdnCache] = useSetting('mainSettings.useCdnCache'); + const [useAutoUpdate, setUseAutoUpdate] = useSetting('mainSettings.useAutoUpdate'); return (
@@ -128,6 +143,7 @@ export const DownloadSettings = (): JSX.Element => { {separateTempLocation && } +