From fbfa3ad19908fb1380187a6b2f5d35c7bbaaf2d7 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Tue, 29 Mar 2022 03:28:16 +1300 Subject: [PATCH] $app.toggleCustomEndpoint(); 1 --- html/src/app.js | 20 ++++++++++++++++---- html/src/index.pug | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index a61bc33f..88104d7f 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -363,7 +363,9 @@ speechSynthesis.getVoices(); API.pendingGetRequests = new Map(); API.failedGetRequests = new Map(); API.endpointDomainVrchat = 'https://api.vrchat.cloud/api/1'; + API.websocketDomainVrchat = 'wss://pipeline.vrchat.cloud'; API.endpointDomain = 'https://api.vrchat.cloud/api/1'; + API.websocketDomain = 'wss://pipeline.vrchat.cloud'; API.call = function (endpoint, options) { var init = { @@ -3821,9 +3823,7 @@ speechSynthesis.getVoices(); API.connectWebSocket = function (token) { if (this.webSocket === null) { - var socket = new WebSocket( - `wss://pipeline.vrchat.cloud/?auth=${token}` - ); + var socket = new WebSocket(`${API.websocketDomain}/?auth=${token}`); socket.onclose = () => { if (this.webSocket === socket) { this.webSocket = null; @@ -5993,8 +5993,10 @@ speechSynthesis.getVoices(); } if (loginParmas.endpoint) { API.endpointDomain = loginParmas.endpoint; + API.websocketDomain = loginParmas.websocket; } else { API.endpointDomain = API.endpointDomainVrchat; + API.websocketDomain = API.websocketDomainVrchat; } return new Promise((resolve, reject) => { if (this.enablePrimaryPassword) { @@ -6040,7 +6042,8 @@ speechSynthesis.getVoices(); API.login({ username: loginParmas.username, password: loginParmas.password, - endpoint: loginParmas.endpoint + endpoint: loginParmas.endpoint, + websocket: loginParmas.websocket }) .catch(() => { this.loginForm.loading = false; @@ -6096,6 +6099,7 @@ speechSynthesis.getVoices(); username: '', password: '', endpoint: '', + websocket: '', saveCredentials: false, savedCredentials: configRepository.getString('lastUserLoggedIn') !== null @@ -6124,8 +6128,10 @@ speechSynthesis.getVoices(); this.loginForm.loading = true; if (this.loginForm.endpoint) { API.endpointDomain = this.loginForm.endpoint; + API.websocketDomain = this.loginForm.websocket; } else { API.endpointDomain = API.endpointDomainVrchat; + API.websocketDomain = API.websocketDomainVrchat; } API.getConfig() .catch((err) => { @@ -6174,6 +6180,9 @@ speechSynthesis.getVoices(); endpoint: this.loginForm .endpoint, + websocket: + this.loginForm + .websocket, saveCredentials: this.loginForm .saveCredentials, @@ -6185,6 +6194,8 @@ speechSynthesis.getVoices(); ''; this.loginForm.endpoint = ''; + this.loginForm.websocket = + ''; }); }); }); @@ -6198,6 +6209,7 @@ speechSynthesis.getVoices(); username: this.loginForm.username, password: this.loginForm.password, endpoint: this.loginForm.endpoint, + websocket: this.loginForm.websocket, saveCredentials: this.loginForm.saveCredentials }).finally(() => { this.loginForm.username = ''; diff --git a/html/src/index.pug b/html/src/index.pug index 2e453f2a..b9ab9d02 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -37,6 +37,8 @@ html el-input(type="password" v-model="loginForm.password" name="password" placeholder="Password" clearable show-password) el-form-item(v-if="enableCustomEndpoint" label="Endpont" prop="endpoint" style="margin-top:10px") el-input(v-model="loginForm.endpoint" name="endpoint" placeholder="Endpoint URL" clearable) + el-form-item(v-if="enableCustomEndpoint" label="WebSocket" prop="endpoint" style="margin-top:10px") + el-input(v-model="loginForm.websocket" name="websocket" placeholder="WebSocket URL" clearable) el-checkbox(v-model="loginForm.saveCredentials" style="margin-top:15px") Save Credentials el-form-item(style="margin-top:15px") el-button(native-type="submit" type="primary" :loading="loginForm.loading" style="width:100%") Login