fix: 默认本地配置判断baseUrl支持https

This commit is contained in:
TsMask
2025-03-14 16:39:27 +08:00
parent 95fc2086e6
commit d3cbf2b748

View File

@@ -10,12 +10,17 @@
* *
*/ */
(function () { (function () {
// host = ip:port // baseUrl = protocol://ip:port
// const host = '192.168.8.100:33030'; // baseUrl = 'http://192.168.8.100:33030';
const host = `${window.location.hostname}:33030`; const protocol = window.location.protocol
const hostname = window.location.hostname
let host = `${hostname}:33030`;
if (protocol === 'https:') {
host = `${hostname}:33443`;
}
// Service Address // Service Address
sessionStorage.setItem('baseUrl', `http://${host}`); sessionStorage.setItem('baseUrl', `${protocol}//${host}`);
// websocket Address // websocket Address
sessionStorage.setItem('wsUrl', `ws://${host}`); sessionStorage.setItem('wsUrl', `ws://${host}`);
})(); })();