Massive commit that will break everything!

This commit is contained in:
Natsumi
2021-08-30 12:05:42 +12:00
parent 1eda658158
commit 2418d902cf
10 changed files with 1252 additions and 1212 deletions

View File

@@ -314,13 +314,28 @@ namespace VRCX
System.Environment.Exit(0); System.Environment.Exit(0);
} }
public bool checkForUpdateZip() public bool CheckForUpdateZip()
{ {
if (File.Exists(Path.Combine(Program.AppDataDirectory, "update.exe"))) if (File.Exists(Path.Combine(Program.AppDataDirectory, "update.exe")))
return true; return true;
return false; return false;
} }
public void ExecuteAppFunction(string function, string json)
{
MainForm.Instance.Browser.ExecuteScriptAsync($"$app.{function}", json);
}
public void ExecuteVrFeedFunction(string function, string json)
{
VRCXVR._browser1.ExecuteScriptAsync($"$app.{function}", json);
}
public void ExecuteVrOverlayFunction(string function, string json)
{
VRCXVR._browser2.ExecuteScriptAsync($"$app.{function}", json);
}
public void SetStartup(bool enabled) public void SetStartup(bool enabled)
{ {
try try

View File

@@ -3,6 +3,7 @@
// This work is licensed under the terms of the MIT license. // This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>. // For a copy, see <https://opensource.org/licenses/MIT>.
using CefSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@@ -30,6 +31,8 @@ namespace VRCX
private readonly List<string[]> m_LogList; private readonly List<string[]> m_LogList;
private Thread m_Thread; private Thread m_Thread;
private bool m_ResetLog; private bool m_ResetLog;
private bool m_FirstRun = true;
private static DateTime tillDate = DateTime.Now;
// NOTE // NOTE
// FileSystemWatcher() is unreliable // FileSystemWatcher() is unreliable
@@ -64,6 +67,17 @@ namespace VRCX
thread.Interrupt(); thread.Interrupt();
thread.Join(); thread.Join();
} }
public void Reset()
{
m_ResetLog = true;
m_Thread?.Interrupt();
}
public void SetDateTill(string date)
{
tillDate = DateTime.Parse(date);
}
private void ThreadLoop() private void ThreadLoop()
{ {
@@ -86,6 +100,7 @@ namespace VRCX
{ {
if (m_ResetLog == true) if (m_ResetLog == true)
{ {
m_FirstRun = true;
m_ResetLog = false; m_ResetLog = false;
m_LogContextMap.Clear(); m_LogContextMap.Clear();
m_LogListLock.EnterWriteLock(); m_LogListLock.EnterWriteLock();
@@ -109,26 +124,17 @@ namespace VRCX
// sort by creation time // sort by creation time
Array.Sort(fileInfos, (a, b) => a.CreationTimeUtc.CompareTo(b.CreationTimeUtc)); Array.Sort(fileInfos, (a, b) => a.CreationTimeUtc.CompareTo(b.CreationTimeUtc));
var utcNow = DateTime.UtcNow;
var minLimitDateTime = utcNow.AddDays(-7d);
var minRefreshDateTime = utcNow.AddMinutes(-3d);
foreach (var fileInfo in fileInfos) foreach (var fileInfo in fileInfos)
{ {
var lastWriteTimeUtc = fileInfo.LastWriteTimeUtc; fileInfo.Refresh();
if (fileInfo.Exists == false)
if (lastWriteTimeUtc < minLimitDateTime)
{ {
continue; continue;
} }
if (lastWriteTimeUtc >= minRefreshDateTime) if (DateTime.Compare(fileInfo.LastWriteTime, tillDate) < 0)
{ {
fileInfo.Refresh(); continue;
if (fileInfo.Exists == false)
{
continue;
}
} }
if (m_LogContextMap.TryGetValue(fileInfo.Name, out LogContext logContext) == true) if (m_LogContextMap.TryGetValue(fileInfo.Name, out LogContext logContext) == true)
@@ -155,6 +161,8 @@ namespace VRCX
{ {
m_LogContextMap.Remove(name); m_LogContextMap.Remove(name);
} }
m_FirstRun = false;
} }
private void ParseLog(FileInfo fileInfo, LogContext logContext) private void ParseLog(FileInfo fileInfo, LogContext logContext)
@@ -184,6 +192,20 @@ namespace VRCX
continue; continue;
} }
if (DateTime.TryParseExact(
line.Substring(0, 19),
"yyyy.MM.dd HH:mm:ss",
CultureInfo.InvariantCulture,
DateTimeStyles.AssumeLocal,
out DateTime lineDate
))
{
if (DateTime.Compare(lineDate, tillDate) <= 0)
{
continue;
}
}
var offset = 34; var offset = 34;
if (line[offset] == '[') if (line[offset] == '[')
{ {
@@ -194,7 +216,8 @@ namespace VRCX
ParseLogJoinBlocked(fileInfo, logContext, line, offset) == true || ParseLogJoinBlocked(fileInfo, logContext, line, offset) == true ||
ParseLogAvatarPedestalChange(fileInfo, logContext, line, offset) == true || ParseLogAvatarPedestalChange(fileInfo, logContext, line, offset) == true ||
ParseLogVideoError(fileInfo, logContext, line, offset) == true || ParseLogVideoError(fileInfo, logContext, line, offset) == true ||
ParseLogVideoPlay(fileInfo, logContext, line, offset) == true) ParseLogVideoPlay(fileInfo, logContext, line, offset) == true ||
ParseLogWorldVRCX(fileInfo, logContext, line, offset) == true)
{ {
continue; continue;
} }
@@ -221,6 +244,12 @@ namespace VRCX
m_LogListLock.EnterWriteLock(); m_LogListLock.EnterWriteLock();
try try
{ {
if (!m_FirstRun)
{
var logLine = System.Text.Json.JsonSerializer.Serialize(item);
if (MainForm.Instance != null && MainForm.Instance.Browser != null)
MainForm.Instance.Browser.ExecuteScriptAsync("$app.addGameLogEvent", logLine);
}
m_LogList.Add(item); m_LogList.Add(item);
} }
finally finally
@@ -244,7 +273,7 @@ namespace VRCX
dt = DateTime.UtcNow; dt = DateTime.UtcNow;
} }
return $"{dt:yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'}"; return $"{dt:yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'}";
} }
private bool ParseLogLocation(FileInfo fileInfo, LogContext logContext, string line, int offset) private bool ParseLogLocation(FileInfo fileInfo, LogContext logContext, string line, int offset)
@@ -515,6 +544,28 @@ namespace VRCX
return true; return true;
} }
private bool ParseLogWorldVRCX(FileInfo fileInfo, LogContext logContext, string line, int offset)
{
// [VRCX] VideoPlay(PyPyDance) "https://jd.pypy.moe/api/v1/videos/-Q3pdlsQxOk.mp4",0.5338666,260.6938,"1339 : Le Freak (Random)"
if (string.Compare(line, offset, "[VRCX] ", 0, 7, StringComparison.Ordinal) == 0)
{
var data = line.Substring(offset + 7);
AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"vrcx",
data
});
return true;
}
return false;
}
private bool ParseLogSDK2VideoPlay(FileInfo fileInfo, LogContext logContext, string line, int offset) private bool ParseLogSDK2VideoPlay(FileInfo fileInfo, LogContext logContext, string line, int offset)
{ {
// 2021.04.23 13:12:25 Log - User Natsumi-sama added URL https://www.youtube.com/watch?v=dQw4w9WgXcQ // 2021.04.23 13:12:25 Log - User Natsumi-sama added URL https://www.youtube.com/watch?v=dQw4w9WgXcQ
@@ -579,14 +630,10 @@ namespace VRCX
return true; return true;
} }
public void Reset()
{
m_ResetLog = true;
m_Thread?.Interrupt();
}
public string[][] Get() public string[][] Get()
{ {
Update();
if (m_ResetLog == false && if (m_ResetLog == false &&
m_LogList.Count > 0) m_LogList.Count > 0)
{ {

View File

@@ -34,8 +34,8 @@ namespace VRCX
private Device _device; private Device _device;
private Texture2D _texture1; private Texture2D _texture1;
private Texture2D _texture2; private Texture2D _texture2;
private OffScreenBrowser _browser1; public static OffScreenBrowser _browser1;
private OffScreenBrowser _browser2; public static OffScreenBrowser _browser2;
private bool _active; private bool _active;
static VRCXVR() static VRCXVR()

File diff suppressed because it is too large Load Diff

View File

@@ -185,10 +185,10 @@ html
template(#tool) template(#tool)
div(style="margin:0 0 10px;display:flex;align-items:center") div(style="margin:0 0 10px;display:flex;align-items:center")
el-select(v-model="gameLogTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" placeholder="Filter") el-select(v-model="gameLogTable.filters[0].value" @change="saveTableFilters" multiple clearable collapse-tags style="flex:1" placeholder="Filter")
el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'PortalSpawn', 'Event', 'VideoPlay']" :key="type" :label="type" :value="type") el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'PortalSpawn', 'AvatarChange', 'Event', 'VideoPlay']" :key="type" :label="type" :value="type")
el-input(v-model="gameLogTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin:0 10px") el-input(v-model="gameLogTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin:0 10px")
el-tooltip(placement="bottom" content="Reset game log" :disabled="hideTooltips") el-tooltip(placement="bottom" content="Reset game log" :disabled="hideTooltips")
el-button(type="default" @click="resetGameLog()" icon="el-icon-refresh" circle style="flex:none") el-button(type="default" @click="refreshGameLog()" icon="el-icon-refresh" circle style="flex:none")
el-table-column(label="Date" prop="created_at" sortable="custom" width="90") el-table-column(label="Date" prop="created_at" sortable="custom" width="90")
template(v-once #default="scope") template(v-once #default="scope")
el-tooltip(placement="right") el-tooltip(placement="right")
@@ -196,17 +196,28 @@ html
span {{ scope.row.created_at | formatDate('YYYY-MM-DD HH24:MI:SS') }} span {{ scope.row.created_at | formatDate('YYYY-MM-DD HH24:MI:SS') }}
span {{ scope.row.created_at | formatDate('MM-DD HH24:MI') }} span {{ scope.row.created_at | formatDate('MM-DD HH24:MI') }}
el-table-column(label="Type" prop="type" width="120") el-table-column(label="Type" prop="type" width="120")
template(v-once #default="scope")
span.x-link(v-if="scope.row.location && scope.row.type !== 'Location'" v-text="scope.row.type" @click="showWorldDialog(scope.row.location)")
span(v-else v-text="scope.row.type")
el-table-column(label="User" prop="displayName" width="160")
template(v-once #default="scope")
span.x-link(v-text="scope.row.displayName" @click="lookupUser(scope.row)")
el-table-column(label="Detail" prop="data") el-table-column(label="Detail" prop="data")
template(v-once #default="scope") template(v-once #default="scope")
location(v-if="scope.row.type === 'Location'" :location="scope.row.data[0]" :hint="scope.row.data[1]") location(v-if="scope.row.type === 'Location'" :location="scope.row.location" :hint="scope.row.worldName")
location(v-else-if="scope.row.type === 'PortalSpawn'" :location="scope.row.instanceId" :hint="scope.row.worldName")
template(v-else-if="scope.row.type === 'AvatarChange'")
span.x-link(@click="showUserDialog(scope.row.authorId)" v-text="scope.row.name")
template(v-if="scope.row.description && scope.row.name !== scope.row.description")
| - {{ scope.row.description }}
template(v-else-if="scope.row.type === 'Event'") template(v-else-if="scope.row.type === 'Event'")
span(v-text="scope.row.data") span(v-text="scope.row.data")
template(v-else-if="scope.row.type === 'VideoPlay'") template(v-else-if="scope.row.type === 'VideoPlay'")
span.x-link(v-text="scope.row.data" @click="openExternalLink(scope.row.data)") span(v-if="scope.row.videoId") {{ scope.row.videoId }}:
template(v-if="scope.row.displayName") span.x-link(v-if="scope.row.videoName" @click="openExternalLink(scope.row.videoUrl)" v-text="scope.row.videoName")
span.x-link(@click="lookupUser(scope.row.displayName)") ({{ scope.row.displayName }}) span.x-link(v-else @click="openExternalLink(scope.row.videoUrl)" v-text="scope.row.videoUrl")
template(v-else-if="scope.row.type === 'Notification'") template(v-else-if="scope.row.type === 'Notification' || scope.row.type === 'OnPlayerJoined' || scope.row.type === 'OnPlayerLeft'")
span.x-link(v-else v-text="scope.row.data" @click="lookupUser(scope.row.data)") span.x-link(v-else v-text="scope.row.data")
//- search //- search
.x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'search'") .x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'search'")
@@ -1924,15 +1935,22 @@ html
el-radio-button(label="Friends") el-radio-button(label="Friends")
el-radio-button(label="Everyone") el-radio-button(label="Everyone")
.toggle-item .toggle-item
span.toggle-name Events span.toggle-name Avatar Change
el-radio-group(v-model="sharedFeedFilters.noty.Event" size="mini") el-radio-group(v-model="sharedFeedFilters.noty.AvatarChange" size="mini")
el-radio-button(label="Off") el-radio-button(label="Off")
el-radio-button(label="On") el-radio-button(label="VIP")
el-radio-button(label="Friends")
el-radio-button(label="Everyone")
.toggle-item .toggle-item
span.toggle-name Video Play span.toggle-name Video Play
el-radio-group(v-model="sharedFeedFilters.noty.VideoPlay" size="mini") el-radio-group(v-model="sharedFeedFilters.noty.VideoPlay" size="mini")
el-radio-button(label="Off") el-radio-button(label="Off")
el-radio-button(label="On") el-radio-button(label="On")
.toggle-item
span.toggle-name Events
el-radio-group(v-model="sharedFeedFilters.noty.Event" size="mini")
el-radio-button(label="Off")
el-radio-button(label="On")
.toggle-item .toggle-item
span.toggle-name Blocked Player Joins span.toggle-name Blocked Player Joins
el-radio-group(v-model="sharedFeedFilters.noty.BlockedOnPlayerJoined" size="mini") el-radio-group(v-model="sharedFeedFilters.noty.BlockedOnPlayerJoined" size="mini")
@@ -2076,13 +2094,20 @@ html
el-radio-button(label="Friends") el-radio-button(label="Friends")
el-radio-button(label="Everyone") el-radio-button(label="Everyone")
.toggle-item .toggle-item
span.toggle-name Events span.toggle-name Avatar Change
el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini") el-radio-group(v-model="sharedFeedFilters.wrist.AvatarChange" size="mini")
el-radio-button(label="Off")
el-radio-button(label="VIP")
el-radio-button(label="Friends")
el-radio-button(label="Everyone")
.toggle-item
span.toggle-name Video Play
el-radio-group(v-model="sharedFeedFilters.wrist.VideoPlay" size="mini")
el-radio-button(label="Off") el-radio-button(label="Off")
el-radio-button(label="On") el-radio-button(label="On")
.toggle-item .toggle-item
span.toggle-name Video Play span.toggle-name Events
el-radio-group(v-model="sharedFeedFilters.noty.VideoPlay" size="mini") el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini")
el-radio-button(label="Off") el-radio-button(label="Off")
el-radio-button(label="On") el-radio-button(label="On")
.toggle-item .toggle-item

View File

@@ -1,7 +1,7 @@
import sqliteService from '../service/sqlite.js'; import sqliteService from '../service/sqlite.js';
class Database { class Database {
async init(userId) { async initUserTables(userId) {
Database.userId = userId.replaceAll('-', '').replaceAll('_', ''); Database.userId = userId.replaceAll('-', '').replaceAll('_', '');
await sqliteService.executeNonQuery( await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS ${Database.userId}_feed_gps (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, location TEXT, world_name TEXT, previous_location TEXT, time INTEGER)` `CREATE TABLE IF NOT EXISTS ${Database.userId}_feed_gps (id INTEGER PRIMARY KEY, created_at TEXT, user_id TEXT, display_name TEXT, location TEXT, world_name TEXT, previous_location TEXT, time INTEGER)`
@@ -26,6 +26,24 @@ class Database {
); );
} }
async initTables() {
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_location (id INTEGER PRIMARY KEY, created_at TEXT, location TEXT, world_id TEXT, world_name TEXT, time INTEGER, UNIQUE(created_at, location))`
);
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_join_leave (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, display_name TEXT, location TEXT, user_id TEXT, time INTEGER, UNIQUE(created_at, type, display_name))`
);
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_portal_spawn (id INTEGER PRIMARY KEY, created_at TEXT, display_name TEXT, location TEXT, user_id TEXT, instance_id TEXT, world_name TEXT, UNIQUE(created_at, display_name))`
);
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_video_play (id INTEGER PRIMARY KEY, created_at TEXT, video_url TEXT, video_name TEXT, video_id TEXT, location TEXT, display_name TEXT, user_id TEXT, UNIQUE(created_at, video_url))`
);
await sqliteService.executeNonQuery(
`CREATE TABLE IF NOT EXISTS gamelog_event (id INTEGER PRIMARY KEY, created_at TEXT, data TEXT, UNIQUE(created_at, data))`
);
}
async getFeedDatabase() { async getFeedDatabase() {
var feedDatabase = []; var feedDatabase = [];
var date = new Date(); var date = new Date();
@@ -349,6 +367,162 @@ class Database {
} }
); );
} }
async getGamelogDatabase() {
var gamelogDatabase = [];
var date = new Date();
date.setDate(date.getDate() - 3); // 3 day limit
var dateOffset = date.toJSON();
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'Location',
location: dbRow[2],
worldId: dbRow[3],
worldName: dbRow[4],
time: dbRow[5]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}')`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: dbRow[2],
displayName: dbRow[3],
location: dbRow[4],
userId: dbRow[5],
time: dbRow[6]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_join_leave WHERE created_at >= date('${dateOffset}')`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'PortalSpawn',
displayName: dbRow[2],
location: dbRow[3],
userId: dbRow[4],
instanceId: dbRow[5],
worldName: dbRow[6]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_portal_spawn WHERE created_at >= date('${dateOffset}')`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'VideoPlay',
videoUrl: dbRow[2],
videoName: dbRow[3],
videoId: dbRow[4],
location: dbRow[5],
displayName: dbRow[6],
userId: dbRow[7]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_video_play WHERE created_at >= date('${dateOffset}')`);
await sqliteService.execute((dbRow) => {
var row = {
rowId: dbRow[0],
created_at: dbRow[1],
type: 'Event',
data: dbRow[2]
};
gamelogDatabase.unshift(row);
}, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}')`);
var compareByCreatedAt = function (a, b) {
var A = a.created_at;
var B = b.created_at;
if (A < B) {
return -1;
}
if (A > B) {
return 1;
}
return 0;
};
gamelogDatabase.sort(compareByCreatedAt);
return gamelogDatabase;
}
addGamelogLocationToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_location (created_at, location, world_id, world_name, time) VALUES (@created_at, @location, @world_id, @world_name, @time)`,
{
'@created_at': entry.created_at,
'@location': entry.location,
'@world_id': entry.worldId,
'@world_name': entry.worldName,
'@time': entry.time
}
);
}
updateGamelogLocationTimeToDatabase(entry) {
sqliteService.executeNonQuery(
`UPDATE gamelog_location SET time = @time WHERE created_at = @created_at`,
{
'@created_at': entry.created_at,
'@time': entry.time
}
);
}
addGamelogJoinLeaveToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_join_leave (created_at, type, display_name, location, user_id, time) VALUES (@created_at, @type, @display_name, @location, @user_id, @time)`,
{
'@created_at': entry.created_at,
'@type': entry.type,
'@display_name': entry.displayName,
'@location': entry.location,
'@user_id': entry.userId,
'@time': entry.time
}
);
}
addGamelogPortalSpawnToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_portal_spawn (created_at, display_name, location, user_id, instance_id, world_name) VALUES (@created_at, @display_name, @location, @user_id, @instance_id, @world_name)`,
{
'@created_at': entry.created_at,
'@display_name': entry.displayName,
'@location': entry.location,
'@user_id': entry.userId,
'@instance_id': entry.instanceId,
'@world_name': entry.worldName
}
);
}
addGamelogVideoPlayToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_video_play (created_at, video_url, video_name, video_id, location, display_name, user_id) VALUES (@created_at, @video_url, @video_name, @video_id, @location, @display_name, @user_id)`,
{
'@created_at': entry.created_at,
'@video_url': entry.videoUrl,
'@video_name': entry.videoName,
'@video_id': entry.videoId,
'@location': entry.location,
'@display_name': entry.displayName,
'@user_id': entry.userId
}
);
}
addGamelogEventToDatabase(entry) {
sqliteService.executeNonQuery(
`INSERT OR IGNORE INTO gamelog_event (created_at, data) VALUES (@created_at, @data)`,
{
'@created_at': entry.created_at,
'@data': entry.data
}
);
}
} }
var self = new Database(); var self = new Database();

View File

@@ -1,93 +1,78 @@
// requires binding of LogWatcher // requires binding of LogWatcher
// <string, object>
var contextMap = new Map();
function parseRawGameLog(dt, type, args) {
var gameLog = {
dt,
type
};
switch (type) {
case 'location':
gameLog.location = args[0];
gameLog.worldName = args[1];
break;
case 'player-joined':
gameLog.userDisplayName = args[0];
gameLog.userType = args[1];
break;
case 'player-left':
gameLog.userDisplayName = args[0];
break;
case 'notification':
gameLog.json = args[0];
break;
case 'portal-spawn':
gameLog.userDisplayName = args[0];
break;
case 'event':
gameLog.event = args[0];
break;
case 'video-play':
gameLog.videoURL = args[0];
gameLog.displayName = args[1];
break;
default:
break;
}
return gameLog;
}
class GameLogService { class GameLogService {
async poll() { parseRawGameLog(dt, type, args) {
var rawGameLogs = await LogWatcher.Get(); var gameLog = {
var gameLogs = []; dt,
var now = Date.now(); type
};
for (var [fileName, dt, type, ...args] of rawGameLogs) { switch (type) {
var context = contextMap.get(fileName); case 'location':
if (typeof context === 'undefined') { gameLog.location = args[0];
context = { gameLog.worldName = args[1];
updatedAt: null, break;
// location case 'player-joined':
location: null gameLog.userDisplayName = args[0];
}; gameLog.userType = args[1];
contextMap.set(fileName, context); break;
}
var gameLog = parseRawGameLog(dt, type, args); case 'player-left':
gameLog.userDisplayName = args[0];
break;
switch (gameLog.type) { case 'notification':
case 'location': gameLog.json = args[0];
context.location = gameLog.location; break;
break;
default: case 'portal-spawn':
break; gameLog.userDisplayName = args[0];
} break;
context.updatedAt = now; case 'event':
gameLog.event = args[0];
break;
gameLogs.push(gameLog); case 'video-play':
gameLog.videoUrl = args[0];
gameLog.displayName = args[1];
break;
case 'vrcx':
gameLog.data = args[0];
break;
default:
break;
} }
return gameLog;
}
async getAll() {
var gameLogs = [];
var done = false;
while (!done) {
var rawGameLogs = await LogWatcher.Get();
// eslint-disable-next-line no-unused-vars
for (var [fileName, dt, type, ...args] of rawGameLogs) {
var gameLog = this.parseRawGameLog(dt, type, args);
gameLogs.push(gameLog);
}
if (rawGameLogs.length === 0) {
done = true;
}
}
return gameLogs; return gameLogs;
} }
async setDateTill(dateTill) {
await LogWatcher.SetDateTill(dateTill);
}
async reset() { async reset() {
await LogWatcher.Reset(); await LogWatcher.Reset();
contextMap.clear();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -36,17 +36,23 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.displayName")] #[i.x-user-status(:class="statusClass(feed.status)")] {{feed.statusDescription}} | #[span.name(v-text="feed.displayName")]
template(v-if="feed.statusDescription === feed.previousStatusDescription")
i.x-user-status(:class="statusClass(feed.previousStatus)")
i.el-icon-right
i.x-user-status(:class="statusClass(feed.status)")
template(v-else)
| #[i.x-user-status(:class="statusClass(feed.status)")] {{feed.statusDescription}}
div(v-else-if="feed.type === 'OnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| ▶️ #[span.name(v-text="feed.data")] | ▶️ #[span.name(v-text="feed.displayName")]
div(v-else-if="feed.type === 'OnPlayerLeft'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerLeft'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| ◀️ #[span.name(v-text="feed.data")] | ◀️ #[span.name(v-text="feed.displayName")]
div(v-else-if="feed.type === 'OnPlayerJoining'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerJoining'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
@@ -57,7 +63,16 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
location(:location="feed.data[0]" :hint="feed.data[1]") location(:location="feed.location" :hint="feed.worldName")
div(v-else-if="feed.type === 'VideoPlay'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| 🎵 #[span.name(v-text="feed.displayName")]
template(v-if="feed.videoName")
| #[span(v-text="feed.videoName")]
template(v-else)
| #[span(v-text="feed.videoUrl")]
div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
@@ -107,7 +122,16 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| ✨ #[span.name(v-text="feed.data")] | ✨ #[span.name(v-text="feed.displayName")]
template(v-if="feed.worldName")
| #[location(:location="feed.instanceId" :hint="feed.worldName")]
div(v-else-if="feed.type === 'AvatarChange'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| 🧍 #[span.name(v-text="feed.displayName")] {{ feed.name }}
template(v-if="feed.description && feed.description !== feed.name")
| - {{ feed.description }}
div(v-else-if="feed.type === 'Event'" class="x-friend-item") div(v-else-if="feed.type === 'Event'" class="x-friend-item")
.detail .detail
span.extra span.extra
@@ -159,17 +183,23 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.displayName")] is #[i.x-user-status(:class="statusClass(feed.status)")] {{feed.statusDescription}} | #[span.name(v-text="feed.displayName")]
template(v-if="feed.statusDescription === feed.previousStatusDescription")
i.x-user-status(:class="statusClass(feed.previousStatus)")
i.el-icon-right
i.x-user-status(:class="statusClass(feed.status)")
template(v-else)
| #[i.x-user-status(:class="statusClass(feed.status)")] {{feed.statusDescription}}
div(v-else-if="feed.type === 'OnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerJoined'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.data")] has joined | #[span.name(v-text="feed.displayName")] has joined
div(v-else-if="feed.type === 'OnPlayerLeft'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerLeft'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.data")] has left | #[span.name(v-text="feed.displayName")] has left
div(v-else-if="feed.type === 'OnPlayerJoining'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'OnPlayerJoining'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
@@ -179,7 +209,16 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
location(:location="feed.data[0]" :hint="feed.data[1]") location(:location="feed.location" :hint="feed.worldName")
div(v-else-if="feed.type === 'VideoPlay'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.displayName")] changed video to
template(v-if="feed.videoName")
| #[span(v-text="feed.videoName")]
template(v-else)
| #[span(v-text="feed.videoUrl")]
div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail .detail
span.extra span.extra
@@ -229,7 +268,16 @@ html
.detail .detail
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.data")] has spawned a portal | #[span.name(v-text="feed.displayName")] has spawned a portal
template(v-if="feed.worldName")
| to #[location(:location="feed.instanceId" :hint="feed.worldName")]
div(v-else-if="feed.type === 'AvatarChange'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.displayName")] changed into avatar {{ feed.name }}
template(v-if="feed.description && feed.description !== feed.name")
| - {{ feed.description }}
div(v-else-if="feed.type === 'Event'" class="x-friend-item") div(v-else-if="feed.type === 'Event'" class="x-friend-item")
.detail .detail
span.extra span.extra
@@ -302,19 +350,19 @@ html
span {{ device[2] }}% span {{ device[2] }}%
.x-containerbottom .x-containerbottom
template(v-if="config && config.minimalFeed") template(v-if="config && config.minimalFeed")
template(v-if="downloadProgress === 100") template(v-if="config.downloadProgress === 100")
span(style="display:inline-block;margin-right:5px") #[i.el-icon-loading] span(style="display:inline-block;margin-right:5px") #[i.el-icon-loading]
template(v-else-if="downloadProgress > 0") template(v-else-if="config.downloadProgress > 0")
span(style="display:inline-block;margin-right:5px") {{ downloadProgress }}% span(style="display:inline-block;margin-right:5px") {{ config.downloadProgress }}%
template(v-if="lastLocation.date != 0") template(v-if="lastLocation.date != 0")
span(style="float:right") {{ lastLocationTimer }} span(style="float:right") {{ lastLocationTimer }}
span(style="display:inline-block") {{ lastLocation.playerList.length }} span(style="display:inline-block") {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
template(v-else) template(v-else)
template(v-if="downloadProgress === 100") template(v-if="config.downloadProgress === 100")
span(style="display:inline-block;margin-right:5px") Downloading: #[i.el-icon-loading] span(style="display:inline-block;margin-right:5px") Downloading: #[i.el-icon-loading]
template(v-else-if="downloadProgress > 0") template(v-else-if="config.downloadProgress > 0")
span(style="display:inline-block;margin-right:5px") Downloading: {{ downloadProgress }}% span(style="display:inline-block;margin-right:5px") Downloading: {{ config.downloadProgress }}%
template(v-if="lastLocation.date != 0") template(v-if="lastLocation.date != 0")
span(style="float:right") Timer: {{ lastLocationTimer }} span(style="float:right") Timer: {{ lastLocationTimer }}
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }} span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}

View File

@@ -22,9 +22,6 @@
.noty_body { .noty_body {
display: block; display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.noty_layout { .noty_layout {
@@ -34,6 +31,7 @@
.noty_theme__relax.noty_bar, .noty_theme__relax.noty_bar,
.noty_theme__sunset.noty_bar { .noty_theme__sunset.noty_bar {
height: 42px;
position: relative; position: relative;
margin: 4px 0; margin: 4px 0;
overflow: hidden; overflow: hidden;
@@ -42,9 +40,7 @@
.noty_theme__relax.noty_bar .noty_body, .noty_theme__relax.noty_bar .noty_body,
.noty_theme__sunset.noty_bar .noty_body { .noty_theme__sunset.noty_bar .noty_body {
padding: 5px 10px 10px;
font-size: 15px; font-size: 15px;
text-align: center;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
} }
@@ -143,6 +139,19 @@
opacity: 0.6; opacity: 0.6;
} }
.noty-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 8px 8px 0 11px;
}
.noty-img {
height: 42px;
float: left;
border-radius: 4px;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
height: 8px; height: 8px;