feat(core): 在线版 compiler 模式下允许自定义url

This commit is contained in:
王立帮
2025-05-08 23:06:26 +08:00
parent ca02dacec8
commit 3b10f7742c
4 changed files with 26 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
goog.loadJs('web', () => {
goog.require('Mixly.Debug');
goog.require('Mixly.Config');
goog.require('Mixly.StatusBarsManager');
goog.require('Mixly.Socket');
goog.require('Mixly.WebCompiler.ArduShell');
@@ -8,6 +9,7 @@ goog.provide('Mixly.WebCompiler.Loader');
const {
Debug,
Config,
StatusBarsManager,
Socket,
WebCompiler
@@ -18,9 +20,17 @@ const {
ArduShell
} = WebCompiler;
const { SOFTWARE } = Config;
Loader.init = function () {
const mixlySocket = new Socket(`wss://${location.hostname}:4000/compile`, {
let url = '';
if (SOFTWARE.webCompiler?.url) {
url = SOFTWARE.webCompiler.url;
} else {
url = `wss://${window.location.host}`;
}
const mixlySocket = new Socket(`${url}/compile`, {
path: '/mixly-socket/',
reconnection: true,
reconnectionDelayMax: 10000,