Changed how the _config in AssistManager construct

- Changed URL().host to URL().hostname so it wont attached port while the config set again another port and causing duplicate port when connect using peerjs. 
- Changed the port in the config to check first if the URL() has port defined, then using the defined port first, so user can use custom port number for ws, when there is no custom port defined at the domainUrl, then it will then check https or not and append the correct port.
This commit is contained in:
NoGameNoFun 2021-12-29 09:33:16 +08:00 committed by GitHub
parent 5b8747d466
commit 3412bf1567
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,12 +147,13 @@ export default class AssistManager {
return;
}
this.setStatus(ConnectionStatus.Connecting)
const urlObject = new URL(window.ENV.API_EDP)
import('peerjs').then(({ default: Peer }) => {
const _config = {
// @ts-ignore
host: new URL(window.ENV.API_EDP).host,
host: urlObject.hostname,
path: '/assist',
port: location.protocol === 'https:' ? 443 : 80,
port: urlObject.port === "" ? location.protocol === 'https:' ? 443 : 80 : urlObject.port,
}
if (this.config) {