feat: etc

This commit is contained in:
2025-02-27 02:11:37 +01:00
parent 1586f81152
commit 947b384511
18 changed files with 263 additions and 146 deletions

View File

@ -1,10 +1,12 @@
<script setup lang="ts">
import { computed } from 'vue';
import { computed, ref } from 'vue';
import Fieldset from 'primevue/fieldset';
import InputNumber from 'primevue/inputnumber';
import InputText from 'primevue/inputtext';
import RadioButton from 'primevue/radiobutton';
import Toggle from 'primevue/toggleswitch';
import * as path from '@tauri-apps/api/path';
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
import { usePkgStore } from '../stores';
const store = usePkgStore();
@ -23,7 +25,32 @@ const cfgRezW = _cfg('rez-w', 1080);
const cfgRezH = _cfg('rez-h', 1920);
const cfgDisplayMode = _cfg('display-mode', 'borderless');
const cfgAime = _cfg('aime', false);
const cfgAimeCode = _cfg('aime-code', '');
const aimeCode = ref('');
// temp
let aimePath = '';
(async () => {
aimePath = await path.join(
await path.dataDir(),
'startliner/profile-ongeki-default/aime.txt'
);
aimeCode.value = await readTextFile(aimePath);
})();
path.homeDir().then(console.log);
const aimeCodeModel = computed({
get() {
return aimeCode.value;
},
async set(value: string) {
aimeCode.value = value;
if (value.match(/^[0-9]{20}$/)) {
await writeTextFile(aimePath, aimeCode.value);
}
},
});
</script>
<template>
@ -98,13 +125,9 @@ const cfgAimeCode = _cfg('aime-code', '');
class="shrink"
size="small"
:disabled="store.cfg('aime') !== true"
:invalid="
store.cfg('aime') === true &&
store.cfg('aime-code')?.toString().length !== 20
"
:maxlength="20"
placeholder="00000000000000000000"
v-model="cfgAimeCode"
v-model="aimeCodeModel"
/>
</label>
</div>