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

@@ -1750,6 +1750,7 @@
"path": "/web-compiler/loader.js", "path": "/web-compiler/loader.js",
"require": [ "require": [
"Mixly.Debug", "Mixly.Debug",
"Mixly.Config",
"Mixly.StatusBarsManager", "Mixly.StatusBarsManager",
"Mixly.Socket", "Mixly.Socket",
"Mixly.WebCompiler.ArduShell" "Mixly.WebCompiler.ArduShell"
@@ -1845,6 +1846,7 @@
"path": "/web-socket/loader.js", "path": "/web-socket/loader.js",
"require": [ "require": [
"Mixly.Debug", "Mixly.Debug",
"Mixly.Config",
"Mixly.StatusBarsManager", "Mixly.StatusBarsManager",
"Mixly.Socket", "Mixly.Socket",
"Mixly.WebSocket.Serial", "Mixly.WebSocket.Serial",

View File

@@ -1,6 +1,7 @@
goog.loadJs('web', () => { goog.loadJs('web', () => {
goog.require('Mixly.Debug'); goog.require('Mixly.Debug');
goog.require('Mixly.Config');
goog.require('Mixly.StatusBarsManager'); goog.require('Mixly.StatusBarsManager');
goog.require('Mixly.Socket'); goog.require('Mixly.Socket');
goog.require('Mixly.WebCompiler.ArduShell'); goog.require('Mixly.WebCompiler.ArduShell');
@@ -8,6 +9,7 @@ goog.provide('Mixly.WebCompiler.Loader');
const { const {
Debug, Debug,
Config,
StatusBarsManager, StatusBarsManager,
Socket, Socket,
WebCompiler WebCompiler
@@ -18,9 +20,17 @@ const {
ArduShell ArduShell
} = WebCompiler; } = WebCompiler;
const { SOFTWARE } = Config;
Loader.init = function () { 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/', path: '/mixly-socket/',
reconnection: true, reconnection: true,
reconnectionDelayMax: 10000, reconnectionDelayMax: 10000,

View File

@@ -1,6 +1,7 @@
goog.loadJs('web', () => { goog.loadJs('web', () => {
goog.require('Mixly.Debug'); goog.require('Mixly.Debug');
goog.require('Mixly.Config');
goog.require('Mixly.StatusBarsManager'); goog.require('Mixly.StatusBarsManager');
goog.require('Mixly.Socket'); goog.require('Mixly.Socket');
goog.require('Mixly.WebSocket.Serial'); goog.require('Mixly.WebSocket.Serial');
@@ -11,6 +12,7 @@ goog.provide('Mixly.WebSocket.Loader');
const { const {
Debug, Debug,
Config,
StatusBarsManager, StatusBarsManager,
Socket, Socket,
WebSocket WebSocket
@@ -24,9 +26,17 @@ const {
Ampy Ampy
} = WebSocket; } = WebSocket;
const { SOFTWARE } = Config;
Loader.init = function () { Loader.init = function () {
const mixlySocket = new Socket(`wss://${location.hostname}:4000/all`, { let url = '';
if (SOFTWARE.webSocket?.url) {
url = SOFTWARE.webSocket.url;
} else {
url = `wss://${window.location.host}`;
}
const mixlySocket = new Socket(`${url}/all`, {
path: '/mixly-socket/', path: '/mixly-socket/',
reconnection: true, reconnection: true,
reconnectionDelayMax: 10000, reconnectionDelayMax: 10000,

View File

@@ -18,9 +18,11 @@
} }
}, },
"webSocket": { "webSocket": {
"url": "",
"enabled": false "enabled": false
}, },
"webCompiler": { "webCompiler": {
"url": "",
"enabled": false "enabled": false
}, },
"behaviorRecord": { "behaviorRecord": {