feat: autoupdate toggle

This commit is contained in:
2025-04-04 19:41:38 +00:00
parent 8c3f9762a4
commit ca871f069f
8 changed files with 107 additions and 33 deletions

View File

@ -48,7 +48,10 @@ const aimeCodePaste = (ev: ClipboardEvent) => {
<template>
<OptionCategory title="Aime">
<OptionRow title="Aime emulation">
<OptionRow
title="Aime emulation"
tooltip="Aime plugins can be downloaded from the package store."
>
<Select
v-model="prf.current!.data.sgt.aime"
:options="[

View File

@ -13,7 +13,10 @@ const prf = usePrfStore();
<OptionRow title="OpenSSL bug workaround for Intel ≥10th gen">
<ToggleSwitch v-model="prf.current!.data.sgt.intel" />
</OptionRow>
<OptionRow title="More segatools options">
<OptionRow
title="More segatools options"
tooltip="Advanced options not covered by STARTLINER"
>
<FileEditor filename="segatools-base.ini" />
</OptionRow>
</OptionCategory>

View File

@ -79,7 +79,10 @@ const names = computed(() => {
"
></FilePicker>
</OptionRow>
<OptionRow :title="names.hook">
<OptionRow
:title="names.hook"
tooltip="Hooks can be downloaded from the package store."
>
<Select
v-model="prf.current!.data.sgt.hook"
:options="
@ -97,7 +100,11 @@ const names = computed(() => {
option-value="value"
></Select>
</OptionRow>
<OptionRow :title="names.io" v-if="prf.current?.meta.game === 'ongeki'">
<OptionRow
:title="names.io"
v-if="prf.current?.meta.game === 'ongeki'"
tooltip="IO plugins can be downloaded from the package store."
>
<Select
v-model="prf.current!.data.sgt.io"
placeholder="segatools built-in"

View File

@ -16,10 +16,19 @@ const offlineModel = computed({
await client.setOfflineMode(value);
},
});
const updatesModel = computed({
get() {
return client.enableAutoupdates;
},
async set(value: boolean) {
await client.setAutoupdates(value);
},
});
</script>
<template>
<OptionCategory title="Startliner">
<OptionCategory title="STARTLINER">
<OptionRow title="UI scaling">
<SelectButton
v-model="client.scaleModel"
@ -34,8 +43,14 @@ const offlineModel = computed({
option-value="value"
/>
</OptionRow>
<OptionRow title="Offline mode" tooltip="Applies after a restart">
<OptionRow
title="Offline mode"
tooltip="Disables the package store. Applies after a restart"
>
<ToggleSwitch v-model="offlineModel" />
</OptionRow>
<OptionRow title="Enable automatic updates">
<ToggleSwitch v-model="updatesModel" />
</OptionRow>
</OptionCategory>
</template>

View File

@ -336,7 +336,9 @@ export const useClientStore = defineStore('client', () => {
type ScaleType = 's' | 'm' | 'l' | 'xl';
const scaleFactor: Ref<ScaleType> = ref('s');
const timeout: Ref<NodeJS.Timeout | null> = ref(null);
const offlineMode = ref(true);
const offlineMode = ref(false);
const enableAutoupdates = ref(true);
const scaleValue = (value: ScaleType) =>
value === 's' ? 1 : value === 'm' ? 1.25 : value === 'l' ? 1.5 : 2;
@ -387,11 +389,17 @@ export const useClientStore = defineStore('client', () => {
if (input.scaleFactor) {
await setScaleFactor(input.scaleFactor);
}
offlineMode.value = await invoke('is_offline');
} catch (e) {
console.error(`Error reading client options: ${e}`);
}
offlineMode.value = await invoke('get_global_config', {
field: 'OfflineMode',
});
enableAutoupdates.value = await invoke('get_global_config', {
field: 'EnableAutoupdates',
});
};
const save = async () => {
@ -423,7 +431,15 @@ export const useClientStore = defineStore('client', () => {
const setOfflineMode = async (value: boolean) => {
offlineMode.value = value;
await invoke('set_offline', { value });
await invoke('set_global_config', { field: 'OfflineMode', value });
};
const setAutoupdates = async (value: boolean) => {
enableAutoupdates.value = value;
await invoke('set_global_config', {
field: 'EnableAutoupdates',
value,
});
};
getCurrentWindow().onResized(async ({ payload }) => {
@ -436,11 +452,13 @@ export const useClientStore = defineStore('client', () => {
return {
scaleFactor,
offlineMode,
enableAutoupdates,
timeout,
scaleModel,
load,
save,
queueSave,
setOfflineMode,
setAutoupdates,
};
});