diff --git a/html/src/app.js b/html/src/app.js index e104fd83..75332fbb 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -5976,17 +5976,16 @@ speechSynthesis.getVoices(); } else { API.endpointDomain = API.endpointDomainVrchat; } - return new Promise((resolve, reject) => { - if (this.enablePrimaryPassword) { - API.logout(); - } else { - API.getConfig() - .catch((err) => { - this.loginForm.loading = false; - reject(err); - }) - .then(() => { - API.login({ + if (this.enablePrimaryPassword) { + API.logout(); + } else { + API.getConfig() + .catch((err) => { + this.loginForm.loading = false; + throw err; + }) + .then(() => { + API.login({ username: loginParmas.username, password: loginParmas.password, endpoint: loginParmas.endpoint @@ -5997,10 +5996,9 @@ speechSynthesis.getVoices(); }) .then(() => { this.loginForm.loading = false; - }); - }); - } - }); + }); + }); + } }; $app.methods.deleteSavedLogin = function (username) { @@ -7599,6 +7597,7 @@ speechSynthesis.getVoices(); this.photonLobbyCurrent = new Map(); this.photonLobbyMaster = 0; this.photonLobbyCurrentUser = 0; + this.photonLobbyUserData = new Map(); this.photonLobbyInVrMode = new Map(); this.photonLobbyWatcherLoopStop(); this.photonLobbyAvatars = new Map(); @@ -8102,6 +8101,7 @@ speechSynthesis.getVoices(); $app.data.photonLobby = new Map(); $app.data.photonLobbyMaster = 0; $app.data.photonLobbyCurrentUser = 0; + $app.data.photonLobbyUserData = new Map(); $app.data.photonLobbyInVrMode = new Map(); $app.data.photonLobbyCurrent = new Map(); $app.data.photonLobbyAvatars = new Map(); @@ -8326,13 +8326,14 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId: id, text, + type: 'PhotonBot', color: 'yellow', created_at: new Date().toJSON() }); var entry = { created_at: new Date().toJSON(), type: 'Event', - data: `${text} - ${this.getDisplayNameFromPhotonId( + data: `${text} ${this.getDisplayNameFromPhotonId( id )} (${this.getUserIdFromPhotonId(id)})` }; @@ -8607,6 +8608,7 @@ speechSynthesis.getVoices(); ) { this.photonModerationUpdate( ref, + photonId, block, mute, gameLogDate @@ -8617,14 +8619,6 @@ speechSynthesis.getVoices(); mute, gameLogDate }); - if (block || mute) { - this.addEntryPhotonEvent({ - photonId, - text: `mute:${mute} block:${block}`, - color: 'yellow', - created_at: gameLogDate - }); - } } } else { var blockArray = data.Parameters[245]['10']; @@ -8632,14 +8626,23 @@ speechSynthesis.getVoices(); var idList = new Map(); blockArray.forEach((photonId1) => { if (muteArray.includes(photonId1)) { - idList.set(photonId1, {mute: true, block: true}); + idList.set(photonId1, { + isMute: true, + isBlock: true + }); } else { - idList.set(photonId1, {mute: false, block: true}); + idList.set(photonId1, { + isMute: false, + isBlock: true + }); } }); muteArray.forEach((photonId2) => { if (!idList.has(photonId2)) { - idList.set(photonId2, {mute: true, block: false}); + idList.set(photonId2, { + isMute: true, + isBlock: false + }); } }); idList.forEach(({isMute, isBlock}, photonId3) => { @@ -8650,6 +8653,7 @@ speechSynthesis.getVoices(); ) { this.photonModerationUpdate( ref1, + photonId3, isBlock, isMute, gameLogDate @@ -8732,6 +8736,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId: senderId, text: `DeletedPortal ${time}`, + type: 'DeletedPortal', created_at: gameLogDate }); return; @@ -8800,6 +8805,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId: senderId, text, + type: 'Event', created_at: gameLogDate }); } else { @@ -8875,6 +8881,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text: `Photon Master Migrate`, + type: 'PhotonMasterMigrate', created_at: gameLogDate }); } @@ -8905,6 +8912,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text, + type: 'PhotonBot', color: 'yellow', created_at: gameLogDate }); @@ -8941,6 +8949,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text, + type: 'PhotonBot', color: 'yellow', created_at: gameLogDate }); @@ -8975,6 +8984,7 @@ speechSynthesis.getVoices(); }; this.photonLobby.set(photonId, photonUser); this.photonLobbyCurrent.set(photonId, photonUser); + this.photonLobbyUserDataUpdate(photonId, photonUser, gameLogDate); var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min if (bias > Date.now()) { @@ -8987,6 +8997,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text: `API/Photon platform mismatch ${ref.last_platform}/${photonUser.last_platform}`, + type: 'PhotonBot', color: 'yellow', created_at: Date.parse(gameLogDate) }); @@ -9024,14 +9035,44 @@ speechSynthesis.getVoices(); var {block, mute, gameLogDate} = this.moderationEventQueue.get(photonId); this.moderationEventQueue.delete(photonId); - this.photonModerationUpdate(ref, block, mute, gameLogDate); + this.photonModerationUpdate( + ref, + photonId, + block, + mute, + gameLogDate + ); } } }; + $app.methods.photonLobbyUserDataUpdate = function ( + photonId, + photonUser, + gameLogDate + ) { + var ref = this.photonLobbyUserData.get(photonId); + if ( + typeof ref !== 'undefined' && + (photonUser.status !== ref.status || + photonUser.statusDescription !== ref.statusDescription) + ) { + this.addEntryPhotonEvent({ + photonId, + type: 'ChangeStatus', + status: photonUser.status, + previousStatus: ref.status, + statusDescription: photonUser.statusDescription, + previousStatusDescription: ref.statusDescription, + created_at: Date.parse(gameLogDate) + }); + } + this.photonLobbyUserData.set(photonId, photonUser); + }; + $app.methods.photonUserJoin = function (photonId, ref, gameLogDate) { if ( - photonId !== this.photonLobbyCurrentUser && + photonId === this.photonLobbyCurrentUser || !this.photonEventOverlayJoinLeave ) { return; @@ -9039,6 +9080,7 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text: 'has joined', + type: 'OnPlayerJoined', created_at: gameLogDate }); }; @@ -9050,34 +9092,50 @@ speechSynthesis.getVoices(); this.addEntryPhotonEvent({ photonId, text: 'has left', + type: 'OnPlayerLeft', created_at: gameLogDate }); }; $app.methods.photonModerationUpdate = function ( ref, + photonId, block, mute, gameLogDate ) { database.getModeration(ref.id).then((row) => { var type = ''; + var text = ''; if (block) { type = 'Blocked'; + text = 'Blocked'; } else if (mute) { type = 'Muted'; + text = 'Muted'; } if (row.userId) { if (!block && row.block) { type = 'Unblocked'; + text = 'Unblocked'; } else if (!mute && row.mute) { type = 'Unmuted'; + text = 'Unmuted'; } if (block === row.block && mute === row.mute) { // no change type = ''; } } + if (text) { + this.addEntryPhotonEvent({ + photonId, + text: `Moderation ${text}`, + type: 'Moderation', + color: 'yellow', + created_at: gameLogDate + }); + } if (type) { var noty = { created_at: new Date().toJSON(), @@ -9124,7 +9182,7 @@ speechSynthesis.getVoices(); if ( oldAvatarId && oldAvatarId !== avatar.id && - user.id !== API.currentUser.id + photonId !== this.photonLobbyCurrentUser ) { this.checkVRChatCache(avatar).then((cacheInfo) => { var inCache = false; @@ -9151,6 +9209,7 @@ speechSynthesis.getVoices(); displayName: user.displayName, userId: user.id, text: `ChangeAvatar ${avatar.name}`, + type: 'AvatarChange', created_at: gameLogDate, avatar, inCache @@ -18757,6 +18816,15 @@ speechSynthesis.getVoices(); $app.methods.parseOperationResponse = function (data, dateTime) { switch (data.OperationCode) { case 226: + if ( + typeof data.Parameters[248] !== 'undefined' && + typeof data.Parameters[248][248] !== 'undefined' + ) { + this.setPhotonLobbyMaster(data.Parameters[248][248]); + } + if (typeof data.Parameters[254] !== 'undefined') { + this.photonLobbyCurrentUser = data.Parameters[254]; + } if (typeof data.Parameters[249] !== 'undefined') { for (var i in data.Parameters[249]) { var id = parseInt(i, 10); @@ -18784,15 +18852,6 @@ speechSynthesis.getVoices(); if (typeof data.Parameters[252] !== 'undefined') { this.parsePhotonLobbyIds(data.Parameters[252]); } - if ( - typeof data.Parameters[248] !== 'undefined' && - typeof data.Parameters[248][248] !== 'undefined' - ) { - this.setPhotonLobbyMaster(data.Parameters[248][248]); - } - if (typeof data.Parameters[254] !== 'undefined') { - this.photonLobbyCurrentUser = data.Parameters[254]; - } break; } }; diff --git a/html/src/index.pug b/html/src/index.pug index 130a86fe..1bdfbc9f 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -200,7 +200,7 @@ html span.x-link(v-text="scope.row.displayName" @click="showUserFromPhotonId(scope.row.photonId)" style="padding-right:10px") el-table-column(label="Event" prop="text") template(v-once #default="scope") - span(v-if="scope.row.avatar") + span(v-if="scope.row.type === 'AvatarChange'") span ChangeAvatar span.x-link(v-text="scope.row.avatar.name" @click="showAvatarDialog(scope.row.avatar.id)") |   @@ -208,6 +208,29 @@ html span.avatar-info-own(v-else-if="scope.row.avatar.releaseStatus === 'private'") (Private) template(v-if="scope.row.avatar.description && scope.row.avatar.name !== scope.row.avatar.description") | - {{ scope.row.avatar.description }} + template(v-else-if="scope.row.type === 'ChangeStatus'") + span ChangeStatus + template(v-if="scope.row.status !== scope.row.previousStatus") + el-tooltip(placement="top") + template(#content) + span(v-if="scope.row.previousStatus === 'active'") Active + span(v-else-if="scope.row.previousStatus === 'join me'") Join Me + span(v-else-if="scope.row.previousStatus === 'ask me'") Ask Me + span(v-else-if="scope.row.previousStatus === 'busy'") Do Not Disturb + span(v-else) Offline + i.x-user-status(:class="statusClass(scope.row.previousStatus)" style="margin-left:10px") + span + i.el-icon-right + el-tooltip(placement="top") + template(#content) + span(v-if="scope.row.status === 'active'") Active + span(v-else-if="scope.row.status === 'join me'") Join Me + span(v-else-if="scope.row.status === 'ask me'") Ask Me + span(v-else-if="scope.row.status === 'busy'") Do Not Disturb + span(v-else) Offline + i.x-user-status(:class="statusClass(scope.row.status)") + span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:10px") + span(v-else-if="scope.row.color === 'yellow'" v-text="scope.row.text" style="color:yellow") span(v-else v-text="scope.row.text") el-tab-pane(label="Previous") data-tables(v-bind="photonEventTablePrevious" style="margin-bottom:10px") diff --git a/html/src/vr.js b/html/src/vr.js index 89d0a6c8..3032a0ad 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -573,22 +573,21 @@ Vue.component('marquee-text', MarqueeText); }; $app.methods.addEntryHudFeed = function (json) { - var {displayName, text, color, avatar, inCache} = JSON.parse(json); + var data = JSON.parse(json); var combo = 1; this.hudFeed.forEach((item) => { - if (item.displayName === displayName && item.text === text) { + if ( + item.displayName === data.displayName && + item.text === data.text + ) { combo = item.combo + 1; removeFromArray(this.hudFeed, item); } }); this.hudFeed.unshift({ time: Date.now(), - displayName, - text, combo, - color, - avatar, - inCache + ...data }); this.cleanHudFeed(); }; diff --git a/html/src/vr.pug b/html/src/vr.pug index 1669e608..3b4f4666 100644 --- a/html/src/vr.pug +++ b/html/src/vr.pug @@ -428,12 +428,22 @@ html .hud-feed div(v-for="feed in hudFeed") .item #[span(v-if="feed.isMaster") 👑]{{ feed.displayName }} - span(v-if="feed.avatar") + span(v-if="feed.type === 'AvatarChange'") span(style="margin-left:10px") ChangeAvatar span(v-if="!feed.inCache" style="color:#aaa;margin-left:10px") #[i.el-icon-download] span(v-text="feed.avatar.name" style="margin-left:10px") - span(v-else-if="feed.color === 'yellow'" style="color:yellow;margin-left:10px") {{ feed.text }} - span(v-else style="margin-left:10px") {{ feed.text }} + span(v-if="feed.avatar.releaseStatus === 'public'" style="margin-left:10px;color:#67c23a") (Public) + span(v-else-if="feed.avatar.releaseStatus === 'private'" style="margin-left:10px;color:#e6a23c") (Private) + template(v-else-if="feed.type === 'ChangeStatus'") + span(style="margin-left:10px") ChangeStatus + template(v-if="feed.status !== feed.previousStatus") + i.x-user-status(:class="statusClass(feed.previousStatus)" style="margin-left:10px;width:20px;height:20px") + span + i.el-icon-right + i.x-user-status(:class="statusClass(feed.status)" style="width:20px;height:20px") + span(v-if="feed.statusDescription !== feed.previousStatusDescription" v-text="feed.statusDescription" style="margin-left:10px") + span(v-else-if="feed.color === 'yellow'" v-text="feed.text" style="color:yellow;margin-left:10px") + span(v-else style="margin-left:10px" v-text="feed.text") template(v-if="feed.combo > 1") span.combo(style="margin-left:10px") x{{ feed.combo }} .hud-timeout(v-if="hudTimeout.length > 0")