mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 01:33:51 +02:00
Electron support for Linux (#1074)
* init * SQLite changes * Move html folder, edit build scripts * AppApi interface * Build flags * AppApi inheritance * Finishing touches * Merge upstream changes * Test CI * Fix class inits * Rename AppApi * Merge upstream changes * Fix SQLiteLegacy on Linux, Add Linux interop, build tools * Linux specific localisation strings * Make it run * Bring back most of Linux functionality * Clean up * Fix TTS voices * Fix UI var * Changes * Electron minimise to tray * Remove separate toggle for WlxOverlay * Fixes * Touchups * Move csproj * Window zoom, Desktop Notifications, VR check on Linux * Fix desktop notifications, VR check spam * Fix building on Linux * Clean up * Fix WebApi headers * Rewrite VRCX updater * Clean up * Linux updater * Add Linux to build action * init * SQLite changes * Move html folder, edit build scripts * AppApi interface * Build flags * AppApi inheritance * Finishing touches * Merge upstream changes * Test CI * Fix class inits * Rename AppApi * Merge upstream changes * Fix SQLiteLegacy on Linux, Add Linux interop, build tools * Linux specific localisation strings * Make it run * Bring back most of Linux functionality * Clean up * Fix TTS voices * Changes * Electron minimise to tray * Remove separate toggle for WlxOverlay * Fixes * Touchups * Move csproj * Window zoom, Desktop Notifications, VR check on Linux * Fix desktop notifications, VR check spam * Fix building on Linux * Clean up * Fix WebApi headers * Rewrite VRCX updater * Clean up * Linux updater * Add Linux to build action * Test updater * Rebase and handle merge conflicts * Fix Linux updater * Fix Linux app restart * Fix friend order * Handle AppImageInstaller, show an install message on Linux * Updates to the AppImage installer * Fix Linux updater, fix set version, check for .NET, copy wine prefix * Handle random errors * Rotate tall prints * try fix Linux restart bug * Final --------- Co-authored-by: rs189 <35667100+rs189@users.noreply.github.com>
This commit is contained in:
132
src/service/gamelog.js
Normal file
132
src/service/gamelog.js
Normal file
@@ -0,0 +1,132 @@
|
||||
// requires binding of LogWatcher
|
||||
|
||||
class GameLogService {
|
||||
parseRawGameLog(dt, type, args) {
|
||||
var gameLog = {
|
||||
dt,
|
||||
type
|
||||
};
|
||||
|
||||
switch (type) {
|
||||
case 'location':
|
||||
gameLog.location = args[0];
|
||||
gameLog.worldName = args[1];
|
||||
break;
|
||||
|
||||
case 'location-destination':
|
||||
gameLog.location = args[0];
|
||||
break;
|
||||
|
||||
case 'player-joined':
|
||||
gameLog.displayName = args[0];
|
||||
gameLog.userId = args[1];
|
||||
break;
|
||||
|
||||
case 'player-left':
|
||||
gameLog.displayName = args[0];
|
||||
gameLog.userId = args[1];
|
||||
break;
|
||||
|
||||
case 'notification':
|
||||
gameLog.json = args[0];
|
||||
break;
|
||||
|
||||
case 'portal-spawn':
|
||||
break;
|
||||
|
||||
case 'event':
|
||||
gameLog.event = args[0];
|
||||
break;
|
||||
|
||||
case 'video-play':
|
||||
gameLog.videoUrl = args[0];
|
||||
gameLog.displayName = args[1];
|
||||
break;
|
||||
|
||||
case 'resource-load-string':
|
||||
case 'resource-load-image':
|
||||
gameLog.resourceUrl = args[0];
|
||||
break;
|
||||
|
||||
case 'video-sync':
|
||||
gameLog.timestamp = args[0];
|
||||
break;
|
||||
|
||||
case 'vrcx':
|
||||
gameLog.data = args[0];
|
||||
break;
|
||||
|
||||
case 'api-request':
|
||||
gameLog.url = args[0];
|
||||
break;
|
||||
|
||||
case 'avatar-change':
|
||||
gameLog.displayName = args[0];
|
||||
gameLog.avatarName = args[1];
|
||||
break;
|
||||
|
||||
case 'photon-id':
|
||||
gameLog.displayName = args[0];
|
||||
gameLog.photonId = args[1];
|
||||
break;
|
||||
|
||||
case 'screenshot':
|
||||
gameLog.screenshotPath = args[0];
|
||||
break;
|
||||
|
||||
case 'vrc-quit':
|
||||
break;
|
||||
|
||||
case 'openvr-init':
|
||||
break;
|
||||
|
||||
case 'desktop-mode':
|
||||
break;
|
||||
|
||||
case 'udon-exception':
|
||||
gameLog.data = args[0];
|
||||
break;
|
||||
|
||||
case 'sticker-spawn':
|
||||
gameLog.userId = args[0];
|
||||
gameLog.displayName = args[1];
|
||||
gameLog.fileId = args[2];
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
var self = new GameLogService();
|
||||
window.gameLogService = self;
|
||||
|
||||
export { self as default, GameLogService as LogWatcherService };
|
||||
39
src/service/sqlite.js
Normal file
39
src/service/sqlite.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// requires binding of SQLite
|
||||
|
||||
class SQLiteService {
|
||||
async execute(callback, sql, args = null) {
|
||||
if (LINUX) {
|
||||
if (args) {
|
||||
args = new Map(Object.entries(args));
|
||||
}
|
||||
var json = await SQLite.ExecuteJson(sql, args);
|
||||
var items = JSON.parse(json);
|
||||
if (json.status === 'error') {
|
||||
throw new Error(json.message);
|
||||
}
|
||||
items.data.forEach((item) => {
|
||||
callback(item);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var item = await SQLite.Execute(sql, args);
|
||||
if (item.Item1 !== null) {
|
||||
throw item.Item1;
|
||||
}
|
||||
item.Item2?.forEach((item) => {
|
||||
callback(item);
|
||||
});
|
||||
}
|
||||
|
||||
executeNonQuery(sql, args = null) {
|
||||
if (LINUX && args) {
|
||||
args = new Map(Object.entries(args));
|
||||
}
|
||||
return SQLite.ExecuteNonQuery(sql, args);
|
||||
}
|
||||
}
|
||||
|
||||
var self = new SQLiteService();
|
||||
window.sqliteService = self;
|
||||
|
||||
export { self as default, SQLiteService };
|
||||
47
src/service/webapi.js
Normal file
47
src/service/webapi.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// requires binding of WebApi
|
||||
|
||||
class WebApiService {
|
||||
clearCookies() {
|
||||
return WebApi.ClearCookies();
|
||||
}
|
||||
|
||||
getCookies() {
|
||||
return WebApi.GetCookies();
|
||||
}
|
||||
|
||||
setCookies(cookie) {
|
||||
return WebApi.SetCookies(cookie);
|
||||
}
|
||||
|
||||
async execute(options) {
|
||||
if (!options) {
|
||||
throw new Error('options is required');
|
||||
}
|
||||
if (LINUX) {
|
||||
const requestJson = JSON.stringify(options);
|
||||
var json = await WebApi.ExecuteJson(requestJson);
|
||||
var data = JSON.parse(json);
|
||||
if (data.status === -1) {
|
||||
throw new Error(data.message);
|
||||
}
|
||||
return {
|
||||
status: data.status,
|
||||
data: data.message
|
||||
};
|
||||
}
|
||||
|
||||
var item = await WebApi.Execute(options);
|
||||
if (item.Item1 === -1) {
|
||||
throw item.Item2;
|
||||
}
|
||||
return {
|
||||
status: item.Item1,
|
||||
data: item.Item2
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var self = new WebApiService();
|
||||
window.webApiService = self;
|
||||
|
||||
export { self as default, WebApiService };
|
||||
Reference in New Issue
Block a user