mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
add searchTableSize limit
This commit is contained in:
+45
-4
@@ -5,6 +5,14 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import Noty from 'noty';
|
||||
|
||||
import {
|
||||
DEFAULT_MAX_TABLE_SIZE,
|
||||
DEFAULT_SEARCH_LIMIT,
|
||||
LEGACY_MAX_TABLE_SIZE_DEFAULT,
|
||||
SEARCH_LIMIT_MAX,
|
||||
SEARCH_LIMIT_MIN,
|
||||
TABLE_MAX_SIZE_MAX
|
||||
} from '../shared/constants';
|
||||
import {
|
||||
clearPiniaActionTrail,
|
||||
getPiniaActionTrail
|
||||
@@ -74,7 +82,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
const isRegistryBackupDialogVisible = ref(false);
|
||||
const ipcEnabled = ref(false);
|
||||
const clearVRCXCacheFrequency = ref(172800);
|
||||
const maxTableSize = ref(1000);
|
||||
const maxTableSize = ref(DEFAULT_MAX_TABLE_SIZE);
|
||||
const searchLimit = ref(DEFAULT_SEARCH_LIMIT);
|
||||
const proxyServer = ref('');
|
||||
|
||||
async function init() {
|
||||
@@ -148,13 +157,44 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
|
||||
maxTableSize.value = await configRepository.getInt(
|
||||
'VRCX_maxTableSize',
|
||||
1000
|
||||
LEGACY_MAX_TABLE_SIZE_DEFAULT
|
||||
);
|
||||
if (maxTableSize.value > 10000) {
|
||||
maxTableSize.value = 1000;
|
||||
if (maxTableSize.value > TABLE_MAX_SIZE_MAX) {
|
||||
maxTableSize.value = TABLE_MAX_SIZE_MAX;
|
||||
}
|
||||
const maxTableSizeMigrated = await configRepository.getBool(
|
||||
'VRCX_maxTableSizeMigrated500',
|
||||
false
|
||||
);
|
||||
// Migrate old default table size (1000) to new default (500)
|
||||
if (
|
||||
maxTableSize.value === LEGACY_MAX_TABLE_SIZE_DEFAULT &&
|
||||
!maxTableSizeMigrated
|
||||
) {
|
||||
maxTableSize.value = DEFAULT_MAX_TABLE_SIZE;
|
||||
await configRepository.setInt(
|
||||
'VRCX_maxTableSize',
|
||||
maxTableSize.value
|
||||
);
|
||||
await configRepository.setBool(
|
||||
'VRCX_maxTableSizeMigrated500',
|
||||
true
|
||||
);
|
||||
}
|
||||
database.setMaxTableSize(maxTableSize.value);
|
||||
|
||||
searchLimit.value = await configRepository.getInt(
|
||||
'VRCX_searchLimit',
|
||||
DEFAULT_SEARCH_LIMIT
|
||||
);
|
||||
if (searchLimit.value < SEARCH_LIMIT_MIN) {
|
||||
searchLimit.value = SEARCH_LIMIT_MIN;
|
||||
}
|
||||
if (searchLimit.value > SEARCH_LIMIT_MAX) {
|
||||
searchLimit.value = SEARCH_LIMIT_MAX;
|
||||
}
|
||||
database.setSearchTableSize(searchLimit.value);
|
||||
|
||||
refreshCustomScript();
|
||||
}
|
||||
|
||||
@@ -787,6 +827,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
ipcEnabled,
|
||||
clearVRCXCacheFrequency,
|
||||
maxTableSize,
|
||||
searchLimit,
|
||||
clearVRCXCache,
|
||||
eventVrcxMessage,
|
||||
eventLaunchCommand,
|
||||
|
||||
Reference in New Issue
Block a user