diff --git a/VRCX.cs b/VRCX.cs index b332073e6..1483eca9c 100644 --- a/VRCX.cs +++ b/VRCX.cs @@ -4,7 +4,11 @@ // For a copy, see . using CefSharp; +using Microsoft.Win32; using System; +using System.Diagnostics; +using System.Text; +using System.Text.RegularExpressions; using System.Windows.Forms; namespace VRCX @@ -39,17 +43,45 @@ public bool IsGameRunning() return WinApi.FindWindow("UnityWndClass", "VRChat") != IntPtr.Zero; } - public void StartGame(string location) + public void StartGame(string location, bool desktop) { try { - System.Diagnostics.Process.Start("vrchat://launch?id=" + location); + using (var key = Registry.ClassesRoot.OpenSubKey(@"VRChat\shell\open\command")) + { + // "C:\Program Files (x86)\Steam\steamapps\common\VRChat\launch.bat" "C:\Program Files (x86)\Steam\steamapps\common\VRChat" "%1" + var match = Regex.Match(key.GetValue(string.Empty) as string, "^\"(.+\\\\VRChat)\\\\launch.bat\""); + if (match.Success) + { + var path = match.Groups[1].Value; + var args = new StringBuilder(); + if (desktop) + { + args.Append("--no-vr "); + } + args.Append("\"vrchat://launch?id="); + args.Append(location); + args.Append('"'); + Process.Start(new ProcessStartInfo + { + WorkingDirectory = path, + FileName = path + "\\VRChat.exe", + UseShellExecute = false, + Arguments = args.ToString() + }).Close(); + } + } } catch { } } + public void OpenRepository() + { + Process.Start("https://github.com/pypy-vrc/VRCX").Close(); + } + public void ShowVRForm() { try diff --git a/html/app.css b/html/app.css index 604617b7e..2c2e16edd 100644 --- a/html/app.css +++ b/html/app.css @@ -64,6 +64,10 @@ For a copy, see . padding: 20px; } +.el-dialog__footer>.el-button+.el-button { + margin-left: 5px; +} + ::-webkit-scrollbar { width: 8px; height: 8px; @@ -135,14 +139,24 @@ body, input, textarea, select, button { border: 0; } +.el-menu-item.is-active::before { + position: absolute; + content: ''; + left: 1px; + top: 4px; + width: 2px; + height: 48px; + background: #DCDFE6; +} + .el-menu-item.notify::after { position: absolute; content: ''; - right: 5px; - top: 5px; - width: 5px; - height: 5px; - background: #909399; + right: 4px; + top: 4px; + width: 6px; + height: 6px; + background: #EBEEF5; border-radius: 50% } diff --git a/html/app.js b/html/app.js index d6adefc08..3c1c34a64 100644 --- a/html/app.js +++ b/html/app.js @@ -92,10 +92,12 @@ if (window.CefSharp) { setInterval(() => VRCXStorage.Flush(), 5 * 60 * 1000); Noty.overrideDefaults({ + /* animation: { open: 'animated bounceInLeft', close: 'animated bounceOutLeft' }, + */ layout: 'bottomLeft', theme: 'mint', timeout: 6000 @@ -825,6 +827,8 @@ if (window.CefSharp) { id: ref.id, username: '', displayName: '', + bio: '', + bioLinks: [], pastDisplayNames: [], friends: [], currentAvatarImageUrl: '', @@ -938,6 +942,8 @@ if (window.CefSharp) { id: ref.id, username: '', displayName: '', + bio: '', + bioLinks: [], currentAvatarImageUrl: '', currentAvatarThumbnailImageUrl: '', status: '', @@ -3471,7 +3477,7 @@ if (window.CefSharp) { VRCX, nextRefresh: 0, isGameRunning: false, - appVersion: '2019.10.31.1', + appVersion: 'VRCX 2019.11.18', latestAppVersion: '', ossDialog: false }, @@ -3509,6 +3515,17 @@ if (window.CefSharp) { if (json.name && json.published_at) { this.latestAppVersion = `${json.name} (${formatDate(json.published_at, 'YYYY-MM-DD HH24:MI:SS')})`; + if (json.name > this.appVersion) { + new Noty({ + type: 'info', + text: `Update available!!
${this.latestAppVersion}`, + timeout: false, + callbacks: { + onClick: () => VRCX.OpenRepository() + } + }).show(); + this.notifyMenu('more'); + } } else { this.latestAppVersion = 'Error occured'; } @@ -3653,28 +3670,6 @@ if (window.CefSharp) { } }; - $app.methods.showLaunchDialog = function (tag) { - var L = API.parseLocation(tag); - if (L.worldId) { - this.$msgbox({ - title: 'Launch World', - message: `${escapeTag(`https://vrchat.net/launch?worldId=${encodeURIComponent(L.worldId)}&instanceId=${encodeURIComponent(L.instanceId)}`)}`, - dangerouslyUseHTMLString: true, - distinguishCancelAndClose: true, - showCancelButton: true, - cancelButtonText: 'Invite', - confirmButtonText: 'Launch', - callback: (action) => { - if (action === 'confirm') { - VRCX.StartGame(tag); - } else if (action === 'cancel') { - $app.showInviteDialog(tag); - } - } - }); - } - }; - $app.methods.promptTOTP = function () { this.$prompt('Enter a numeric code from your authenticator app', 'Two-factor Authentication', { distinguishCancelAndClose: true, @@ -6834,7 +6829,7 @@ if (window.CefSharp) { $app.watch['newInstanceDialog.instanceId'] = updateLocationURL; $app.methods.showNewInstanceDialog = function (tag) { - this.$nextTick(() => adjustDialogZ(this.$refs.inviteDialog.$el)); + this.$nextTick(() => adjustDialogZ(this.$refs.newInstanceDialog.$el)); var L = API.parseLocation(tag); if (!(L.isOffline || L.isPrivate) && L.worldId) { @@ -6867,6 +6862,47 @@ if (window.CefSharp) { }); }; + // App: Launch Dialog + + $app.data.launchDialog = { + visible: false, + loading: false, + desktop: VRCXStorage.GetBool('launchAsDesktop'), + location: '', + url: '' + }; + + $app.watch['launchDialog.desktop'] = function () { + VRCXStorage.SetBool('launchAsDesktop', this.launchDialog.desktop); + }; + + API.$on('LOGOUT', () => { + $app.launchDialog.visible = false; + }); + + $app.methods.showLaunchDialog = function (tag) { + this.$nextTick(() => adjustDialogZ(this.$refs.launchDialog.$el)); + var L = API.parseLocation(tag); + if (!(L.isOffline || L.isPrivate) && + L.worldId) { + var D = this.launchDialog; + if (L.instanceId) { + D.location = `${L.worldId}:${L.instanceId}`; + D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(L.worldId)}&instanceId=${encodeURIComponent(L.instanceId)}`; + } else { + D.location = L.worldId; + D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(L.worldId)}`; + } + D.visible = true; + } + }; + + $app.methods.launchGame = function () { + var D = this.launchDialog; + VRCX.StartGame(D.location, D.desktop); + D.visible = false; + }; + $app = new Vue($app); window.$app = $app; }); diff --git a/html/index.html b/html/index.html index 0402390e0..43ff4aa11 100644 --- a/html/index.html +++ b/html/index.html @@ -431,7 +431,7 @@ {{ scope.row.previousDisplayName }}   @@ -549,7 +549,7 @@ Click to refresh -
+
Repository URL https://github.com/pypy-vrc/VRCX @@ -669,7 +669,7 @@
Online Users - {{visits}} Users online. + {{visits}} users online. Click to refresh
@@ -1417,7 +1417,17 @@ + + + + +
+