mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Log watcher init after browser
This commit is contained in:
+30
-22
@@ -33,8 +33,9 @@ namespace VRCX
|
|||||||
private ReaderWriterLockSlim m_LogListLock;
|
private ReaderWriterLockSlim m_LogListLock;
|
||||||
private bool m_FirstRun = true;
|
private bool m_FirstRun = true;
|
||||||
private bool m_ResetLog;
|
private bool m_ResetLog;
|
||||||
private Thread m_Thread;
|
private bool threadActive;
|
||||||
private DateTime tillDate = DateTime.UtcNow;
|
private Thread? m_Thread;
|
||||||
|
private DateTime tillDate;
|
||||||
public bool VrcClosedGracefully;
|
public bool VrcClosedGracefully;
|
||||||
private readonly ConcurrentQueue<string> m_LogQueue = new ConcurrentQueue<string>(); // for electron
|
private readonly ConcurrentQueue<string> m_LogQueue = new ConcurrentQueue<string>(); // for electron
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ namespace VRCX
|
|||||||
|
|
||||||
public void Exit()
|
public void Exit()
|
||||||
{
|
{
|
||||||
|
threadActive = false;
|
||||||
var thread = m_Thread;
|
var thread = m_Thread;
|
||||||
m_Thread = null;
|
m_Thread = null;
|
||||||
thread.Interrupt();
|
thread.Interrupt();
|
||||||
@@ -77,6 +79,7 @@ namespace VRCX
|
|||||||
public void SetDateTill(string date)
|
public void SetDateTill(string date)
|
||||||
{
|
{
|
||||||
tillDate = DateTime.Parse(date, CultureInfo.InvariantCulture, DateTimeStyles.None).ToUniversalTime();
|
tillDate = DateTime.Parse(date, CultureInfo.InvariantCulture, DateTimeStyles.None).ToUniversalTime();
|
||||||
|
threadActive = true;
|
||||||
logger.Info("SetDateTill: {0}", tillDate.ToLocalTime());
|
logger.Info("SetDateTill: {0}", tillDate.ToLocalTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +87,8 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
while (m_Thread != null)
|
while (m_Thread != null)
|
||||||
{
|
{
|
||||||
Update();
|
if (threadActive)
|
||||||
|
Update();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -130,15 +134,11 @@ namespace VRCX
|
|||||||
foreach (var fileInfo in fileInfos)
|
foreach (var fileInfo in fileInfos)
|
||||||
{
|
{
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
if (fileInfo.Exists == false)
|
if (!fileInfo.Exists)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (DateTime.Compare(fileInfo.LastWriteTimeUtc, tillDate) < 0)
|
if (DateTime.Compare(fileInfo.LastWriteTimeUtc, tillDate) < 0)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_LogContextMap.TryGetValue(fileInfo.Name, out var logContext))
|
if (m_LogContextMap.TryGetValue(fileInfo.Name, out var logContext))
|
||||||
{
|
{
|
||||||
@@ -151,9 +151,7 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (logContext.Length == fileInfo.Length)
|
if (logContext.Length == fileInfo.Length)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
logContext.Length = fileInfo.Length;
|
logContext.Length = fileInfo.Length;
|
||||||
ParseLog(fileInfo, logContext);
|
ParseLog(fileInfo, logContext);
|
||||||
@@ -491,14 +489,19 @@ namespace VRCX
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
||||||
|
if (string.IsNullOrEmpty(userInfo.DisplayName) && string.IsNullOrEmpty(userInfo.UserId))
|
||||||
|
{
|
||||||
|
logger.Warn("Failed to parse user info from log line: {0}", line);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
AppendLog(new[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
fileInfo.Name,
|
fileInfo.Name,
|
||||||
ConvertLogTimeToISO8601(line),
|
ConvertLogTimeToISO8601(line),
|
||||||
"player-joined",
|
"player-joined",
|
||||||
userInfo.DisplayName,
|
userInfo.DisplayName ?? string.Empty,
|
||||||
userInfo.UserId
|
userInfo.UserId ?? string.Empty
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -514,14 +517,19 @@ namespace VRCX
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
||||||
|
if (string.IsNullOrEmpty(userInfo.DisplayName) && string.IsNullOrEmpty(userInfo.UserId))
|
||||||
|
{
|
||||||
|
logger.Warn("Failed to parse user info from log line: {0}", line);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
AppendLog(new[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
fileInfo.Name,
|
fileInfo.Name,
|
||||||
ConvertLogTimeToISO8601(line),
|
ConvertLogTimeToISO8601(line),
|
||||||
"player-left",
|
"player-left",
|
||||||
userInfo.DisplayName,
|
userInfo.DisplayName ?? string.Empty,
|
||||||
userInfo.UserId
|
userInfo.UserId ?? string.Empty
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -621,7 +629,7 @@ namespace VRCX
|
|||||||
|
|
||||||
// 2024.07.31 22:28:47 Error - [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.
|
// 2024.07.31 22:28:47 Error - [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.
|
||||||
// 2024.07.31 23:04:15 Error - [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.
|
// 2024.07.31 23:04:15 Error - [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.
|
||||||
|
|
||||||
// 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website.
|
// 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website.
|
||||||
const string youtubeBotError = "Sign in to confirm you’re not a bot";
|
const string youtubeBotError = "Sign in to confirm you’re not a bot";
|
||||||
const string youtubeBotErrorFixUrl = "[VRCX]: We've made a program to help with this error, you can grab it from here: https://github.com/EllyVR/VRCVideoCacher";
|
const string youtubeBotErrorFixUrl = "[VRCX]: We've made a program to help with this error, you can grab it from here: https://github.com/EllyVR/VRCVideoCacher";
|
||||||
@@ -651,7 +659,7 @@ namespace VRCX
|
|||||||
var data = line.Substring(offset + 20);
|
var data = line.Substring(offset + 20);
|
||||||
if (!logContext.VideoPlaybackErrors.Add(data))
|
if (!logContext.VideoPlaybackErrors.Add(data))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (data.Contains(youtubeBotError))
|
if (data.Contains(youtubeBotError))
|
||||||
data = $"{youtubeBotErrorFixUrl}\n{data}";
|
data = $"{youtubeBotErrorFixUrl}\n{data}";
|
||||||
|
|
||||||
@@ -668,7 +676,7 @@ namespace VRCX
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ParseUntrustedUrl(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
private bool ParseUntrustedUrl(FileInfo fileInfo, LogContext logContext, string line, int offset)
|
||||||
{
|
{
|
||||||
// 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website.
|
// 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website.
|
||||||
@@ -678,7 +686,7 @@ namespace VRCX
|
|||||||
var data = line.Substring(offset);
|
var data = line.Substring(offset);
|
||||||
if (!logContext.VideoPlaybackErrors.Add(data))
|
if (!logContext.VideoPlaybackErrors.Add(data))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AppendLog(new[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
fileInfo.Name,
|
fileInfo.Name,
|
||||||
@@ -686,7 +694,7 @@ namespace VRCX
|
|||||||
"event",
|
"event",
|
||||||
"VideoError: " + data
|
"VideoError: " + data
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1392,10 +1400,10 @@ namespace VRCX
|
|||||||
return new string[][] { };
|
return new string[][] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
private static (string DisplayName, string UserId) ParseUserInfo(string userInfo)
|
private static (string? DisplayName, string? UserId) ParseUserInfo(string userInfo)
|
||||||
{
|
{
|
||||||
string userDisplayName;
|
string? userDisplayName;
|
||||||
string userId;
|
string? userId;
|
||||||
|
|
||||||
int pos = userInfo.LastIndexOf(" (", StringComparison.Ordinal);
|
int pos = userInfo.LastIndexOf(" (", StringComparison.Ordinal);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
|
|||||||
@@ -951,7 +951,6 @@ export default class extends baseClass {
|
|||||||
|
|
||||||
async updateGameLog(dateTill) {
|
async updateGameLog(dateTill) {
|
||||||
await gameLogService.setDateTill(dateTill);
|
await gameLogService.setDateTill(dateTill);
|
||||||
await gameLogService.reset();
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
workerTimers.setTimeout(resolve, 10000);
|
workerTimers.setTimeout(resolve, 10000);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user