fix(core): 修复在线版 compiler 连接server时url异常
This commit is contained in:
@@ -26,7 +26,13 @@ const { SOFTWARE } = Config;
|
||||
Loader.init = function () {
|
||||
let url = '';
|
||||
if (SOFTWARE.webCompiler?.url) {
|
||||
url = SOFTWARE.webCompiler.url;
|
||||
const info = new window.URL(SOFTWARE.webCompiler.url);
|
||||
if (info.hostname === 'default') {
|
||||
info.hostname = window.location.hostname;
|
||||
url = info.origin;
|
||||
} else {
|
||||
url = SOFTWARE.webCompiler.url;
|
||||
}
|
||||
} else {
|
||||
url = `wss://${window.location.host}`;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,13 @@ const { SOFTWARE } = Config;
|
||||
Loader.init = function () {
|
||||
let url = '';
|
||||
if (SOFTWARE.webSocket?.url) {
|
||||
url = SOFTWARE.webSocket.url;
|
||||
const info = new window.URL(SOFTWARE.webSocket.url);
|
||||
if (info.hostname === 'default') {
|
||||
info.hostname = window.location.hostname;
|
||||
url = info.origin;
|
||||
} else {
|
||||
url = SOFTWARE.webSocket.url;
|
||||
}
|
||||
} else {
|
||||
url = `wss://${window.location.host}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user