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.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,