diff --git a/html/src/app.js b/html/src/app.js index edbcbd37..e801e832 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -3689,7 +3689,7 @@ speechSynthesis.getVoices(); if ((this.isGameRunning) && ((this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP') || (this.sharedFeedFilters.noty.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.noty.OnPlayerJoining === 'VIP'))) { var bias = new Date(Date.now() - 120000).toJSON(); - var locationBias = new Date(Date.now() - 10000).toJSON(); + var locationBias = new Date(Date.now() - 15000).toJSON(); //15 seconds for (var i = 0; i < wristFeed.length; i++) { var ctx = wristFeed[i]; if ((ctx.created_at < bias) || (ctx.type === 'Location')) { @@ -3780,7 +3780,7 @@ speechSynthesis.getVoices(); } // on Location change remove OnPlayerJoined if ((ctx.type === 'Location') && (this.hideOnPlayerJoined)) { - var locationBias = new Date(Date.parse(ctx.created_at) + 10000).toJSON(); //10 seconds + var locationBias = new Date(Date.parse(ctx.created_at) + 15000).toJSON(); //15 seconds for (var k = w - 1; k > -1; k--) { var feedItem = wristArr[k]; if ((feedItem.created_at > locationBias) || (feedItem.type === 'Location')) { @@ -8734,12 +8734,12 @@ speechSynthesis.getVoices(); json, params }; - this.$emit('FILES', args); + this.$emit('VRCPLUSICON:LIST', args); return args; }); }; - API.$on('FILES', function (args) { + API.$on('VRCPLUSICON:LIST', function (args) { $app.VRCPlusIconsTable = args.json; }); @@ -8774,11 +8774,22 @@ speechSynthesis.getVoices(); $app.methods.deleteVRCPlusIcon = function (userIcon) { API.deleteVRCPlusIcon(userIcon).then((args) => { - this.displayVRCPlusIconsTable(); + API.$emit('VRCPLUSICON:DELETE', args); return args; }); }; + API.$on('VRCPLUSICON:DELETE', function (args) { + var array = $app.VRCPlusIconsTable; + var { length } = array; + for (var i = 0; i < length; ++i) { + if (args.userIcon === array[i].id) { + array.splice(i, 1); + break; + } + } + }); + API.deleteVRCPlusIcon = function (userIcon) { return this.call(`file/${userIcon}`, { method: 'DELETE' @@ -8805,6 +8816,11 @@ speechSynthesis.getVoices(); }; $app.methods.onFileChangeVRCPlusIcon = function (e) { + var clearFile = function() { + if (document.querySelector('#VRCPlusIconUploadButton')) { + document.querySelector('#VRCPlusIconUploadButton').value = ''; + } + }; var files = e.target.files || e.dataTransfer.files; if (!files.length) { return; @@ -8814,6 +8830,7 @@ speechSynthesis.getVoices(); message: 'File size too large', type: 'error' }); + clearFile(); return; } if (!files[0].type.match(/image.*/)) { @@ -8821,6 +8838,7 @@ speechSynthesis.getVoices(); message: 'File isn\'t an image', type: 'error' }); + clearFile(); return; } var r = new FileReader(); @@ -8835,6 +8853,7 @@ speechSynthesis.getVoices(); }); }; r.readAsBinaryString(files[0]); + clearFile(); }; $app.methods.displayVRCPlusIconUpload = function () { @@ -8850,10 +8869,17 @@ speechSynthesis.getVoices(); json, params }; + this.$emit('VRCPLUSICON:ADD', args); return args; }); }; + API.$on('VRCPLUSICON:ADD', function (args) { + if (Object.keys($app.VRCPlusIconsTable).length !== 0) { + $app.VRCPlusIconsTable.push(args.json); + } + }); + $app.data.uploadImage = ''; $app.methods.inviteImageUpload = function (e) { @@ -8866,13 +8892,15 @@ speechSynthesis.getVoices(); message: 'File size too large', type: 'error' }); + this.clearInviteImageUpload(); return; } - if (!files[0].type.match(/image.*/)) { + if (!files[0].type.match(/image.png/)) { $app.$message({ - message: 'File isn\'t an image', + message: 'File isn\'t a png', type: 'error' }); + this.clearInviteImageUpload(); return; } var r = new FileReader(); diff --git a/html/src/index.pug b/html/src/index.pug index 64994159..d4b99087 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1513,7 +1513,7 @@ html //- dialog Table: Send Invite Response Message el-dialog.x-dialog(ref="sendInviteResponseDialog" :visible.sync="sendInviteResponseDialogVisible" title="Send Invite Response Message" width="800px") template(v-if="API.currentUser.$isVRCPlus") - input.inviteImageUploadButton(type="file" multiple accept="image/*" @change="inviteImageUpload") + input.inviteImageUploadButton(type="file" multiple accept="image/png" @change="inviteImageUpload") data-tables(v-bind="inviteResponseMessageTable" @row-click="showSendInviteResponseConfirmDialog" style="margin-top:10px;cursor:pointer") el-table-column(label="Slot" prop="slot" sortable="custom" width="70") el-table-column(label="Message" prop="message") @@ -1530,7 +1530,7 @@ html //- dialog Table: Send Invite Request Response Message el-dialog.x-dialog(ref="sendInviteRequestResponseDialog" :visible.sync="sendInviteRequestResponseDialogVisible" title="Send Invite Request Response Message" width="800px") template(v-if="API.currentUser.$isVRCPlus") - input.inviteImageUploadButton(type="file" multiple accept="image/*" @change="inviteImageUpload") + input.inviteImageUploadButton(type="file" multiple accept="image/png" @change="inviteImageUpload") data-tables(v-bind="inviteRequestResponseMessageTable" @row-click="showSendInviteResponseConfirmDialog" style="margin-top:10px;cursor:pointer") el-table-column(label="Slot" prop="slot" sortable="custom" width="70") el-table-column(label="Message" prop="message") @@ -1555,7 +1555,7 @@ html //- dialog Table: Send Invite Message el-dialog.x-dialog(ref="sendInviteDialog" :visible.sync="sendInviteDialogVisible" title="Send Invite Message" width="800px") template(v-if="API.currentUser.$isVRCPlus") - input.inviteImageUploadButton(type="file" multiple accept="image/*" @change="inviteImageUpload") + input.inviteImageUploadButton(type="file" multiple accept="image/png" @change="inviteImageUpload") data-tables(v-bind="inviteMessageTable" @row-click="showSendInviteConfirmDialog" style="margin-top:10px;cursor:pointer") el-table-column(label="Slot" prop="slot" sortable="custom" width="70") el-table-column(label="Message" prop="message") @@ -1572,7 +1572,7 @@ html //- dialog Table: Send Invite Request Message el-dialog.x-dialog(ref="sendInviteRequestDialog" :visible.sync="sendInviteRequestDialogVisible" title="Send Invite Request Message" width="800px") template(v-if="API.currentUser.$isVRCPlus") - input.inviteImageUploadButton(type="file" multiple accept="image/*" @change="inviteImageUpload") + input.inviteImageUploadButton(type="file" multiple accept="image/png" @change="inviteImageUpload") data-tables(v-bind="inviteRequestMessageTable" @row-click="showSendInviteConfirmDialog" style="margin-top:10px;cursor:pointer") el-table-column(label="Slot" prop="slot" sortable="custom" width="70") el-table-column(label="Message" prop="message")