diff --git a/launcher/src/background.js b/launcher/src/background.js index fe609de51..e233756ff 100755 --- a/launcher/src/background.js +++ b/launcher/src/background.js @@ -1034,7 +1034,31 @@ app.on("ready", async () => { Menu.setApplicationMenu(menu); // Check for updates in production - stereumUpdater.checkForUpdates(); + const storedConfig = await storageService.readConfig(); + if (!storedConfig.lastUpdateCheck) { + try { + const conf = { + ...storedConfig, + lastUpdateCheck: { value: Date.now() }, + }; + await storageService.writeConfig(conf); + } catch (error) { + console.error("Failed to update settings:", error); + } + } + + if (storedConfig.lastUpdateCheck + storedConfig.updateTimer * 86400000 + storedConfig.updateTimerTime * 3600000 <= Date.now()) { + try { + const conf = { + ...storedConfig, + lastUpdateCheck: { value: Date.now() }, + }; + await storageService.writeConfig(conf); + } catch (error) { + console.error("Failed to update settings:", error); + } + stereumUpdater.checkForUpdates(); + } } await createWindow(); diff --git a/launcher/src/components/UI/setting-page/SettingScreen.vue b/launcher/src/components/UI/setting-page/SettingScreen.vue index c446088e4..deb6c7ae1 100644 --- a/launcher/src/components/UI/setting-page/SettingScreen.vue +++ b/launcher/src/components/UI/setting-page/SettingScreen.vue @@ -37,6 +37,8 @@ import CreditButtons from "./section/CreditButtons.vue"; import IdleTimer from "./components/IdleTimer.vue"; import LogBackups from "./components/LogBackups.vue"; import IdleTimerTime from "./components/IdleTimerTime.vue"; +import UpdateTimer from "./components/UpdateTimer.vue"; +import UpdateTimerTime from "./components/UpdateTimerTime.vue"; import { ref, computed, onMounted } from "vue"; import CreditBtn from "./components/CreditBtn.vue"; import { useRouter } from "vue-router"; @@ -107,6 +109,8 @@ const itemConfigurations = computed(() => { { title: "Idle Timeout", component: IdleTimer }, { title: "Idle Timeout Time (in minutes)", component: IdleTimerTime }, { title: "Stereum Log Backups", component: LogBackups }, + { title: "Auto Update Interval (in days)", component: UpdateTimer }, + { title: "Auto Update Time", component: UpdateTimerTime }, ]; } else if (mainBox.value === "audio") { items = [ diff --git a/launcher/src/components/UI/setting-page/components/UpdateTimer.vue b/launcher/src/components/UI/setting-page/components/UpdateTimer.vue new file mode 100644 index 000000000..5a22aa473 --- /dev/null +++ b/launcher/src/components/UI/setting-page/components/UpdateTimer.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/launcher/src/components/UI/setting-page/components/UpdateTimerTime.vue b/launcher/src/components/UI/setting-page/components/UpdateTimerTime.vue new file mode 100644 index 000000000..629133b29 --- /dev/null +++ b/launcher/src/components/UI/setting-page/components/UpdateTimerTime.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/launcher/src/store/theFooter.js b/launcher/src/store/theFooter.js index 1aba25d02..51fbef8ad 100644 --- a/launcher/src/store/theFooter.js +++ b/launcher/src/store/theFooter.js @@ -23,6 +23,8 @@ export const useFooter = defineStore("theFooter", { idleTimer: false, idleTimerTime: 5, logBackups: 3, + updateTimer: 7, + updateTimerTime: 12, }; }, getters: {},