Skip to content

Commit

Permalink
Fix for new vrc log format. Bumped patch version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Nov 3, 2024
1 parent f3950e5 commit 068336c
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oyasumi",
"version": "1.14.5",
"version": "1.14.6",
"author": "Raphiiko",
"license": "MIT",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oyasumivr"
version = "1.14.5"
version = "1.14.6"
description = ""
authors = ["Raphiiko"]
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions src-core/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"package": {
"productName": "OyasumiVR",
"version": "1.14.5"
"version": "1.14.6"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -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,
Expand All @@ -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)"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion src-elevated-sidecar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oyasumivr-elevated-sidecar"
version = "1.14.5"
version = "1.14.6"
authors = ["Raphiiko"]
license = "MIT"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion src-overlay-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oyasumivr-overlay-ui",
"version": "1.14.5",
"version": "1.14.6",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
2 changes: 1 addition & 1 deletion src-shared-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oyasumivr-shared"
version = "1.14.5"
version = "1.14.6"
authors = ["Raphiiko"]
edition = "2021"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src-shared-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src-ui/app/models/vrchat-log-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
33 changes: 29 additions & 4 deletions src-ui/app/services/vrchat-log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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: '',
};
}
}
}
4 changes: 2 additions & 2 deletions src-ui/app/services/vrchat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 068336c

Please sign in to comment.