feat: Add DISABLE_AUTO_UPDATES env variable for disabling updates in the application entirely (#1446)

This commit is contained in:
BatteredBunny
2025-12-28 10:50:55 +02:00
committed by GitHub
parent e821397e6c
commit 63015195b0
4 changed files with 16 additions and 5 deletions
@@ -10,6 +10,11 @@ import { Select } from '/@/shared/components/select/select';
import { Switch } from '/@/shared/components/switch/switch';
const localSettings = isElectron() ? window.api.localSettings : null;
const utils = isElectron() ? window.api.utils : null;
function disableAutoUpdates(): boolean {
return !isElectron() || utils?.disableAutoUpdates();
}
export const UpdateSettings = () => {
const { t } = useTranslation();
@@ -55,7 +60,7 @@ export const UpdateSettings = () => {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
isHidden: disableAutoUpdates(),
title: t('setting.releaseChannel', { postProcess: 'sentenceCase' }),
},
{
@@ -63,7 +68,7 @@ export const UpdateSettings = () => {
<Switch
aria-label="Disable automatic updates"
defaultChecked={settings.disableAutoUpdate}
disabled={!isElectron()}
disabled={disableAutoUpdates()}
onChange={(e) => {
if (!e) return;
localSettings?.set('disable_auto_updates', e.currentTarget.checked);
@@ -80,7 +85,7 @@ export const UpdateSettings = () => {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
isHidden: disableAutoUpdates(),
title: t('setting.disableAutomaticUpdates', { postProcess: 'sentenceCase' }),
},
];