Auto clear VRCX cache

This commit is contained in:
Natsumi
2022-01-15 15:57:35 +13:00
parent 03fbec6a08
commit 70b34f6772
2 changed files with 53 additions and 0 deletions

View File

@@ -4039,6 +4039,8 @@ speechSynthesis.getVoices();
nextCurrentUserRefresh: 0,
nextFriendsRefresh: 0,
nextAppUpdateCheck: 0,
ipcTimeout: 0,
nextClearVRCXCacheCheck: 0,
isGameRunning: false,
isGameNoVR: false,
isSteamVRRunning: false,
@@ -4143,6 +4145,13 @@ speechSynthesis.getVoices();
if (--this.ipcTimeout <= 0) {
this.ipcEnabled = false;
}
if (
--this.nextClearVRCXCacheCheck <= 0 &&
this.clearVRCXCacheFrequency > 0
) {
this.nextClearVRCXCacheCheck = this.clearVRCXCacheFrequency;
this.clearVRCXCache();
}
AppApi.CheckGameRunning().then(
([isGameRunning, isGameNoVR, isSteamVRRunning]) => {
this.updateOpenVR(
@@ -10955,6 +10964,12 @@ speechSynthesis.getVoices();
$app.data.photonLobbyTimeoutThreshold = configRepository.getString(
'VRCX_photonLobbyTimeoutThreshold'
);
$app.data.clearVRCXCacheFrequency = configRepository.getString(
'VRCX_clearVRCXCacheFrequency'
);
$app.data.nextClearVRCXCacheCheck = configRepository.getString(
'VRCX_clearVRCXCacheFrequency'
);
$app.methods.saveOpenVROption = function () {
configRepository.setBool('openVR', this.openVR);
configRepository.setBool('openVRAlways', this.openVRAlways);
@@ -11243,6 +11258,13 @@ speechSynthesis.getVoices();
$app.data.photonLobbyTimeoutThreshold
);
}
if (!configRepository.getString('VRCX_clearVRCXCacheFrequency')) {
$app.data.clearVRCXCacheFrequency = 172800; // 24 hours
configRepository.setString(
'VRCX_clearVRCXCacheFrequency',
$app.data.clearVRCXCacheFrequency
);
}
if (!configRepository.getString('VRCX_TimeoutHudOverlayFilter')) {
$app.data.timeoutHudOverlayFilter = 'Everyone';
configRepository.setString(
@@ -12116,6 +12138,36 @@ speechSynthesis.getVoices();
);
};
$app.methods.promptAutoClearVRCXCacheFrequency = function () {
this.$prompt(
'Enter amount of hours (default: 24, disabled: 0)',
'Clear VRCX Cache Timer',
{
distinguishCancelAndClose: true,
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
inputValue: this.clearVRCXCacheFrequency / 3600 / 2,
inputPattern: /\d+$/,
inputErrorMessage: 'Valid number is required',
callback: (action, instance) => {
if (
action === 'confirm' &&
instance.inputValue &&
!isNaN(instance.inputValue)
) {
this.clearVRCXCacheFrequency = Math.trunc(
Number(instance.inputValue) * 3600 * 2
);
configRepository.setString(
'VRCX_clearVRCXCacheFrequency',
this.clearVRCXCacheFrequency
);
}
}
}
);
};
// App: Dialog
var adjustDialogZ = (el) => {

View File

@@ -1190,6 +1190,7 @@ html
span.name Avatar Name cache: #[span(v-text="API.cachedAvatarNames.size")]
div.options-container-item
el-button(size="small" icon="el-icon-delete-solid" @click="clearVRCXCache") Clear Cache
el-button(size="small" icon="el-icon-time" @click="promptAutoClearVRCXCacheFrequency") Auto Clear Cache
div.options-container-item
el-button(size="small" icon="el-icon-tickets" @click="showConsole") Show Console
div.options-container