mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-13 03:43:50 +02:00
Massive commit that will break everything!
This commit is contained in:
17
AppApi.cs
17
AppApi.cs
@@ -314,13 +314,28 @@ namespace VRCX
|
||||
System.Environment.Exit(0);
|
||||
}
|
||||
|
||||
public bool checkForUpdateZip()
|
||||
public bool CheckForUpdateZip()
|
||||
{
|
||||
if (File.Exists(Path.Combine(Program.AppDataDirectory, "update.exe")))
|
||||
return true;
|
||||
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)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -30,6 +31,8 @@ namespace VRCX
|
||||
private readonly List<string[]> m_LogList;
|
||||
private Thread m_Thread;
|
||||
private bool m_ResetLog;
|
||||
private bool m_FirstRun = true;
|
||||
private static DateTime tillDate = DateTime.Now;
|
||||
|
||||
// NOTE
|
||||
// FileSystemWatcher() is unreliable
|
||||
@@ -64,6 +67,17 @@ namespace VRCX
|
||||
thread.Interrupt();
|
||||
thread.Join();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_ResetLog = true;
|
||||
m_Thread?.Interrupt();
|
||||
}
|
||||
|
||||
public void SetDateTill(string date)
|
||||
{
|
||||
tillDate = DateTime.Parse(date);
|
||||
}
|
||||
|
||||
private void ThreadLoop()
|
||||
{
|
||||
@@ -86,6 +100,7 @@ namespace VRCX
|
||||
{
|
||||
if (m_ResetLog == true)
|
||||
{
|
||||
m_FirstRun = true;
|
||||
m_ResetLog = false;
|
||||
m_LogContextMap.Clear();
|
||||
m_LogListLock.EnterWriteLock();
|
||||
@@ -109,26 +124,17 @@ namespace VRCX
|
||||
// sort by creation time
|
||||
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)
|
||||
{
|
||||
var lastWriteTimeUtc = fileInfo.LastWriteTimeUtc;
|
||||
|
||||
if (lastWriteTimeUtc < minLimitDateTime)
|
||||
fileInfo.Refresh();
|
||||
if (fileInfo.Exists == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastWriteTimeUtc >= minRefreshDateTime)
|
||||
if (DateTime.Compare(fileInfo.LastWriteTime, tillDate) < 0)
|
||||
{
|
||||
fileInfo.Refresh();
|
||||
if (fileInfo.Exists == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_LogContextMap.TryGetValue(fileInfo.Name, out LogContext logContext) == true)
|
||||
@@ -155,6 +161,8 @@ namespace VRCX
|
||||
{
|
||||
m_LogContextMap.Remove(name);
|
||||
}
|
||||
|
||||
m_FirstRun = false;
|
||||
}
|
||||
|
||||
private void ParseLog(FileInfo fileInfo, LogContext logContext)
|
||||
@@ -184,6 +192,20 @@ namespace VRCX
|
||||
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;
|
||||
if (line[offset] == '[')
|
||||
{
|
||||
@@ -194,7 +216,8 @@ namespace VRCX
|
||||
ParseLogJoinBlocked(fileInfo, logContext, line, offset) == true ||
|
||||
ParseLogAvatarPedestalChange(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;
|
||||
}
|
||||
@@ -221,6 +244,12 @@ namespace VRCX
|
||||
m_LogListLock.EnterWriteLock();
|
||||
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);
|
||||
}
|
||||
finally
|
||||
@@ -244,7 +273,7 @@ namespace VRCX
|
||||
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)
|
||||
@@ -515,6 +544,28 @@ namespace VRCX
|
||||
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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_ResetLog = true;
|
||||
m_Thread?.Interrupt();
|
||||
}
|
||||
|
||||
public string[][] Get()
|
||||
{
|
||||
Update();
|
||||
|
||||
if (m_ResetLog == false &&
|
||||
m_LogList.Count > 0)
|
||||
{
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace VRCX
|
||||
private Device _device;
|
||||
private Texture2D _texture1;
|
||||
private Texture2D _texture2;
|
||||
private OffScreenBrowser _browser1;
|
||||
private OffScreenBrowser _browser2;
|
||||
public static OffScreenBrowser _browser1;
|
||||
public static OffScreenBrowser _browser2;
|
||||
private bool _active;
|
||||
|
||||
static VRCXVR()
|
||||
|
||||
892
html/src/app.js
892
html/src/app.js
File diff suppressed because it is too large
Load Diff
@@ -185,10 +185,10 @@ html
|
||||
template(#tool)
|
||||
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-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-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")
|
||||
template(v-once #default="scope")
|
||||
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('MM-DD HH24:MI') }}
|
||||
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")
|
||||
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'")
|
||||
span(v-text="scope.row.data")
|
||||
template(v-else-if="scope.row.type === 'VideoPlay'")
|
||||
span.x-link(v-text="scope.row.data" @click="openExternalLink(scope.row.data)")
|
||||
template(v-if="scope.row.displayName")
|
||||
span.x-link(@click="lookupUser(scope.row.displayName)") ({{ scope.row.displayName }})
|
||||
template(v-else-if="scope.row.type === 'Notification'")
|
||||
span.x-link(v-else v-text="scope.row.data" @click="lookupUser(scope.row.data)")
|
||||
span(v-if="scope.row.videoId") {{ scope.row.videoId }}:
|
||||
span.x-link(v-if="scope.row.videoName" @click="openExternalLink(scope.row.videoUrl)" v-text="scope.row.videoName")
|
||||
span.x-link(v-else @click="openExternalLink(scope.row.videoUrl)" v-text="scope.row.videoUrl")
|
||||
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")
|
||||
|
||||
//- 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="Everyone")
|
||||
.toggle-item
|
||||
span.toggle-name Events
|
||||
el-radio-group(v-model="sharedFeedFilters.noty.Event" size="mini")
|
||||
span.toggle-name Avatar Change
|
||||
el-radio-group(v-model="sharedFeedFilters.noty.AvatarChange" size="mini")
|
||||
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
|
||||
span.toggle-name Video Play
|
||||
el-radio-group(v-model="sharedFeedFilters.noty.VideoPlay" size="mini")
|
||||
el-radio-button(label="Off")
|
||||
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
|
||||
span.toggle-name Blocked Player Joins
|
||||
el-radio-group(v-model="sharedFeedFilters.noty.BlockedOnPlayerJoined" size="mini")
|
||||
@@ -2076,13 +2094,20 @@ html
|
||||
el-radio-button(label="Friends")
|
||||
el-radio-button(label="Everyone")
|
||||
.toggle-item
|
||||
span.toggle-name Events
|
||||
el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini")
|
||||
span.toggle-name Avatar Change
|
||||
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="On")
|
||||
.toggle-item
|
||||
span.toggle-name Video Play
|
||||
el-radio-group(v-model="sharedFeedFilters.noty.VideoPlay" size="mini")
|
||||
span.toggle-name Events
|
||||
el-radio-group(v-model="sharedFeedFilters.wrist.Event" size="mini")
|
||||
el-radio-button(label="Off")
|
||||
el-radio-button(label="On")
|
||||
.toggle-item
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sqliteService from '../service/sqlite.js';
|
||||
|
||||
class Database {
|
||||
async init(userId) {
|
||||
async initUserTables(userId) {
|
||||
Database.userId = userId.replaceAll('-', '').replaceAll('_', '');
|
||||
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)`
|
||||
@@ -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() {
|
||||
var feedDatabase = [];
|
||||
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();
|
||||
|
||||
@@ -1,93 +1,78 @@
|
||||
// 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 {
|
||||
async poll() {
|
||||
var rawGameLogs = await LogWatcher.Get();
|
||||
var gameLogs = [];
|
||||
var now = Date.now();
|
||||
parseRawGameLog(dt, type, args) {
|
||||
var gameLog = {
|
||||
dt,
|
||||
type
|
||||
};
|
||||
|
||||
for (var [fileName, dt, type, ...args] of rawGameLogs) {
|
||||
var context = contextMap.get(fileName);
|
||||
if (typeof context === 'undefined') {
|
||||
context = {
|
||||
updatedAt: null,
|
||||
switch (type) {
|
||||
case 'location':
|
||||
gameLog.location = args[0];
|
||||
gameLog.worldName = args[1];
|
||||
break;
|
||||
|
||||
// location
|
||||
location: null
|
||||
};
|
||||
contextMap.set(fileName, context);
|
||||
}
|
||||
case 'player-joined':
|
||||
gameLog.userDisplayName = args[0];
|
||||
gameLog.userType = args[1];
|
||||
break;
|
||||
|
||||
var gameLog = parseRawGameLog(dt, type, args);
|
||||
case 'player-left':
|
||||
gameLog.userDisplayName = args[0];
|
||||
break;
|
||||
|
||||
switch (gameLog.type) {
|
||||
case 'location':
|
||||
context.location = gameLog.location;
|
||||
break;
|
||||
case 'notification':
|
||||
gameLog.json = args[0];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case 'portal-spawn':
|
||||
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;
|
||||
}
|
||||
|
||||
async setDateTill(dateTill) {
|
||||
await LogWatcher.SetDateTill(dateTill);
|
||||
}
|
||||
|
||||
async reset() {
|
||||
await LogWatcher.Reset();
|
||||
contextMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1001
html/src/vr.js
1001
html/src/vr.js
File diff suppressed because it is too large
Load Diff
@@ -36,17 +36,23 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -57,7 +63,16 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -107,7 +122,16 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -159,17 +183,23 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -179,7 +209,16 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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 }")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -229,7 +268,16 @@ html
|
||||
.detail
|
||||
span.extra
|
||||
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")
|
||||
.detail
|
||||
span.extra
|
||||
@@ -302,19 +350,19 @@ html
|
||||
span {{ device[2] }}%
|
||||
.x-containerbottom
|
||||
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]
|
||||
template(v-else-if="downloadProgress > 0")
|
||||
span(style="display:inline-block;margin-right:5px") {{ downloadProgress }}%
|
||||
template(v-else-if="config.downloadProgress > 0")
|
||||
span(style="display:inline-block;margin-right:5px") {{ config.downloadProgress }}%
|
||||
template(v-if="lastLocation.date != 0")
|
||||
span(style="float:right") {{ lastLocationTimer }}
|
||||
span(style="display:inline-block") {{ lastLocation.playerList.length }}
|
||||
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
|
||||
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]
|
||||
template(v-else-if="downloadProgress > 0")
|
||||
span(style="display:inline-block;margin-right:5px") Downloading: {{ downloadProgress }}%
|
||||
template(v-else-if="config.downloadProgress > 0")
|
||||
span(style="display:inline-block;margin-right:5px") Downloading: {{ config.downloadProgress }}%
|
||||
template(v-if="lastLocation.date != 0")
|
||||
span(style="float:right") Timer: {{ lastLocationTimer }}
|
||||
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
|
||||
.noty_body {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.noty_layout {
|
||||
@@ -34,6 +31,7 @@
|
||||
|
||||
.noty_theme__relax.noty_bar,
|
||||
.noty_theme__sunset.noty_bar {
|
||||
height: 42px;
|
||||
position: relative;
|
||||
margin: 4px 0;
|
||||
overflow: hidden;
|
||||
@@ -42,9 +40,7 @@
|
||||
|
||||
.noty_theme__relax.noty_bar .noty_body,
|
||||
.noty_theme__sunset.noty_bar .noty_body {
|
||||
padding: 5px 10px 10px;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
@@ -143,6 +139,19 @@
|
||||
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 {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
|
||||
Reference in New Issue
Block a user