From 1efb88acb080f4f5aa4a0f4faac6279b00ae9ad0 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Mon, 24 May 2021 23:33:59 +1200 Subject: [PATCH] Direct access world URL --- html/src/app.js | 26 ++++++++++++++++++++------ html/src/index.pug | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index 4b486602..b2f11321 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -7526,16 +7526,22 @@ speechSynthesis.getVoices(); }; $app.methods.promptWorldDialog = function () { - this.$prompt('Enter a World ID (UUID)', 'Direct Access', { + this.$prompt('Enter a World URL or ID (UUID)', 'Direct Access', { distinguishCancelAndClose: true, confirmButtonText: 'OK', cancelButtonText: 'Cancel', inputPattern: /\S+/, - inputErrorMessage: 'World ID is required', + inputErrorMessage: 'World URL/ID is required', callback: (action, instance) => { if (action === 'confirm' && instance.inputValue) { - this.showWorldDialog(instance.inputValue); + var testUrl = instance.inputValue.substring(0, 15); + if (testUrl === 'https://vrchat.') { + var worldInstance = this.parseLocationUrl(instance.inputValue); + this.showWorldDialog(worldInstance); + } else { + this.showWorldDialog(instance.inputValue); + } } } }); @@ -9450,19 +9456,19 @@ speechSynthesis.getVoices(); } nonce = nonce.join('').substr(0, 64); */ - tags.push(`~nonce(${uuidv4()})`); if (D.accessType === 'invite+') { tags.push('~canRequestInvite'); } + tags.push(`~nonce(${uuidv4()})`); } D.instanceId = tags.join(''); }; var getLaunchURL = function (worldId, instanceId) { if (instanceId) { - return `https://vrchat.net/launch?worldId=${encodeURIComponent(worldId)}&instanceId=${encodeURIComponent(instanceId)}`; + return `https://vrchat.com/home/launch?worldId=${encodeURIComponent(worldId)}&instanceId=${encodeURIComponent(instanceId)}`; } - return `https://vrchat.net/launch?worldId=${encodeURIComponent(worldId)}`; + return `https://vrchat.com/home/launch?worldId=${encodeURIComponent(worldId)}`; }; var updateLocationURL = function () { @@ -11740,6 +11746,14 @@ speechSynthesis.getVoices(); $app.downloadDialog.visible = false; }); + // Parse location URL + $app.methods.parseLocationUrl = function (url) { + var urlParams = new URLSearchParams(url.search); + var worldId = urlParams.get('worldId'); + var instanceId = urlParams.get('instanceId'); + return `${worldId}:${instanceId}`; + }; + $app = new Vue($app); window.$app = $app; }()); diff --git a/html/src/index.pug b/html/src/index.pug index f8881f90..3bd824e8 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -492,7 +492,7 @@ html div(style="margin-top:10px") el-button-group el-button(size="small" @click="promptUserDialog()") User - el-button(size="small" @click="promptWorldDialog()") World + el-button(size="small" @click="promptWorldDialog()") World/Instance el-button(size="small" @click="promptAddAvatarFavoriteDialog()") Avatar div.options-container span.header Invite Messages