From 068336cfbd976075b084bf9ffdb3241ec594c6e0 Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Sun, 3 Nov 2024 07:20:27 +0100 Subject: [PATCH] Fix for new vrc log format. Bumped patch version. --- CHANGELOG.md | 6 +++++ package.json | 2 +- src-core/Cargo.lock | 4 +-- src-core/Cargo.toml | 2 +- src-core/tauri.conf.json | 6 ++--- src-elevated-sidecar/Cargo.toml | 2 +- src-overlay-ui/package.json | 2 +- src-shared-rust/Cargo.toml | 2 +- src-shared-ts/package.json | 2 +- src-ui/app/models/vrchat-log-event.ts | 2 ++ src-ui/app/services/vrchat-log.service.ts | 33 ++++++++++++++++++++--- src-ui/app/services/vrchat.service.ts | 4 +-- 12 files changed, 50 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bacf67a..a2f5513c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.14.6] + +### Fixed + +- Fixed parsing of new VRChat join/leave log format + ## [1.14.5] ### Fixed diff --git a/package.json b/package.json index 1b88d915..1369e0c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oyasumi", - "version": "1.14.5", + "version": "1.14.6", "author": "Raphiiko", "license": "MIT", "type": "module", diff --git a/src-core/Cargo.lock b/src-core/Cargo.lock index 7a78c78c..e42f9268 100644 --- a/src-core/Cargo.lock +++ b/src-core/Cargo.lock @@ -4197,7 +4197,7 @@ dependencies = [ [[package]] name = "oyasumivr" -version = "1.14.5" +version = "1.14.6" dependencies = [ "async-recursion", "bluest", @@ -4270,7 +4270,7 @@ dependencies = [ [[package]] name = "oyasumivr-shared" -version = "1.14.5" +version = "1.14.6" dependencies = [ "winapi", ] diff --git a/src-core/Cargo.toml b/src-core/Cargo.toml index 10bdc485..df194659 100644 --- a/src-core/Cargo.toml +++ b/src-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr" -version = "1.14.5" +version = "1.14.6" description = "" authors = ["Raphiiko"] license = "MIT" diff --git a/src-core/tauri.conf.json b/src-core/tauri.conf.json index 570a6ea7..5eb01180 100644 --- a/src-core/tauri.conf.json +++ b/src-core/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "OyasumiVR", - "version": "1.14.5" + "version": "1.14.6" }, "tauri": { "allowlist": { @@ -201,7 +201,7 @@ "center": true, "theme": "Dark", "transparent": true, - "userAgent": "OyasumiVR/1.14.5 (https://github.com/Raphiiko/OyasumiVR)" + "userAgent": "OyasumiVR/1.14.6 (https://github.com/Raphiiko/OyasumiVR)" }, { "width": 700, @@ -216,7 +216,7 @@ "skipTaskbar": true, "minimizable": false, "alwaysOnTop": true, - "userAgent": "OyasumiVR/1.14.5 (https://github.com/Raphiiko/OyasumiVR)" + "userAgent": "OyasumiVR/1.14.6 (https://github.com/Raphiiko/OyasumiVR)" } ] } diff --git a/src-elevated-sidecar/Cargo.toml b/src-elevated-sidecar/Cargo.toml index b1245a4f..7aef8915 100644 --- a/src-elevated-sidecar/Cargo.toml +++ b/src-elevated-sidecar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr-elevated-sidecar" -version = "1.14.5" +version = "1.14.6" authors = ["Raphiiko"] license = "MIT" edition = "2021" diff --git a/src-overlay-ui/package.json b/src-overlay-ui/package.json index 0e9a48bb..9bc9cff3 100644 --- a/src-overlay-ui/package.json +++ b/src-overlay-ui/package.json @@ -1,6 +1,6 @@ { "name": "oyasumivr-overlay-ui", - "version": "1.14.5", + "version": "1.14.6", "private": true, "scripts": { "dev": "vite dev", diff --git a/src-shared-rust/Cargo.toml b/src-shared-rust/Cargo.toml index f2a0c264..594a5e16 100644 --- a/src-shared-rust/Cargo.toml +++ b/src-shared-rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr-shared" -version = "1.14.5" +version = "1.14.6" authors = ["Raphiiko"] edition = "2021" license = "MIT" diff --git a/src-shared-ts/package.json b/src-shared-ts/package.json index 3909622d..2d93fe7f 100644 --- a/src-shared-ts/package.json +++ b/src-shared-ts/package.json @@ -2,7 +2,7 @@ "name": "src-shared-ts", "description": "Shared typescript code for Oyasumi modules", "scripts": {}, - "version": "1.14.5", + "version": "1.14.6", "author": "Raphiiko", "license": "MIT", "type": "module", diff --git a/src-ui/app/models/vrchat-log-event.ts b/src-ui/app/models/vrchat-log-event.ts index 57ba5b95..326641ba 100644 --- a/src-ui/app/models/vrchat-log-event.ts +++ b/src-ui/app/models/vrchat-log-event.ts @@ -14,11 +14,13 @@ interface VRChatLogEventBase { export interface VRChatOnPlayerJoinedEvent extends VRChatLogEventBase { type: 'OnPlayerJoined'; displayName: string; + userId: string; } export interface VRChatOnPlayerLeftEvent extends VRChatLogEventBase { type: 'OnPlayerLeft'; displayName: string; + userId: string; } export interface VRChatOnLocationChangeEvent extends VRChatLogEventBase { diff --git a/src-ui/app/services/vrchat-log.service.ts b/src-ui/app/services/vrchat-log.service.ts index 0f8d928e..178f1336 100644 --- a/src-ui/app/services/vrchat-log.service.ts +++ b/src-ui/app/services/vrchat-log.service.ts @@ -33,22 +33,28 @@ export class VRChatLogService { case 'InitialLoadComplete': this._initialLoadComplete.next(true); break; - case 'OnPlayerJoined': + case 'OnPlayerJoined': { + const { displayName, userId } = this.parseNameAndId(event.data); this._logEvents.next({ type: 'OnPlayerJoined', timestamp: moment.unix(event.time).toDate(), - displayName: event.data, initialLoad: event.initialLoad, + displayName, + userId, }); break; - case 'OnPlayerLeft': + } + case 'OnPlayerLeft': { + const { displayName, userId } = this.parseNameAndId(event.data); this._logEvents.next({ type: 'OnPlayerLeft', timestamp: moment.unix(event.time).toDate(), - displayName: event.data, initialLoad: event.initialLoad, + displayName, + userId, }); break; + } case 'OnLocationChange': this._logEvents.next({ type: 'OnLocationChange', @@ -58,4 +64,23 @@ export class VRChatLogService { }); } } + + private parseNameAndId(data: string): { displayName: string; userId: string } { + const parts = data.split(' '); + if ( + parts.length > 1 && + parts[parts.length - 1].startsWith('(') && + parts[parts.length - 1].endsWith(')') + ) { + return { + displayName: parts.slice(0, parts.length - 1).join(' '), + userId: parts[parts.length - 1].slice(1, -1), + }; + } else { + return { + displayName: data, + userId: '', + }; + } + } } diff --git a/src-ui/app/services/vrchat.service.ts b/src-ui/app/services/vrchat.service.ts index 7390225d..b88782ba 100644 --- a/src-ui/app/services/vrchat.service.ts +++ b/src-ui/app/services/vrchat.service.ts @@ -690,7 +690,7 @@ export class VRChatService { ...structuredClone(this._world.value), playerCount: this._world.value.playerCount + 1, }; - if (event.displayName === this._user.value?.displayName) context.loaded = true; + if (event.userId === this._user.value?.id) context.loaded = true; this._world.next(context); break; } @@ -699,7 +699,7 @@ export class VRChatService { ...structuredClone(this._world.value), playerCount: Math.max(this._world.value.playerCount - 1, 0), }; - if (event.displayName === this._user.value?.displayName) context.loaded = false; + if (event.userId === this._user.value?.id) context.loaded = false; this._world.next(context); break; }