diff --git a/html/src/app.js b/html/src/app.js index 3ad2b846..7daf6a45 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -7463,6 +7463,7 @@ speechSynthesis.getVoices(); } else { API.currentUser.$online_for = ''; API.currentUser.$offline_for = Date.now(); + this.autoVRChatCacheManagement(); } }; $app.watch.isGameRunning = isGameRunningStateChange; @@ -11481,7 +11482,8 @@ speechSynthesis.getVoices(); }; $app.methods.checkVRChatCache = async function (ref) { - return await AssetBundleCacher.CheckVRChatCache(ref.id, ref.version, await this.getVRChatCacheDir()); + var cacheDir = await this.getVRChatCacheDir(); + return await AssetBundleCacher.CheckVRChatCache(ref.id, ref.version, cacheDir); }; $app.methods.queueCacheDownload = function (ref, type) { @@ -11812,12 +11814,8 @@ speechSynthesis.getVoices(); }; $app.methods.deleteVRChatCache = async function (ref) { - await this.readVRChatConfigFile(); - var cacheDirectory = ''; - if (this.VRChatConfigFile.cache_directory) { - cacheDirectory = this.VRChatConfigFile.cache_directory; - } - await AssetBundleCacher.DeleteCache(cacheDirectory, ref.id, ref.version); + var cacheDir = await this.getVRChatCacheDir(); + await AssetBundleCacher.DeleteCache(cacheDir, ref.id, ref.version); this.getVRChatCacheSize(); this.updateVRChatCache(); }; @@ -11836,22 +11834,20 @@ speechSynthesis.getVoices(); }; $app.methods.deleteAllVRChatCache = async function () { - await this.readVRChatConfigFile(); - var cacheDirectory = ''; - if (this.VRChatConfigFile.cache_directory) { - cacheDirectory = this.VRChatConfigFile.cache_directory; - } - await AssetBundleCacher.DeleteAllCache(cacheDirectory); + var cacheDir = await this.getVRChatCacheDir(); + await AssetBundleCacher.DeleteAllCache(cacheDir); this.getVRChatCacheSize(); }; - $app.methods.sweepVRChatCache = async function () { - await this.readVRChatConfigFile(); - var cacheDirectory = ''; - if (this.VRChatConfigFile.cache_directory) { - cacheDirectory = this.VRChatConfigFile.cache_directory; + $app.methods.autoVRChatCacheManagement = function () { + if (this.autoSweepVRChatCache) { + this.sweepVRChatCache(); } - await AssetBundleCacher.SweepCache(cacheDirectory); + }; + + $app.methods.sweepVRChatCache = async function () { + var cacheDir = await this.getVRChatCacheDir(); + await AssetBundleCacher.SweepCache(cacheDir); if (this.VRChatConfigDialog.visible) { this.getVRChatCacheSize(); } @@ -11863,17 +11859,13 @@ speechSynthesis.getVoices(); $app.methods.getVRChatCacheSize = async function () { this.VRChatCacheSizeLoading = true; - await this.readVRChatConfigFile(); - var cacheDirectory = ''; - if (this.VRChatConfigFile.cache_directory) { - cacheDirectory = this.VRChatConfigFile.cache_directory; - } + var cacheDir = await this.getVRChatCacheDir(); var totalCacheSize = 20; if (this.VRChatConfigFile.cache_size) { totalCacheSize = this.VRChatConfigFile.cache_size; } this.VRChatTotalCacheSize = totalCacheSize; - var usedCacheSize = await AssetBundleCacher.GetCacheSize(cacheDirectory); + var usedCacheSize = await AssetBundleCacher.GetCacheSize(cacheDir); this.VRChatUsedCacheSize = (usedCacheSize / 1073741824).toFixed(2); this.VRChatCacheSizeLoading = false; }; diff --git a/html/src/index.pug b/html/src/index.pug index 8534fda0..40f2e4d7 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -871,27 +871,29 @@ html el-dropdown-menu(#default="dropdown") el-dropdown-item(v-if="voice" v-for="(voice, index) in TTSvoices" :key="index" v-text="voice.name" :command="index") div.options-container - span.header Auto Cache Worlds + span.header VRChat Cache Management + br + span.sub-header Auto Cache Worlds + br div.options-container-item span.name Download on invite: br toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheInviteToggleSwitchOption" v-model="worldAutoCacheInvite" class="toggle-switch") div.options-container-item el-switch(v-model="worldAutoCacheInviteFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheInvite == 'Never'") - br div.options-container-item span.name Download on GPS: br toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheGPSToggleSwitchOption" v-model="worldAutoCacheGPS" class="toggle-switch") div.options-container-item el-switch(v-model="worldAutoCacheGPSFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheGPS == 'Never'") - br div.options-container-item el-button-group el-button(size="small" icon="el-icon-download" @click="showDownloadDialog()") Download History br + span.sub-header Automatically Manage Cache When Closing VRChat div.options-container-item - span.name(style="min-width:250px") Auto sweep cache when closing VRChat + span.name(style="min-width:300px") Auto delete old versions from cache el-switch(v-model="autoSweepVRChatCache") div.options-container span.header Application