web: disable desktop update checker if auto updates off

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2026-02-04 16:35:40 +05:00
parent e381e54bb7
commit 38ddbbf684
4 changed files with 11 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ import { AppEventManager, AppEvents } from "../app-events";
import { TaskScheduler } from "../../utils/task-scheduler";
import { checkForUpdate } from "../../utils/updater";
import { showToast } from "../../utils/toast";
import { store as settingStore } from "../../stores/setting-store";
export const desktop = createTRPCProxyClient<AppRouter>({
links: [ipcLink()]
@@ -64,7 +65,7 @@ function attachListeners() {
);
TaskScheduler.register("updateCheck", "0 0 */12 * * * *", () => {
checkForUpdate();
checkForUpdate(settingStore.get().autoUpdates);
});
}

View File

@@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { useEffect } from "react";
import { checkForUpdate } from "../utils/updater";
import { AppEventManager, AppEvents } from "../common/app-events";
import BaseStore from "../stores";
import createStore from "../common/store";
import { store as settingStore } from "../stores/setting-store";
type CompletedUpdateStatus = { type: "completed"; version: string };
type DownloadingUpdateStatus = { type: "downloading"; progress: number };
@@ -104,7 +104,7 @@ export function useAutoUpdater() {
);
checkingForUpdate();
checkForUpdate().catch(console.error);
checkForUpdate(settingStore.get().autoUpdates).catch(console.error);
return () => {
checkingForUpdateEvent.unsubscribe();

View File

@@ -87,7 +87,7 @@ class SettingStore extends BaseStore<SettingStore> {
ImageCompressionOptions.ASK_EVERY_TIME
);
desktopIntegrationSettings?: DesktopIntegration;
autoUpdates = true;
autoUpdates = false;
isFlatpak = false;
isSnap = false;
proxyRules?: string;

View File

@@ -21,9 +21,12 @@ import { AppEventManager, AppEvents } from "../common/app-events";
import { desktop } from "../common/desktop-bridge";
import { appVersion, getServiceWorkerVersion } from "./version";
export async function checkForUpdate() {
if (IS_DESKTOP_APP) await desktop?.updater.check.query().catch(console.error);
else {
export async function checkForUpdate(checkOnDesktop = true) {
if (IS_DESKTOP_APP && checkOnDesktop) {
await desktop?.updater.check.query().catch(console.error);
}
if (!IS_DESKTOP_APP) {
AppEventManager.publish(AppEvents.checkingForUpdate);
const registrations =