fix(core): 修复在线版 compiler 连接server时url异常

This commit is contained in:
王立帮
2025-05-12 13:20:10 +08:00
parent fe66cfe4f5
commit 13463ce183
2 changed files with 14 additions and 2 deletions

View File

@@ -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}`;
}

View File

@@ -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}`;
}