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",
"require": [
"Mixly.Debug",
"Mixly.Config",
"Mixly.StatusBarsManager",
"Mixly.Socket",
"Mixly.WebCompiler.ArduShell"
@@ -1845,6 +1846,7 @@
"path": "/web-socket/loader.js",
"require": [
"Mixly.Debug",
"Mixly.Config",
"Mixly.StatusBarsManager",
"Mixly.Socket",
"Mixly.WebSocket.Serial",

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,

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.WebSocket.Serial');
@@ -11,6 +12,7 @@ goog.provide('Mixly.WebSocket.Loader');
const {
Debug,
Config,
StatusBarsManager,
Socket,
WebSocket
@@ -24,9 +26,17 @@ const {
Ampy
} = WebSocket;
const { SOFTWARE } = Config;
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/',
reconnection: true,
reconnectionDelayMax: 10000,

View File

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