diff --git a/html/src/app.js b/html/src/app.js
index 165d4c9f..e51d662b 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -1146,6 +1146,8 @@ speechSynthesis.getVoices();
json.state = API.currentUser.state;
json.last_login = API.currentUser.last_login;
json.location = ($app.isGameRunning === true) ? $app.lastLocation : '';
+ json.$online_for = API.currentUser.$online_for;
+ json.$offline_for = API.currentUser.$offline_for;
}
if (ref === undefined) {
ref = {
@@ -5774,6 +5776,19 @@ speechSynthesis.getVoices();
configRepository.setString('VRCX_notificationPosition', this.notificationPosition);
};
+ var isGameRunningStateChange = function () {
+ $app.lastLocation = '';
+ if (this.isGameRunning) {
+ API.currentUser.$online_for = Date.now();
+ API.currentUser.$offline_for = '';
+ }
+ else {
+ API.currentUser.$online_for = '';
+ API.currentUser.$offline_for = Date.now();
+ }
+ }
+ $app.watch.isGameRunning = isGameRunningStateChange;
+
API.$on('LOGIN', function () {
$app.currentUserTreeData = [];
$app.pastDisplayNameTable.data = [];
@@ -7760,7 +7775,7 @@ speechSynthesis.getVoices();
return arr.join(' ');
};
- if (ctx.ref.state === 'online') {
+ if ((ctx.ref.state === 'online') && (ctx.ref.$online_for)) {
return timeToText(Date.now() - ctx.ref.$online_for)
} else if (ctx.ref.$offline_for) {
return timeToText(Date.now() - ctx.ref.$offline_for)
diff --git a/html/src/index.pug b/html/src/index.pug
index f1a1df07..e17360f7 100644
--- a/html/src/index.pug
+++ b/html/src/index.pug
@@ -825,7 +825,7 @@ html
span.extra(v-else style="color:#F56C6C") Deny
.x-friend-item
.detail
- span.name(v-if="userDialog.ref.state === 'online'") Online For
+ span.name(v-if="userDialog.ref.state === 'online' && userDialog.ref.$online_for") Online For
span.name(v-else) Offline For
span.extra(v-text="userOnlineFor(userDialog)")
.x-friend-item