feat: groundwork for multi-profile support

This commit is contained in:
2025-03-03 02:07:15 +01:00
parent d25841853c
commit 6410ca2721
16 changed files with 744 additions and 184 deletions

View File

@ -6,18 +6,17 @@ import InputText from 'primevue/inputtext';
import RadioButton from 'primevue/radiobutton';
import Toggle from 'primevue/toggleswitch';
import { invoke } from '@tauri-apps/api/core';
import * as path from '@tauri-apps/api/path';
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
import { usePkgStore } from '../stores';
import { usePrfStore } from '../stores';
const prf = usePrfStore();
const store = usePkgStore();
const _cfg = <T extends string | number | boolean>(key: string, dflt: T) =>
computed({
get() {
return (store.cfg(key) as T) ?? dflt;
return (prf.cfg(key) as T) ?? dflt;
},
async set(value) {
await store.set_cfg(key, value ?? dflt);
await prf.setCfg(key, value ?? dflt);
},
});
@ -126,7 +125,7 @@ const aimeCodeModel = computed({
<InputText
class="shrink"
size="small"
:disabled="store.cfg('aime') !== true"
:disabled="prf.cfg('aime') !== true"
:maxlength="20"
placeholder="00000000000000000000"
v-model="aimeCodeModel"