Disable cache deletion when file in use, cache avatars.

This commit is contained in:
Natsumi
2021-08-10 17:03:42 +12:00
parent f5098485f0
commit e1898e27b8
3 changed files with 62 additions and 19 deletions

View File

@@ -9188,7 +9188,10 @@ speechSynthesis.getVoices();
rooms: [],
treeData: [],
fileCreatedAt: '',
fileSize: ''
fileSize: '',
inCache: false,
cacheSize: 0,
cacheLocked: false
};
API.$on('LOGOUT', function () {
@@ -9283,6 +9286,7 @@ speechSynthesis.getVoices();
D.loading = true;
D.inCache = false;
D.cacheSize = 0;
D.cacheLocked = false;
D.rooms = [];
API.getCachedWorld({
worldId: L.worldId
@@ -9561,7 +9565,8 @@ speechSynthesis.getVoices();
fileCreatedAt: '',
fileSize: '',
inCache: false,
cacheSize: 0
cacheSize: 0,
cacheLocked: false
};
API.$on('LOGOUT', function () {
@@ -9597,6 +9602,7 @@ speechSynthesis.getVoices();
D.fileSize = '';
D.inCache = false;
D.cacheSize = 0;
D.cacheLocked = false;
D.isQuestFallback = false;
D.isFavorite = API.cachedFavoritesByObjectId.has(avatarId);
var ref = API.cachedAvatars.get(avatarId);
@@ -12487,10 +12493,14 @@ speechSynthesis.getVoices();
if (D.visible) {
D.inCache = false;
D.cacheSize = 0;
this.checkVRChatCache(D.ref).then((cacheSize) => {
if (cacheSize > 0) {
D.cacheLocked = false;
this.checkVRChatCache(D.ref).then((cacheInfo) => {
if (cacheInfo[0] > 0) {
D.inCache = true;
D.cacheSize = `${(cacheSize / 1048576).toFixed(2)} MiB`;
D.cacheSize = `${(cacheInfo[0] / 1048576).toFixed(2)} MiB`;
}
if (cacheInfo[1] === 1) {
D.cacheLocked = true;
}
});
}
@@ -12501,10 +12511,14 @@ speechSynthesis.getVoices();
if (D.visible) {
D.inCache = false;
D.cacheSize = 0;
this.checkVRChatCache(D.ref).then((cacheSize) => {
if (cacheSize > 0) {
D.cacheLocked = false;
this.checkVRChatCache(D.ref).then((cacheInfo) => {
if (cacheInfo[0] > 0) {
D.inCache = true;
D.cacheSize = `${(cacheSize / 1048576).toFixed(2)} MiB`;
D.cacheSize = `${(cacheInfo[0] / 1048576).toFixed(2)} MiB`;
}
if (cacheInfo[1] === 1) {
D.cacheLocked = true;
}
});
}
@@ -12690,8 +12704,8 @@ speechSynthesis.getVoices();
worldId: L.worldId
}).then((args) => {
var { ref } = args;
this.checkVRChatCache(ref).then((cacheSize) => {
if (cacheSize === -1) {
this.checkVRChatCache(ref).then((cacheInfo) => {
if ((cacheInfo[0] === -1) && (cacheInfo[1] === 0)) {
this.downloadQueue.set(ref.id, { ref, type, userId, location });
this.downloadQueueTable.data = Array.from(this.downloadQueue.values());
if (!this.downloadInProgress) {
@@ -12724,11 +12738,19 @@ speechSynthesis.getVoices();
if (this.worldDialog.id === this.downloadCurrent.id) {
this.updateVRChatWorldCache();
}
if (this.avatarDialog.id === this.downloadCurrent.id) {
this.updateVRChatAvatarCache();
}
if (this.downloadCurrent.type === 'Manual') {
this.$message({
message: 'World cache complete',
type: 'success'
});
} else if (this.downloadCurrent.type === 'Avatar') {
this.$message({
message: 'Avatar cache complete',
type: 'success'
});
}
this.downloadCurrent.status = 'Success';
this.downloadCurrent.date = Date.now();
@@ -12777,6 +12799,9 @@ speechSynthesis.getVoices();
if (this.worldDialog.id === this.downloadCurrent.id) {
this.updateVRChatWorldCache();
}
if (this.avatarDialog.id === this.downloadCurrent.id) {
this.updateVRChatAvatarCache();
}
if (this.downloadCurrent.type === 'Manual') {
this.$message({
message: 'File already in cache',