diff --git a/StartupArgs.cs b/StartupArgs.cs index 4614e342..b275dedb 100644 --- a/StartupArgs.cs +++ b/StartupArgs.cs @@ -24,7 +24,9 @@ namespace VRCX foreach (string arg in args) { - if (arg.Contains("--gpufix")) Program.GPUFix = true; + if (arg.Contains("--gpufix")) + Program.GPUFix = true; + if (arg.Length > 12 && arg.Substring(0, 12) == "/uri=vrcx://") LaunchCommand = arg.Substring(12); diff --git a/html/src/app.js b/html/src/app.js index c184360f..046954a2 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -9568,7 +9568,11 @@ speechSynthesis.getVoices(); return; } this.photonLastChatBoxMsg.set(photonId, text); - if (this.checkChatboxBlacklist(text)) { + var userId = this.getUserIdFromPhotonId(photonId); + if ( + this.chatboxUserBlacklist.has(userId) || + this.checkChatboxBlacklist(text) + ) { return; } this.addEntryPhotonEvent({ @@ -9578,7 +9582,7 @@ speechSynthesis.getVoices(); created_at: gameLogDate }); var entry = { - userId: this.getUserIdFromPhotonId(photonId), + userId, displayName: this.getDisplayNameFromPhotonId(photonId), created_at: gameLogDate, type: 'ChatBoxMessage', @@ -22061,6 +22065,40 @@ speechSynthesis.getVoices(); return false; }; + // App: ChatBox User Blacklist + $app.data.chatboxUserBlacklist = new Map(); + if (configRepository.getString('VRCX_chatboxUserBlacklist')) { + $app.data.chatboxUserBlacklist = new Map( + Object.entries( + JSON.parse( + configRepository.getString('VRCX_chatboxUserBlacklist') + ) + ) + ); + } + + $app.methods.saveChatboxUserBlacklist = function () { + configRepository.setString( + 'VRCX_chatboxUserBlacklist', + JSON.stringify(Object.fromEntries(this.chatboxUserBlacklist)) + ); + }; + + $app.methods.addChatboxUserBlacklist = function (user) { + this.chatboxUserBlacklist.set(user.id, user.displayName); + this.saveChatboxUserBlacklist(); + this.getCurrentInstanceUserList(); + }; + + $app.methods.deleteChatboxUserBlacklist = function (userId) { + this.chatboxUserBlacklist.delete(userId); + this.saveChatboxUserBlacklist(); + this.getCurrentInstanceUserList(); + this.$nextTick(() => + adjustDialogZ(this.$refs.chatboxBlacklistDialog.$el) + ); + }; + $app = new Vue($app); window.$app = $app; })(); diff --git a/html/src/index.pug b/html/src/index.pug index c730ddf6..05d65002 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -263,6 +263,12 @@ html timer(:epoch="scope.row.timer") el-table-column(v-if="photonLoggingEnabled" label="Photon Id" width="110" prop="photonId" sortable) template(v-once #default="scope") + template(v-if="chatboxUserBlacklist.has(scope.row.ref.id)") + el-tooltip(placement="left" content="Unblock chatbox messages") + el-button(type="text" icon="el-icon-turn-off-microphone" size="mini" style="color:red;margin-right:5px" @click.stop="deleteChatboxUserBlacklist(scope.row.ref.id)") + template(v-else) + el-tooltip(placement="left" content="Block chatbox messages") + el-button(type="text" icon="el-icon-microphone" size="mini" style="margin-right:5px" @click.stop="addChatboxUserBlacklist(scope.row.ref)") span(v-text="scope.row.photonId") el-table-column(label="Icons" prop="isMaster" width="100") template(v-once #default="scope") @@ -3305,10 +3311,15 @@ html //- dialog: chatbox blacklist el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="chatboxBlacklistDialog" :visible.sync="chatboxBlacklistDialog.visible" title="Chatbox Blacklist" width="600px") - div(v-loading="chatboxBlacklistDialog.loading") + div(v-loading="chatboxBlacklistDialog.loading" v-if="chatboxBlacklistDialog.visible") + h2 Keyword Blacklist el-input(v-for="(item, index) in chatboxBlacklist" :key="index" :value="item" v-model="chatboxBlacklist[index]" size="small" style="margin-top:5px" @change="saveChatboxBlacklist") el-button(slot="append" icon="el-icon-delete" @click="chatboxBlacklist.splice(index, 1); saveChatboxBlacklist()") el-button(@click="chatboxBlacklist.push('')" size="mini" style="margin-top:5px") Add Item + br + h2 User Blacklist + el-tag(v-for="user in chatboxUserBlacklist" type="info" disable-transitions="true" :key="user[0]" style="margin-right:5px" closable @close="deleteChatboxUserBlacklist(user[0])") + span {{user[1]}} //- dialog: open source software notice el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" :visible.sync="ossDialog" title="Open Source Software Notice" width="650px")