diff --git a/AppApi.cs b/AppApi.cs index 8a326de1..19a6d76f 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -165,7 +165,9 @@ namespace VRCX public void StartGameFromPath(string path, string arguments) { - if (!path.EndsWith(".exe")) path = Path.Combine(path, "VRChat.exe"); + if (!path.EndsWith(".exe")) + path = Path.Combine(path, "start_protected_game.exe"); + Process.Start(new ProcessStartInfo { WorkingDirectory = Path.GetDirectoryName(path), diff --git a/LogWatcher.cs b/LogWatcher.cs index 51b10d5e..439f12f6 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -300,7 +300,7 @@ namespace VRCX // 2021.02.03 10:18:58 Log - [DŽDŽDžDžDžDŽDŽDžDžDŽDžDžDžDžDŽDŽDŽDžDžDŽDŽDžDžDžDžDŽDžDžDžDžDŽDŽDŽDŽDŽDžDŽDžDŽDŽDŽDžDžDŽDžDžDž] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd // 2021.06.23 12:02:56 Log - [Behaviour] Entering Room: VRChat Home - if (line.Contains("[Behaviour] Entering Room: ") || line.Contains("[RoomManager] Entering Room: ")) + if (line.Contains("[Behaviour] Entering Room: ")) { var lineOffset = line.LastIndexOf("] Entering Room: "); if (lineOffset < 0) @@ -314,7 +314,7 @@ namespace VRCX return true; } - if ((line.Contains("[Behaviour] Joining ") || line.Contains("[RoomManager] Joining ")) && !line.Contains("] Joining or Creating Room: ") && !line.Contains("] Joining friend: ")) + if (line.Contains("[Behaviour] Joining ") && !line.Contains("] Joining or Creating Room: ") && !line.Contains("] Joining friend: ")) { var lineOffset = line.LastIndexOf("] Joining "); if (lineOffset < 0) @@ -349,7 +349,7 @@ namespace VRCX // 2021.09.02 00:02:12 Log - [Behaviour] Destination set: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd:15609~private(usr_032383a7-748c-4fb2-94e4-bcb928e5de6b)~nonce(72CC87D420C1D49AEFFBEE8824C84B2DF0E38678E840661E) // 2021.09.02 00:49:15 Log - [Behaviour] Destination fetching: wrld_4432ea9b-729c-46e3-8eaf-846aa0a37fdd - if (line.Contains("[Behaviour] Destination fetching: ") || line.Contains("[VRCFlowManagerVRC] Destination fetching: ")) + if (line.Contains("[Behaviour] Destination fetching: ")) { var lineOffset = line.LastIndexOf("] Destination fetching: "); if (lineOffset < 0) @@ -391,7 +391,7 @@ namespace VRCX // 2021.12.12 11:47:22 Log - [Behaviour] OnPlayerJoined:Unnamed // 2021.12.12 11:53:14 Log - [Behaviour] OnPlayerLeftRoom - if ((line.Contains("[Behaviour] OnPlayerJoined") || line.Contains("[NetworkManager] OnPlayerJoined")) && !line.Contains("] OnPlayerJoined:")) + if (line.Contains("[Behaviour] OnPlayerJoined") && !line.Contains("] OnPlayerJoined:")) { var lineOffset = line.LastIndexOf("] OnPlayerJoined"); if (lineOffset < 0) @@ -415,7 +415,7 @@ namespace VRCX return true; } - if ((line.Contains("[Behaviour] OnPlayerLeft") || line.Contains("[NetworkManager] OnPlayerLeft")) && !line.Contains("] OnPlayerLeftRoom") && !line.Contains("] OnPlayerLeft:")) + if (line.Contains("[Behaviour] OnPlayerLeft") && !line.Contains("] OnPlayerLeftRoom") && !line.Contains("] OnPlayerLeft:")) { var lineOffset = line.LastIndexOf("] OnPlayerLeft"); if (lineOffset < 0) diff --git a/html/src/app.js b/html/src/app.js index 3beda66c..313bd1ca 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -744,9 +744,9 @@ speechSynthesis.getVoices(); }, methods: { parse() { - this.$el.style.display = $app.checkCanInviteSelf() - ? 'none' - : ''; + this.$el.style.display = $app.checkCanInviteSelf(this.location) + ? '' + : 'none'; }, confirm() { API.$emit('SHOW_LAUNCH_DIALOG', this.location); @@ -770,32 +770,12 @@ speechSynthesis.getVoices(); }, methods: { parse() { - this.$el.style.display = $app.checkCanInviteSelf() - ? 'none' - : ''; + this.$el.style.display = $app.checkCanInviteSelf(this.location) + ? '' + : 'none'; }, confirm() { - var L = API.parseLocation(this.location); - if ( - L.isOffline || - L.isPrivate || - L.isTraveling || - L.worldId === '' - ) { - return; - } - if (API.currentUser.status === 'busy') { - this.$message({ - message: - "You cannot invite yourself in 'Do Not Disturb' status", - type: 'error' - }); - return; - } - API.selfInvite({ - instanceId: L.instanceId, - worldId: L.worldId - }); + $app.selfInvite(this.location); } }, watch: { @@ -1395,8 +1375,6 @@ speechSynthesis.getVoices(); } else if ($app.lastLocation.location) { json.location = $app.lastLocation.location; json.$location_at = $app.lastLocation.date; - } else if (ref) { - json.location = ref.location; } else { json.location = ''; } @@ -1479,10 +1457,14 @@ speechSynthesis.getVoices(); if (ref.location === 'traveling') { ref.$location = this.parseLocation(ref.travelingToLocation); if (!this.currentTravelers.has(ref.id)) { - this.currentTravelers.set(ref.id, ref); + var travelRef = { + created_at: new Date().toJSON(), + ...ref + }; + this.currentTravelers.set(ref.id, travelRef); $app.sharedFeed.pendingUpdate = true; $app.updateSharedFeed(false); - $app.onPlayerTraveling(ref); + $app.onPlayerTraveling(travelRef); } } else { ref.$location = this.parseLocation(ref.location); @@ -1505,13 +1487,21 @@ speechSynthesis.getVoices(); } var $ref = {...ref}; Object.assign(ref, json); + ref.$isVRCPlus = ref.tags.includes('system_supporter'); + this.applyUserTrustLevel(ref); + this.applyUserLanguage(ref); + // traveling if (ref.location === 'traveling') { ref.$location = this.parseLocation(ref.travelingToLocation); if (!this.currentTravelers.has(ref.id)) { - this.currentTravelers.set(ref.id, ref); + var travelRef = { + created_at: new Date().toJSON(), + ...ref + }; + this.currentTravelers.set(ref.id, travelRef); $app.sharedFeed.pendingUpdate = true; $app.updateSharedFeed(false); - $app.onPlayerTraveling(ref); + $app.onPlayerTraveling(travelRef); } } else { ref.$location = this.parseLocation(ref.location); @@ -1521,9 +1511,6 @@ speechSynthesis.getVoices(); $app.updateSharedFeed(false); } } - ref.$isVRCPlus = ref.tags.includes('system_supporter'); - this.applyUserTrustLevel(ref); - this.applyUserLanguage(ref); for (var prop in ref) { if (ref[prop] !== Object(ref[prop])) { props[prop] = true; @@ -4372,7 +4359,6 @@ speechSynthesis.getVoices(); if (ref.$location.tag === $app.lastLocation.location) { var feedEntry = { ...ref, - created_at: new Date(ref.$travelingToTime).toJSON(), isFavorite, isFriend: true, type: 'OnPlayerJoining' @@ -4382,7 +4368,7 @@ speechSynthesis.getVoices(); var worldRef = API.cachedWorlds.get(ref.$location.worldId); if (typeof worldRef !== 'undefined') { var feedEntry = { - created_at: new Date(ref.$travelingToTime).toJSON(), + created_at: ref.created_at, type: 'GPS', userId: ref.id, displayName: ref.displayName, @@ -6623,7 +6609,7 @@ speechSynthesis.getVoices(); } }; - $app.data.updateFriendInProgress = new Set(); + $app.data.updateFriendInProgress = new Map(); $app.methods.updateFriend = async function (id, stateInput, origin) { var ctx = this.friends.get(id); @@ -6631,9 +6617,13 @@ speechSynthesis.getVoices(); return; } if (this.updateFriendInProgress.has(id)) { - return; + var date = this.updateFriendInProgress.get(id); + if (date + 10000 >= Date.now()) { + // wait for 10 seconds + return; + } } - this.updateFriendInProgress.add(id); + this.updateFriendInProgress.set(id, Date.now()); var ref = API.cachedUsers.get(id); var isVIP = API.cachedFavoritesByObjectId.has(id); if (typeof stateInput === 'undefined' || ctx.state === stateInput) { @@ -6726,6 +6716,7 @@ speechSynthesis.getVoices(); ctx.state === 'online' && (stateInput === 'active' || stateInput === 'offline') ) { + // wait 1minute then check if user came back online await new Promise((resolve) => { setTimeout(resolve, 50000); }); @@ -7805,6 +7796,8 @@ speechSynthesis.getVoices(); }; database.updateGamelogLocationTimeToDatabase(update); } + this.lastLocationDestination = ''; + this.lastLocationDestinationTime = 0; this.lastLocation = { date: 0, location: '', @@ -7812,6 +7805,7 @@ speechSynthesis.getVoices(); playerList: new Map(), friendList: new Map() }; + this.updateCurrentUserLocation(); this.updateCurrentInstanceWorld(); this.updateVRLastLocation(); this.getCurrentInstanceUserList(); @@ -8062,20 +8056,16 @@ speechSynthesis.getVoices(); } switch (gameLog.type) { case 'location-destination': - this.lastLocation.location = 'traveling'; - this.lastLocationDestination = gameLog.location; - this.lastLocationDestinationTime = Date.parse(gameLog.dt); - API.currentUser.location = this.lastLocation.location; - API.currentUser.travelingToLocation = - this.lastLocationDestination; - API.currentUser.$travelingToTime = - this.lastLocationDestinationTime; - var entry = { - created_at: gameLog.dt, - type: 'LocationDestination', - location: gameLog.location - }; if (this.isGameRunning) { + this.lastLocation.location = 'traveling'; + this.lastLocationDestination = gameLog.location; + this.lastLocationDestinationTime = Date.parse(gameLog.dt); + this.updateCurrentUserLocation(); + var entry = { + created_at: gameLog.dt, + type: 'LocationDestination', + location: gameLog.location + }; this.clearNowPlaying(); this.updateCurrentInstanceWorld(); } @@ -8091,6 +8081,7 @@ speechSynthesis.getVoices(); playerList: new Map(), friendList: new Map() }; + this.updateCurrentUserLocation(); this.updateVRLastLocation(); this.updateCurrentInstanceWorld(); } @@ -14935,8 +14926,8 @@ speechSynthesis.getVoices(); return; } if ( - this.API.currentUser.status === 'busy' && - D.userIds.includes(this.API.currentUser.id) === true + API.currentUser.status === 'busy' && + D.userIds.includes(API.currentUser.id) ) { this.$message({ message: @@ -14949,14 +14940,23 @@ speechSynthesis.getVoices(); var inviteLoop = () => { if (D.userIds.length > 0) { var receiverUserId = D.userIds.shift(); - API.sendInvite( - { - instanceId: D.worldId, - worldId: D.worldId, - worldName: D.worldName - }, - receiverUserId - ).finally(inviteLoop); + if (receiverUserId === API.currentUser.id) { + // can't invite self!? + var L = API.parseLocation(D.worldId); + API.selfInvite({ + instanceId: L.instanceId, + worldId: L.worldId + }).finally(inviteLoop); + } else { + API.sendInvite( + { + instanceId: D.worldId, + worldId: D.worldId, + worldName: D.worldName + }, + receiverUserId + ).finally(inviteLoop); + } } else { D.loading = false; D.visible = false; @@ -15223,7 +15223,8 @@ speechSynthesis.getVoices(); } if (API.currentUser.status === 'busy') { this.$message({ - message: "You can't invite yourself in 'Do Not Disturb' mode", + message: + "You cannot invite yourself in 'Do Not Disturb' status", type: 'error' }); return; @@ -15231,6 +15232,12 @@ speechSynthesis.getVoices(); API.selfInvite({ instanceId: L.instanceId, worldId: L.worldId + }).then((args) => { + this.$message({ + message: 'Self invite sent', + type: 'success' + }); + return args; }); }; @@ -16248,8 +16255,8 @@ speechSynthesis.getVoices(); var J = this.inviteDialog; if (J.visible) { if ( - this.API.currentUser.status === 'busy' && - J.userIds.includes(this.API.currentUser.id) === true + API.currentUser.status === 'busy' && + J.userIds.includes(API.currentUser.id) ) { this.$message({ message: @@ -16261,7 +16268,14 @@ speechSynthesis.getVoices(); var inviteLoop = () => { if (J.userIds.length > 0) { var receiverUserId = J.userIds.shift(); - if ($app.uploadImage) { + if (receiverUserId === API.currentUser.id) { + // can't invite self!? + var L = API.parseLocation(J.worldId); + API.selfInvite({ + instanceId: L.instanceId, + worldId: L.worldId + }).finally(inviteLoop); + } else if ($app.uploadImage) { API.sendInvitePhoto( { instanceId: J.worldId, @@ -16411,8 +16425,8 @@ speechSynthesis.getVoices(); var J = this.inviteDialog; if (J.visible) { if ( - this.API.currentUser.status === 'busy' && - J.userIds.includes(this.API.currentUser.id) === true + API.currentUser.status === 'busy' && + J.userIds.includes(API.currentUser.id) ) { this.$message({ message: @@ -16424,7 +16438,14 @@ speechSynthesis.getVoices(); var inviteLoop = () => { if (J.userIds.length > 0) { var receiverUserId = J.userIds.shift(); - if ($app.uploadImage) { + if (receiverUserId === API.currentUser.id) { + // can't invite self!? + var L = API.parseLocation(J.worldId); + API.selfInvite({ + instanceId: L.instanceId, + worldId: L.worldId + }).finally(inviteLoop); + } else if ($app.uploadImage) { API.sendInvitePhoto( { instanceId: J.worldId, @@ -18602,18 +18623,27 @@ speechSynthesis.getVoices(); if (L.accessType === 'public' || L.userId === API.currentUser.id) { return true; } + if (L.accessType === 'invite') { + return false; + } + if (this.lastLocation.location === location) { + return true; + } return false; }; $app.methods.checkCanInviteSelf = function (location) { var L = API.parseLocation(location); - if (L.accessType === 'invite' || L.accessType === 'friends') { - if (L.userId === API.currentUser.id) { - return false; - } + if (L.userId === API.currentUser.id) { return true; } - return false; + if (L.accessType === 'friends' && !this.friends.has(L.userId)) { + return false; + } + if (L.accessType === 'invite' || L.accessType === 'invite+') { + return false; + } + return true; }; $app.methods.setAsideWidth = function () { @@ -19609,22 +19639,27 @@ speechSynthesis.getVoices(); !this.isGameRunning || !this.lastLocation.location || this.lastLocation.location !== ref.travelingToLocation || + ref.id === API.currentUser.id || this.lastLocation.playerList.has(ref.displayName) ) { return; } - var isFavorite = API.cachedFavoritesByObjectId.has(ref.id); var onPlayerJoining = { - ...ref, - created_at: new Date(ref.$travelingToTime).toJSON(), - isFavorite, - isFriend: true, + created_at: new Date(ref.created_at).toJSON(), + userId: ref.id, + displayName: ref.displayName, type: 'OnPlayerJoining' }; this.queueFeedNoty(onPlayerJoining); }; + $app.methods.updateCurrentUserLocation = function () { + API.currentUser.location = this.lastLocation.location; + API.currentUser.travelingToLocation = this.lastLocationDestination; + API.currentUser.$travelingToTime = this.lastLocationDestinationTime; + }; + $app = new Vue($app); window.$app = $app; })(); diff --git a/html/src/index.pug b/html/src/index.pug index 9e04a6e9..dfdd8340 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -35,7 +35,7 @@ html el-form-item(label="Password" prop="password" required style="margin-top:10px") el-input(type="password" v-model="loginForm.password" name="password" placeholder="Password" clearable show-password) el-checkbox(v-model="loginForm.saveCredentials" style="margin-top:15px") Save Credentials - el-checkbox(v-model="enableCustomEndpoint" @change="toggleCustomEndpoint" style="margin-top:10px") Private Server + el-checkbox(v-model="enableCustomEndpoint" @change="toggleCustomEndpoint" style="margin-top:10px") Dev Endpoint el-form-item(v-if="enableCustomEndpoint" label="Endpont" prop="endpoint" style="margin-top:10px") el-input(v-model="loginForm.endpoint" name="endpoint" :placeholder="API.endpointDomainVrchat" clearable) el-form-item(v-if="enableCustomEndpoint" label="WebSocket" prop="endpoint" style="margin-top:10px") @@ -2687,7 +2687,7 @@ html el-table-column(label="Cool Down" prop="updatedAt" sortable="custom" width="110" align="right") template(v-once #default="scope") countdown-timer(:datetime="scope.row.updatedAt" :hours="1") - el-table-column(label="Action" width="60" align="right") + el-table-column(label="Action" width="70" align="right") template(v-once #default="scope") el-button(type="text" icon="el-icon-edit" size="mini" @click="showEditAndSendInviteResponseDialog('response', scope.row)") template(#footer) @@ -2704,7 +2704,7 @@ html el-table-column(label="Cool Down" prop="updatedAt" sortable="custom" width="110" align="right") template(v-once #default="scope") countdown-timer(:datetime="scope.row.updatedAt" :hours="1") - el-table-column(label="Action" width="60" align="right") + el-table-column(label="Action" width="70" align="right") template(v-once #default="scope") el-button(type="text" icon="el-icon-edit" size="mini" @click="showEditAndSendInviteResponseDialog('requestResponse', scope.row)") template(#footer) @@ -2729,7 +2729,7 @@ html el-table-column(label="Cool Down" prop="updatedAt" sortable="custom" width="110" align="right") template(v-once #default="scope") countdown-timer(:datetime="scope.row.updatedAt" :hours="1") - el-table-column(label="Action" width="60" align="right") + el-table-column(label="Action" width="70" align="right") template(v-once #default="scope") el-button(type="text" icon="el-icon-edit" size="mini" @click="showEditAndSendInviteDialog('message', scope.row)") template(#footer) @@ -2746,7 +2746,7 @@ html el-table-column(label="Cool Down" prop="updatedAt" sortable="custom" width="110" align="right") template(v-once #default="scope") countdown-timer(:datetime="scope.row.updatedAt" :hours="1") - el-table-column(label="Action" width="60" align="right") + el-table-column(label="Action" width="70" align="right") template(v-once #default="scope") el-button(type="text" icon="el-icon-edit" size="mini" @click="showEditAndSendInviteDialog('request', scope.row)") template(#footer)