diff --git a/VRCX.cs b/AppApi.cs similarity index 97% rename from VRCX.cs rename to AppApi.cs index c3155bb7..343eaad3 100644 --- a/VRCX.cs +++ b/AppApi.cs @@ -14,13 +14,13 @@ using System.Windows.Forms; namespace VRCX { - public class VRCX + public class AppApi { - public static VRCX Instance { get; private set; } + public static AppApi Instance { get; private set; } - static VRCX() + static AppApi() { - Instance = new VRCX(); + Instance = new AppApi(); } public void ShowDevTools() diff --git a/Util.cs b/Util.cs index 54531b5d..a502e596 100644 --- a/Util.cs +++ b/Util.cs @@ -7,7 +7,7 @@ namespace VRCX public static void ApplyJavascriptBindings(IJavascriptObjectRepository repository) { repository.NameConverter = null; - repository.Register("VRCX", VRCX.Instance, true); + repository.Register("AppApi", AppApi.Instance, true); repository.Register("SharedVariable", SharedVariable.Instance, false); repository.Register("WebApi", WebApi.Instance, true); repository.Register("VRCXStorage", VRCXStorage.Instance, false); diff --git a/VRCX.csproj b/VRCX.csproj index b23d9e7c..1acee101 100644 --- a/VRCX.csproj +++ b/VRCX.csproj @@ -153,7 +153,7 @@ - + diff --git a/html/src/app.js b/html/src/app.js index a09a2323..2e04ca87 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -18,8 +18,8 @@ import gameLogService from './service/gamelog.js' (async function () { await CefSharp.BindObjectAsync( + 'AppApi', 'WebApi', - 'VRCX', 'SharedVariable', 'VRCXStorage', 'SQLite', @@ -59,7 +59,7 @@ import gameLogService from './service/gamelog.js' document.addEventListener('keyup', function (e) { if (e.ctrlKey) { if (e.shiftKey && e.code === 'KeyI') { - VRCX.ShowDevTools(); + AppApi.ShowDevTools(); } else if (e.code === 'KeyR') { location.reload(); } @@ -3138,6 +3138,7 @@ import gameLogService from './service/gamelog.js' try { var json = JSON.parse(data); json.content = JSON.parse(json.content); + console.log('WebSocket', json); this.$emit('PIPELINE', { json }); @@ -3323,7 +3324,7 @@ import gameLogService from './service/gamelog.js' type: 'info', callback: (action) => { if (action === 'confirm') { - VRCX.OpenLink(link); + AppApi.OpenLink(link); } } }); @@ -3357,7 +3358,7 @@ import gameLogService from './service/gamelog.js' text: `Update available!!
${this.latestAppVersion}`, timeout: 60000, callbacks: { - onClick: () => VRCX.OpenLink('https://github.com/pypy-vrc/VRCX/releases') + onClick: () => AppApi.OpenLink('https://github.com/pypy-vrc/VRCX/releases') } }).show(); this.notifyMenu('more'); @@ -3391,7 +3392,7 @@ import gameLogService from './service/gamelog.js' }); } this.checkActiveFriends(); - VRCX.CheckGameRunning().then(([isGameRunning, isGameNoVR]) => { + AppApi.CheckGameRunning().then(([isGameRunning, isGameNoVR]) => { if (isGameRunning !== this.isGameRunning) { this.isGameRunning = isGameRunning; Discord.SetTimestamps(Date.now(), 0); @@ -3637,7 +3638,7 @@ import gameLogService from './service/gamelog.js' $app.methods.loginWithSteam = function () { if (!this.loginForm.loading) { this.loginForm.loading = true; - VRCX.LoginWithSteam().catch((err) => { + AppApi.LoginWithSteam().catch((err) => { this.loginForm.loading = false; throw err; }).then((steamTicket) => { @@ -5576,7 +5577,7 @@ import gameLogService from './service/gamelog.js' configRepository.setBool('VRCX_StartAtWindowsStartup', this.isStartAtWindowsStartup); configRepository.setBool('VRCX_StartAsMinimizedState', this.isStartAsMinimizedState); configRepository.setBool('VRCX_CloseToTray', this.isCloseToTray); - VRCX.SetStartup(this.isStartAtWindowsStartup); + AppApi.SetStartup(this.isStartAtWindowsStartup); }; $app.watch.isStartAtWindowsStartup = saveVRCXWindowOption; $app.watch.isStartAsMinimizedState = saveVRCXWindowOption; @@ -5635,9 +5636,9 @@ import gameLogService from './service/gamelog.js' if (this.openVR && this.isGameNoVR === false && (this.isGameRunning || this.openVRAlways)) { - VRCX.StartVR(); + AppApi.StartVR(); } else { - VRCX.StopVR(); + AppApi.StopVR(); } }; @@ -7337,7 +7338,7 @@ import gameLogService from './service/gamelog.js' if (D.desktop === true) { args.push('--no-vr'); } - VRCX.StartGame(args.join(' ')); + AppApi.StartGame(args.join(' ')); D.visible = false; }; diff --git a/html/src/vr.js b/html/src/vr.js index e0694dd7..94618f2d 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -15,8 +15,8 @@ import webApiService from './service/webapi.js'; (async function () { await CefSharp.BindObjectAsync( + 'AppApi', 'WebApi', - 'VRCX', 'SharedVariable', 'SQLite' ); @@ -616,7 +616,7 @@ import webApiService from './service/webapi.js'; this.currentTime = new Date().toJSON(); this.currentUserStatus = sharedRepository.getString('current_user_status'); if (configRepository.getBool('VRCX_hideDevicesFromFeed') === false) { - VRCX.GetVRDevices().then((devices) => { + AppApi.GetVRDevices().then((devices) => { devices.forEach((device) => { device[2] = parseInt(device[2], 10); }); @@ -635,7 +635,7 @@ import webApiService from './service/webapi.js'; $app.methods.updateCpuUsageLoop = async function () { try { - var cpuUsage = await VRCX.CpuUsage(); + var cpuUsage = await AppApi.CpuUsage(); this.cpuUsage = cpuUsage.toFixed(2); } catch (err) { console.error(err);