Small fixes

This commit is contained in:
Natsumi
2025-01-04 02:57:28 +13:00
parent bafbcfacb2
commit 60f59b9baa
5 changed files with 168 additions and 129 deletions
+3 -7
View File
@@ -26,11 +26,10 @@ namespace VRCX
{ {
var isGameRunning = false; var isGameRunning = false;
var isSteamVRRunning = false; var isSteamVRRunning = false;
var isHmdAfk = false;
if (ProcessMonitor.Instance.IsProcessRunning("VRChat")) if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
{
isGameRunning = true; isGameRunning = true;
}
if (Wine.GetIfWine()) if (Wine.GetIfWine())
{ {
@@ -39,18 +38,15 @@ namespace VRCX
{ {
var wineTmp = File.ReadAllText(wineTmpPath); var wineTmp = File.ReadAllText(wineTmpPath);
if (wineTmp.Contains("isGameRunning=true")) if (wineTmp.Contains("isGameRunning=true"))
{
isGameRunning = true; isGameRunning = true;
} }
} }
}
if (ProcessMonitor.Instance.IsProcessRunning("vrserver")) if (ProcessMonitor.Instance.IsProcessRunning("vrserver"))
{
isSteamVRRunning = true; isSteamVRRunning = true;
}
var isHmdAfk = Program.VRCXVRInstance.IsHmdAfk; if (Program.VRCXVRInstance != null)
isHmdAfk = Program.VRCXVRInstance.IsHmdAfk;
// TODO: fix this throwing an exception for being called before the browser is ready. somehow it gets past the checks // TODO: fix this throwing an exception for being called before the browser is ready. somehow it gets past the checks
if (MainForm.Instance?.Browser != null && !MainForm.Instance.Browser.IsLoading && MainForm.Instance.Browser.CanExecuteJavascriptInMainFrame) if (MainForm.Instance?.Browser != null && !MainForm.Instance.Browser.IsLoading && MainForm.Instance.Browser.CanExecuteJavascriptInMainFrame)
+38 -29
View File
@@ -172,16 +172,15 @@ namespace VRCX
/// <param name="logContext">The log context to update.</param> /// <param name="logContext">The log context to update.</param>
private void ParseLog(FileInfo fileInfo, LogContext logContext) private void ParseLog(FileInfo fileInfo, LogContext logContext)
{ {
var line = string.Empty;
try try
{ {
using (var stream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 65536, FileOptions.SequentialScan)) using var stream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 65536, FileOptions.SequentialScan);
{
stream.Position = logContext.Position; stream.Position = logContext.Position;
using (var streamReader = new StreamReader(stream, Encoding.UTF8)) using var streamReader = new StreamReader(stream, Encoding.UTF8);
{
while (true) while (true)
{ {
var line = streamReader.ReadLine(); line = streamReader.ReadLine();
if (line == null) if (line == null)
{ {
logContext.Position = stream.Position; logContext.Position = stream.Position;
@@ -217,6 +216,7 @@ namespace VRCX
// check if date is older than last database entry // check if date is older than last database entry
if (DateTime.Compare(lineDate, tillDate) <= 0) if (DateTime.Compare(lineDate, tillDate) <= 0)
{ {
// logger.Warn("Invalid log time, too old: {0}", line);
continue; continue;
} }
// check if datetime is over an hour into the future (compensate for gamelog not handling daylight savings time correctly) // check if datetime is over an hour into the future (compensate for gamelog not handling daylight savings time correctly)
@@ -277,11 +277,9 @@ namespace VRCX
} }
} }
} }
}
}
catch (Exception ex) catch (Exception ex)
{ {
logger.Warn("Failed to parse log file: {0} {1}", fileInfo.FullName, ex.Message); logger.Warn(ex, "Failed to parse log file: {0} {1} {2}", fileInfo.FullName, line, ex.Message);
} }
} }
@@ -341,7 +339,7 @@ namespace VRCX
if (line.Contains("[Behaviour] Entering Room: ")) if (line.Contains("[Behaviour] Entering Room: "))
{ {
var lineOffset = line.LastIndexOf("] Entering Room: "); var lineOffset = line.LastIndexOf("] Entering Room: ", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 17; lineOffset += 17;
@@ -355,7 +353,7 @@ namespace VRCX
if (line.Contains("[Behaviour] 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 "); var lineOffset = line.LastIndexOf("] Joining ", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 10; lineOffset += 10;
@@ -393,12 +391,18 @@ namespace VRCX
if (!line.Contains("[VRC Camera] Took screenshot to: ")) if (!line.Contains("[VRC Camera] Took screenshot to: "))
return false; return false;
var lineOffset = line.LastIndexOf("] Took screenshot to: "); var lineOffset = line.LastIndexOf("] Took screenshot to: ", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
var screenshotPath = line.Substring(lineOffset + 22); var screenshotPath = line.Substring(lineOffset + 22);
AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), "screenshot", screenshotPath }); AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"screenshot",
screenshotPath
});
return true; return true;
} }
@@ -426,7 +430,7 @@ namespace VRCX
if (line.Contains("[Behaviour] Destination fetching: ")) if (line.Contains("[Behaviour] Destination fetching: "))
{ {
var lineOffset = line.LastIndexOf("] Destination fetching: "); var lineOffset = line.LastIndexOf("] Destination fetching: ", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 24; lineOffset += 24;
@@ -485,7 +489,7 @@ namespace VRCX
if (line.Contains("[Behaviour] OnPlayerLeft") && !line.Contains("] OnPlayerLeftRoom") && !line.Contains("] OnPlayerLeft:")) if (line.Contains("[Behaviour] OnPlayerLeft") && !line.Contains("] OnPlayerLeftRoom") && !line.Contains("] OnPlayerLeft:"))
{ {
var lineOffset = line.LastIndexOf("] OnPlayerLeft"); var lineOffset = line.LastIndexOf("] OnPlayerLeft", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 15; lineOffset += 15;
@@ -680,7 +684,7 @@ namespace VRCX
if (string.Compare(line, offset, "[Video Playback] Attempting to resolve URL '", 0, 44, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[Video Playback] Attempting to resolve URL '", 0, 44, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf("'"); var pos = line.LastIndexOf('\'');
if (pos < 0) if (pos < 0)
return false; return false;
@@ -705,7 +709,7 @@ namespace VRCX
if (string.Compare(line, offset, "[Video Playback] Resolving URL '", 0, 32, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[Video Playback] Resolving URL '", 0, 32, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf("'"); var pos = line.LastIndexOf('\'');
if (pos < 0) if (pos < 0)
return false; return false;
@@ -730,7 +734,7 @@ namespace VRCX
if (string.Compare(line, offset, "User ", 0, 5, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "User ", 0, 5, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf(" added URL "); var pos = line.LastIndexOf(" added URL ", StringComparison.Ordinal);
if (pos < 0) if (pos < 0)
return false; return false;
@@ -756,7 +760,7 @@ namespace VRCX
if (string.Compare(line, offset, "[USharpVideo] Started video load for URL: ", 0, 42, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[USharpVideo] Started video load for URL: ", 0, 42, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf(", requested by "); var pos = line.LastIndexOf(", requested by ", StringComparison.Ordinal);
if (pos < 0) if (pos < 0)
return false; return false;
@@ -802,7 +806,7 @@ namespace VRCX
if (string.Compare(line, offset, "[API] Received Notification: <", 0, 30, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[API] Received Notification: <", 0, 30, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf("> received at "); var pos = line.LastIndexOf("> received at ", StringComparison.Ordinal);
if (pos < 0) if (pos < 0)
return false; return false;
@@ -827,7 +831,7 @@ namespace VRCX
if (string.Compare(line, offset, "[API] [", 0, 7, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[API] [", 0, 7, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf("] Sending Get request to "); var pos = line.LastIndexOf("] Sending Get request to ", StringComparison.Ordinal);
if (pos < 0) if (pos < 0)
return false; return false;
@@ -851,7 +855,7 @@ namespace VRCX
if (string.Compare(line, offset, "[Behaviour] Switching ", 0, 22, StringComparison.Ordinal) != 0) if (string.Compare(line, offset, "[Behaviour] Switching ", 0, 22, StringComparison.Ordinal) != 0)
return false; return false;
var pos = line.LastIndexOf(" to avatar "); var pos = line.LastIndexOf(" to avatar ", StringComparison.Ordinal);
if (pos < 0) if (pos < 0)
return false; return false;
@@ -972,6 +976,7 @@ namespace VRCX
// 2022.03.15 03:40:34 Log - [Always] uSpeak: SetInputDevice 0 (3 total) 'Index HMD Mic (Valve VR Radio & HMD Mic)' // 2022.03.15 03:40:34 Log - [Always] uSpeak: SetInputDevice 0 (3 total) 'Index HMD Mic (Valve VR Radio & HMD Mic)'
// 2022.03.15 04:02:22 Log - [Always] uSpeak: OnAudioConfigurationChanged - devicesChanged = True, resetting mic.. // 2022.03.15 04:02:22 Log - [Always] uSpeak: OnAudioConfigurationChanged - devicesChanged = True, resetting mic..
// 2022.03.15 04:02:22 Log - [Always] uSpeak: SetInputDevice by name 'Index HMD Mic (Valve VR Radio & HMD Mic)' (3 total) // 2022.03.15 04:02:22 Log - [Always] uSpeak: SetInputDevice by name 'Index HMD Mic (Valve VR Radio & HMD Mic)' (3 total)
// 2025.01.03 19:11:42 Log - [Always] uSpeak: SetInputDevice 0 (2 total) 'Microphone (NVIDIA Broadcast)'
if (line.Contains("[Always] uSpeak: OnAudioConfigurationChanged")) if (line.Contains("[Always] uSpeak: OnAudioConfigurationChanged"))
{ {
@@ -981,12 +986,16 @@ namespace VRCX
if (line.Contains("[Always] uSpeak: SetInputDevice 0")) if (line.Contains("[Always] uSpeak: SetInputDevice 0"))
{ {
var lineOffset = line.LastIndexOf(") '"); var lineOffset = line.LastIndexOf(") '", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
lineOffset += 3; lineOffset += 3;
var endPos = line.Length - 1; var endPos = line.Length - 1;
var audioDevice = line.Substring(lineOffset, endPos - lineOffset); var length = Math.Min(endPos - lineOffset + 1, line.Length - lineOffset);
if (length <= 0)
return true;
var audioDevice = line.Substring(lineOffset, length);
if (string.IsNullOrEmpty(logContext.LastAudioDevice)) if (string.IsNullOrEmpty(logContext.LastAudioDevice))
{ {
logContext.AudioDeviceChanged = false; logContext.AudioDeviceChanged = false;
@@ -1031,7 +1040,7 @@ namespace VRCX
return true; return true;
} }
var lineOffset = line.IndexOf(" ---> VRC.Udon.VM.UdonVMException: "); var lineOffset = line.IndexOf(" ---> VRC.Udon.VM.UdonVMException: ", StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return false; return false;
@@ -1115,7 +1124,7 @@ namespace VRCX
if (!line.Contains(check)) if (!line.Contains(check))
return false; return false;
var lineOffset = line.LastIndexOf(check); var lineOffset = line.LastIndexOf(check, StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
@@ -1142,7 +1151,7 @@ namespace VRCX
if (!line.Contains(check)) if (!line.Contains(check))
return false; return false;
var lineOffset = line.LastIndexOf(check); var lineOffset = line.LastIndexOf(check, StringComparison.Ordinal);
if (lineOffset < 0) if (lineOffset < 0)
return true; return true;
@@ -1220,7 +1229,7 @@ namespace VRCX
if (!line.Contains("[ModerationManager] This instance will be reset in ")) if (!line.Contains("[ModerationManager] This instance will be reset in "))
return false; return false;
int index = line.IndexOf("[ModerationManager] This instance will be reset in ") + 20; int index = line.IndexOf("[ModerationManager] This instance will be reset in ", StringComparison.Ordinal) + 20;
AppendLog(new[] AppendLog(new[]
{ {
@@ -1273,7 +1282,7 @@ namespace VRCX
private bool ParseStickerSpawn(FileInfo fileInfo, LogContext logContext, string line, int offset) private bool ParseStickerSpawn(FileInfo fileInfo, LogContext logContext, string line, int offset)
{ {
var index = line.IndexOf("[StickersManager] User "); var index = line.IndexOf("[StickersManager] User ", StringComparison.Ordinal);
if (index == -1 || !line.Contains("file_") || !line.Contains("spawned sticker")) if (index == -1 || !line.Contains("file_") || !line.Contains("spawned sticker"))
return false; return false;
@@ -1281,7 +1290,7 @@ namespace VRCX
var (userId, displayName) = ParseUserInfo(info); var (userId, displayName) = ParseUserInfo(info);
var fileIdIndex = info.IndexOf("file_"); var fileIdIndex = info.IndexOf("file_", StringComparison.Ordinal);
string fileId = info.Substring(fileIdIndex); string fileId = info.Substring(fileIdIndex);
AppendLog(new[] AppendLog(new[]
+1 -1
View File
@@ -135,7 +135,7 @@ namespace VRCX
if (startIndex >= 0) if (startIndex >= 0)
{ {
startIndex += "filename=".Length; startIndex += "filename=".Length;
int endIndex = contentDisposition.IndexOf(";", startIndex); int endIndex = contentDisposition.IndexOf(';', startIndex);
if (endIndex == -1) if (endIndex == -1)
{ {
endIndex = contentDisposition.Length; endIndex = contentDisposition.Length;
+34 -2
View File
@@ -611,6 +611,15 @@ speechSynthesis.getVoices();
$app.updateSharedFeed(false); $app.updateSharedFeed(false);
} }
} }
if (ref.isFriend || ref.id === this.currentUser.id) {
// update instancePlayerCount
var newCount = $app.instancePlayerCount.get(ref.location);
if (typeof newCount === 'undefined') {
newCount = 0;
}
newCount++;
$app.instancePlayerCount.set(ref.location, newCount);
}
if ($app.customUserTags.has(json.id)) { if ($app.customUserTags.has(json.id)) {
var tag = $app.customUserTags.get(json.id); var tag = $app.customUserTags.get(json.id);
ref.$customTag = tag.tag; ref.$customTag = tag.tag;
@@ -5550,6 +5559,7 @@ speechSynthesis.getVoices();
} }
}; };
$app.data.instancePlayerCount = new Map();
$app.data.robotUrl = `${API.endpointDomain}/file/file_0e8c4e32-7444-44ea-ade4-313c010d4bae/1/file`; $app.data.robotUrl = `${API.endpointDomain}/file/file_0e8c4e32-7444-44ea-ade4-313c010d4bae/1/file`;
API.$on('USER:UPDATE', async function (args) { API.$on('USER:UPDATE', async function (args) {
@@ -5558,6 +5568,26 @@ speechSynthesis.getVoices();
if (typeof friend === 'undefined') { if (typeof friend === 'undefined') {
return; return;
} }
if (props.location) {
// update instancePlayerCount
var previousLocation = props.location[1];
var newLocation = props.location[0];
var oldCount = $app.instancePlayerCount.get(previousLocation);
if (typeof oldCount !== 'undefined') {
oldCount--;
if (oldCount <= 0) {
$app.instancePlayerCount.delete(previousLocation);
} else {
$app.instancePlayerCount.set(previousLocation, oldCount);
}
}
var newCount = $app.instancePlayerCount.get(newLocation);
if (typeof newCount === 'undefined') {
newCount = 0;
}
newCount++;
$app.instancePlayerCount.set(newLocation, newCount);
}
if (props.location && ref.id === $app.userDialog.id) { if (props.location && ref.id === $app.userDialog.id) {
// update user dialog instance occupants // update user dialog instance occupants
$app.applyUserDialogLocation(true); $app.applyUserDialogLocation(true);
@@ -9373,11 +9403,13 @@ speechSynthesis.getVoices();
speechSynthesis.speak(tts); speechSynthesis.speak(tts);
}; };
$app.methods.refreshConfigTreeData = function () { $app.methods.refreshConfigTreeData = async function () {
await API.getConfig();
this.configTreeData = $utils.buildTreeData(API.cachedConfig); this.configTreeData = $utils.buildTreeData(API.cachedConfig);
}; };
$app.methods.refreshCurrentUserTreeData = function () { $app.methods.refreshCurrentUserTreeData = async function () {
await API.getCurrentUser();
this.currentUserTreeData = $utils.buildTreeData(API.currentUser); this.currentUserTreeData = $utils.buildTreeData(API.currentUser);
}; };
+2
View File
@@ -34,6 +34,8 @@ mixin friendsListTab()
el-button(type="text" size="mini" @click.stop) el-button(type="text" size="mini" @click.stop)
el-checkbox(v-model="scope.row.$selected" @change="friendsListBulkUnfriendForceUpdate++") el-checkbox(v-model="scope.row.$selected" @change="friendsListBulkUnfriendForceUpdate++")
el-table-column(:label="$t('table.friendList.no')" width="70" prop="$friendNumber" sortable="custom") el-table-column(:label="$t('table.friendList.no')" width="70" prop="$friendNumber" sortable="custom")
template(v-once #default="scope")
span {{ scope.row.$friendNumber ? scope.row.$friendNumber : '' }}
el-table-column(:label="$t('table.friendList.avatar')" width="70" prop="photo") el-table-column(:label="$t('table.friendList.avatar')" width="70" prop="photo")
template(v-once #default="scope") template(v-once #default="scope")
el-popover(placement="right" height="500px" trigger="hover") el-popover(placement="right" height="500px" trigger="hover")