diff --git a/src/api/vrcPlusImage.js b/src/api/vrcPlusImage.js
index fc32e1d1..2ee36ab2 100644
--- a/src/api/vrcPlusImage.js
+++ b/src/api/vrcPlusImage.js
@@ -43,7 +43,6 @@ const vrcPlusImageReq = {
json,
params
};
- window.API.$emit('PRINT:LIST', args);
return args;
});
},
diff --git a/src/app.js b/src/app.js
index 0e6786c9..d314e878 100644
--- a/src/app.js
+++ b/src/app.js
@@ -6375,6 +6375,9 @@ console.log(`isLinux: ${LINUX}`);
case 'VRCX_udonExceptionLogging':
this.udonExceptionLogging = !this.udonExceptionLogging;
break;
+ case 'VRCX_autoDeleteOldPrints':
+ this.autoDeleteOldPrints = !this.autoDeleteOldPrints;
+ break;
default:
break;
}
@@ -6515,6 +6518,11 @@ console.log(`isLinux: ${LINUX}`);
this.udonExceptionLogging
);
+ await configRepository.setBool(
+ 'VRCX_autoDeleteOldPrints',
+ this.autoDeleteOldPrints
+ );
+
this.updateSharedFeed(true);
this.updateVRConfigVars();
this.updateVRLastLocation();
@@ -10167,13 +10175,14 @@ console.log(`isLinux: ${LINUX}`);
n: 100,
tag: 'icon'
};
- vrcPlusIconRequest.getFileList(params);
+ vrcPlusIconRequest.getFileList(params).finally(() => {
+ this.galleryDialogIconsLoading = false;
+ });
};
API.$on('FILES:LIST', function (args) {
if (args.params.tag === 'icon') {
$app.VRCPlusIconsTable = args.json.reverse();
- $app.galleryDialogIconsLoading = false;
}
});
@@ -10840,13 +10849,14 @@ console.log(`isLinux: ${LINUX}`);
n: 100,
tag: 'gallery'
};
- vrcPlusIconRequest.getFileList(params);
+ vrcPlusIconRequest.getFileList(params).finally(() => {
+ this.galleryDialogGalleryLoading = false;
+ });
};
API.$on('FILES:LIST', function (args) {
if (args.params.tag === 'gallery') {
$app.galleryTable = args.json.reverse();
- $app.galleryDialogGalleryLoading = false;
}
});
@@ -10868,13 +10878,14 @@ console.log(`isLinux: ${LINUX}`);
n: 100,
tag: 'sticker'
};
- vrcPlusIconRequest.getFileList(params);
+ vrcPlusIconRequest.getFileList(params).finally(() => {
+ this.galleryDialogStickersLoading = false;
+ });
};
API.$on('FILES:LIST', function (args) {
if (args.params.tag === 'sticker') {
$app.stickerTable = args.json.reverse();
- $app.galleryDialogStickersLoading = false;
}
});
@@ -10963,20 +10974,24 @@ console.log(`isLinux: ${LINUX}`);
API.$on('LOGIN', function () {
$app.printTable = [];
+ if ($app.autoDeleteOldPrints) {
+ $app.tryDeleteOldPrints();
+ }
});
- $app.methods.refreshPrintTable = function () {
+ $app.methods.refreshPrintTable = async function () {
this.galleryDialogPrintsLoading = true;
var params = {
n: 100
};
- vrcPlusImageRequest.getPrints(params);
- };
-
- API.$on('PRINT:LIST', function (args) {
+ const args = await vrcPlusImageRequest.getPrints(params).finally(() => {
+ this.galleryDialogPrintsLoading = false;
+ });
+ args.json.sort((a, b) => {
+ return new Date(b.timestamp) - new Date(a.timestamp);
+ });
$app.printTable = args.json;
- $app.galleryDialogPrintsLoading = false;
- });
+ };
$app.data.printUploadNote = '';
$app.data.printCropBorder = true;
@@ -11076,13 +11091,14 @@ console.log(`isLinux: ${LINUX}`);
n: 100,
tag: 'emoji'
};
- vrcPlusIconRequest.getFileList(params);
+ vrcPlusIconRequest.getFileList(params).finally(() => {
+ this.galleryDialogEmojisLoading = false;
+ });
};
API.$on('FILES:LIST', function (args) {
if (args.params.tag === 'emoji') {
$app.emojiTable = args.json.reverse();
- $app.galleryDialogEmojisLoading = false;
}
});
@@ -12193,6 +12209,48 @@ console.log(`isLinux: ${LINUX}`);
await this.setUGCFolderPath(path);
};
+ // auto delete old prints
+
+ $app.data.autoDeleteOldPrints = await configRepository.getBool(
+ 'VRCX_autoDeleteOldPrints',
+ false
+ );
+
+ $app.methods.tryDeleteOldPrints = async function () {
+ await this.refreshPrintTable();
+ const printLimit = 64 - 2; // 2 reserved for new prints
+ const printCount = $app.printTable.length;
+ if (printCount <= printLimit) {
+ return;
+ }
+ const deleteCount = printCount - printLimit;
+ if (deleteCount <= 0) {
+ return;
+ }
+ let idList = [];
+ for (let i = 0; i < deleteCount; i++) {
+ const print = $app.printTable[printCount - 1 - i];
+ idList.push(print.id);
+ }
+ console.log(`Deleting ${deleteCount} old prints`, idList);
+ try {
+ for (const printId of idList) {
+ await vrcPlusImageRequest.deletePrint(printId);
+ var text = `Old print automaticly deleted: ${printId}`;
+ if (this.errorNoty) {
+ this.errorNoty.close();
+ }
+ this.errorNoty = new Noty({
+ type: 'info',
+ text
+ }).show();
+ }
+ } catch (err) {
+ console.error('Failed to delete old print:', err);
+ }
+ await this.refreshPrintTable();
+ };
+
// avatar database provider
$app.data.isAvatarProviderDialogVisible = false;
diff --git a/src/classes/apiRequestHandler.js b/src/classes/apiRequestHandler.js
index e692cfd5..64761c9e 100644
--- a/src/classes/apiRequestHandler.js
+++ b/src/classes/apiRequestHandler.js
@@ -77,6 +77,9 @@ export default class extends baseClass {
})
.then((response) => {
if (!response.data) {
+ if ($app.debugWebRequests) {
+ console.log(init, response);
+ }
return response;
}
try {
diff --git a/src/classes/websocket.js b/src/classes/websocket.js
index 90a8d597..a0886bc7 100644
--- a/src/classes/websocket.js
+++ b/src/classes/websocket.js
@@ -539,16 +539,20 @@ export default class extends baseClass {
) {
$app.refreshEmojiTable();
}
- } else if (
- contentType === 'print' ||
- contentType === 'prints'
- ) {
+ } else if (contentType === 'print') {
if (
+ $app.autoDeleteOldPrints &&
+ content.actionType === 'created'
+ ) {
+ $app.tryDeleteOldPrints();
+ } else if (
$app.galleryDialogVisible &&
!$app.galleryDialogPrintsLoading
) {
$app.refreshPrintTable();
}
+ } else if (contentType === 'prints') {
+ // lol
} else if (contentType === 'avatar') {
// hmm, utilizing this might be too spamy and cause UI to move around
} else if (contentType === 'world') {
diff --git a/src/components/dialogs/UserDialog/GalleryDialog.vue b/src/components/dialogs/UserDialog/GalleryDialog.vue
index 8bf4d2f3..33e3c967 100644
--- a/src/components/dialogs/UserDialog/GalleryDialog.vue
+++ b/src/components/dialogs/UserDialog/GalleryDialog.vue
@@ -452,6 +452,14 @@
+