diff --git a/AppApi.cs b/AppApi.cs index b0926057..712880d2 100644 --- a/AppApi.cs +++ b/AppApi.cs @@ -425,6 +425,15 @@ namespace VRCX WinformThemer.DoFunny(); } + public double GetUptime() + { + using (var uptime = new PerformanceCounter("System", "System Up Time")) + { + uptime.NextValue(); + return TimeSpan.FromSeconds(uptime.NextValue()).TotalMilliseconds; + } + } + public void SetStartup(bool enabled) { try diff --git a/html/src/app.js b/html/src/app.js index 3e2f1bbf..c29f24c8 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -10427,11 +10427,10 @@ speechSynthesis.getVoices(); this.favoriteAvatarsSorted.push(ctx); this.sortFavoriteAvatars = true; } - } else { - if (type === 'friend') { - this.favoriteFriends_.push(ctx); - this.favoriteFriendsSorted.push(ctx); - this.sortFavoriteFriends = true; + } else if (type === 'friend') { + this.favoriteFriends_.push(ctx); + this.favoriteFriendsSorted.push(ctx); + this.sortFavoriteFriends = true; } else if (type === 'world') { this.favoriteWorlds_.push(ctx); this.favoriteWorldsSorted.push(ctx); @@ -10439,8 +10438,7 @@ speechSynthesis.getVoices(); } else if (type === 'avatar') { this.favoriteAvatars_.push(ctx); this.favoriteAvatarsSorted.push(ctx); - this.sortFavoriteAvatars = true; - } + this.sortFavoriteAvatars = true; } } } else if (typeof ctx !== 'undefined') { @@ -11284,6 +11282,7 @@ speechSynthesis.getVoices(); $app.data.hideUptimeFromFeed = configRepository.getBool( 'VRCX_hideUptimeFromFeed' ); + $app.data.pcUptimeOnFeed = configRepository.getBool('VRCX_pcUptimeOnFeed'); $app.data.overlayNotifications = configRepository.getBool( 'VRCX_overlayNotifications' ); @@ -11361,6 +11360,7 @@ speechSynthesis.getVoices(); 'VRCX_hideUptimeFromFeed', this.hideUptimeFromFeed ); + configRepository.setBool('VRCX_pcUptimeOnFeed', this.pcUptimeOnFeed); configRepository.setBool( 'VRCX_overlayNotifications', this.overlayNotifications @@ -11819,7 +11819,8 @@ speechSynthesis.getVoices(); notificationTimeout: this.notificationTimeout, notificationTheme, backgroundEnabled: this.vrBackgroundEnabled, - dtHour12: this.dtHour12 + dtHour12: this.dtHour12, + pcUptimeOnFeed: this.pcUptimeOnFeed }; var json = JSON.stringify(VRConfigVars); AppApi.ExecuteVrFeedFunction('configUpdate', json); diff --git a/html/src/index.pug b/html/src/index.pug index 5fe18cc0..9fb89581 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -1080,6 +1080,9 @@ html div.options-container-item span.name Hide Uptime el-switch(v-model="hideUptimeFromFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist") + div.options-container-item + span.name Show PC Uptime + el-switch(v-model="pcUptimeOnFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist") div.options-container-item el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog" :disabled="!openVR || !overlayWrist") Wrist Feed Filters br diff --git a/html/src/vr.js b/html/src/vr.js index 3f8a8d48..ecccf96e 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -161,6 +161,7 @@ Vue.component('marquee-text', MarqueeText); appType: location.href.substr(-1), currentTime: new Date().toJSON(), cpuUsage: 0, + pcUptime: '', config: {}, photonLobbyBotSize: 0, onlineFriendCount: 0, @@ -364,6 +365,13 @@ Vue.component('marquee-text', MarqueeText); } else { this.devices = ''; } + if (this.config.pcUptimeOnFeed) { + AppApi.GetUptime().then((uptime) => { + this.pcUptime = timeToText(uptime); + }); + } else { + this.pcUptime = ''; + } } catch (err) { console.error(err); } diff --git a/html/src/vr.pug b/html/src/vr.pug index 9a212faf..9a424e7d 100644 --- a/html/src/vr.pug +++ b/html/src/vr.pug @@ -403,6 +403,8 @@ html span(style="float:right") {{ lastLocationTimer }} template(v-if="onlineForTimer") | / {{ onlineForTimer }} + template(v-if="pcUptime") + | / {{ pcUptime }} span(style="display:inline-block") {{ lastLocation.playerList.length }} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? `‎‎‎‎‎‎‎‎‏‏‎ ‎(${lastLocation.friendList.length})` : ''}} span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }} @@ -410,6 +412,8 @@ html span(style="float:right") Timer: {{ lastLocationTimer }} template(v-if="onlineForTimer") | / {{ onlineForTimer }} + template(v-if="pcUptime") + | / {{ pcUptime }} span(style="display:inline-block") Players: {{ lastLocation.playerList.length }} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? `‎‎‎‎‎‎‎‎‏‏‎ ‎(${lastLocation.friendList.length})` : ''}} span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }}