Auto cache management

This commit is contained in:
Natsumi
2021-05-29 03:41:52 +12:00
parent 34d4f8006f
commit 36281bb4ad
2 changed files with 23 additions and 29 deletions
+17 -25
View File
@@ -7463,6 +7463,7 @@ speechSynthesis.getVoices();
} else { } else {
API.currentUser.$online_for = ''; API.currentUser.$online_for = '';
API.currentUser.$offline_for = Date.now(); API.currentUser.$offline_for = Date.now();
this.autoVRChatCacheManagement();
} }
}; };
$app.watch.isGameRunning = isGameRunningStateChange; $app.watch.isGameRunning = isGameRunningStateChange;
@@ -11481,7 +11482,8 @@ speechSynthesis.getVoices();
}; };
$app.methods.checkVRChatCache = async function (ref) { $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) { $app.methods.queueCacheDownload = function (ref, type) {
@@ -11812,12 +11814,8 @@ speechSynthesis.getVoices();
}; };
$app.methods.deleteVRChatCache = async function (ref) { $app.methods.deleteVRChatCache = async function (ref) {
await this.readVRChatConfigFile(); var cacheDir = await this.getVRChatCacheDir();
var cacheDirectory = ''; await AssetBundleCacher.DeleteCache(cacheDir, ref.id, ref.version);
if (this.VRChatConfigFile.cache_directory) {
cacheDirectory = this.VRChatConfigFile.cache_directory;
}
await AssetBundleCacher.DeleteCache(cacheDirectory, ref.id, ref.version);
this.getVRChatCacheSize(); this.getVRChatCacheSize();
this.updateVRChatCache(); this.updateVRChatCache();
}; };
@@ -11836,22 +11834,20 @@ speechSynthesis.getVoices();
}; };
$app.methods.deleteAllVRChatCache = async function () { $app.methods.deleteAllVRChatCache = async function () {
await this.readVRChatConfigFile(); var cacheDir = await this.getVRChatCacheDir();
var cacheDirectory = ''; await AssetBundleCacher.DeleteAllCache(cacheDir);
if (this.VRChatConfigFile.cache_directory) {
cacheDirectory = this.VRChatConfigFile.cache_directory;
}
await AssetBundleCacher.DeleteAllCache(cacheDirectory);
this.getVRChatCacheSize(); this.getVRChatCacheSize();
}; };
$app.methods.sweepVRChatCache = async function () { $app.methods.autoVRChatCacheManagement = function () {
await this.readVRChatConfigFile(); if (this.autoSweepVRChatCache) {
var cacheDirectory = ''; this.sweepVRChatCache();
if (this.VRChatConfigFile.cache_directory) {
cacheDirectory = this.VRChatConfigFile.cache_directory;
} }
await AssetBundleCacher.SweepCache(cacheDirectory); };
$app.methods.sweepVRChatCache = async function () {
var cacheDir = await this.getVRChatCacheDir();
await AssetBundleCacher.SweepCache(cacheDir);
if (this.VRChatConfigDialog.visible) { if (this.VRChatConfigDialog.visible) {
this.getVRChatCacheSize(); this.getVRChatCacheSize();
} }
@@ -11863,17 +11859,13 @@ speechSynthesis.getVoices();
$app.methods.getVRChatCacheSize = async function () { $app.methods.getVRChatCacheSize = async function () {
this.VRChatCacheSizeLoading = true; this.VRChatCacheSizeLoading = true;
await this.readVRChatConfigFile(); var cacheDir = await this.getVRChatCacheDir();
var cacheDirectory = '';
if (this.VRChatConfigFile.cache_directory) {
cacheDirectory = this.VRChatConfigFile.cache_directory;
}
var totalCacheSize = 20; var totalCacheSize = 20;
if (this.VRChatConfigFile.cache_size) { if (this.VRChatConfigFile.cache_size) {
totalCacheSize = this.VRChatConfigFile.cache_size; totalCacheSize = this.VRChatConfigFile.cache_size;
} }
this.VRChatTotalCacheSize = totalCacheSize; this.VRChatTotalCacheSize = totalCacheSize;
var usedCacheSize = await AssetBundleCacher.GetCacheSize(cacheDirectory); var usedCacheSize = await AssetBundleCacher.GetCacheSize(cacheDir);
this.VRChatUsedCacheSize = (usedCacheSize / 1073741824).toFixed(2); this.VRChatUsedCacheSize = (usedCacheSize / 1073741824).toFixed(2);
this.VRChatCacheSizeLoading = false; this.VRChatCacheSizeLoading = false;
}; };
+6 -4
View File
@@ -871,27 +871,29 @@ html
el-dropdown-menu(#default="dropdown") 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") el-dropdown-item(v-if="voice" v-for="(voice, index) in TTSvoices" :key="index" v-text="voice.name" :command="index")
div.options-container 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 div.options-container-item
span.name Download on invite: span.name Download on invite:
br br
toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheInviteToggleSwitchOption" v-model="worldAutoCacheInvite" class="toggle-switch") toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheInviteToggleSwitchOption" v-model="worldAutoCacheInvite" class="toggle-switch")
div.options-container-item div.options-container-item
el-switch(v-model="worldAutoCacheInviteFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheInvite == 'Never'") el-switch(v-model="worldAutoCacheInviteFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheInvite == 'Never'")
br
div.options-container-item div.options-container-item
span.name Download on GPS: span.name Download on GPS:
br br
toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheGPSToggleSwitchOption" v-model="worldAutoCacheGPS" class="toggle-switch") toggle-switch(:options="worldCacheToggleSwitchOption" group="worldCacheGPSToggleSwitchOption" v-model="worldAutoCacheGPS" class="toggle-switch")
div.options-container-item div.options-container-item
el-switch(v-model="worldAutoCacheGPSFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheGPS == 'Never'") el-switch(v-model="worldAutoCacheGPSFilter" inactive-text="VIP" active-text="Everyone" :disabled="worldAutoCacheGPS == 'Never'")
br
div.options-container-item div.options-container-item
el-button-group el-button-group
el-button(size="small" icon="el-icon-download" @click="showDownloadDialog()") Download History el-button(size="small" icon="el-icon-download" @click="showDownloadDialog()") Download History
br br
span.sub-header Automatically Manage Cache When Closing VRChat
div.options-container-item 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") el-switch(v-model="autoSweepVRChatCache")
div.options-container div.options-container
span.header Application span.header Application