Remove LAN access badge; show server IP in SERVER label
This commit is contained in:
+4
-31
@@ -15444,36 +15444,7 @@ const App = () => {
|
||||
})
|
||||
})));
|
||||
}, [bpm]);
|
||||
// LAN access badge (standalone): server bind 0.0.0.0 — client browser ở máy
|
||||
// khác trên mạng mở app qua http://<LAN-IP>:port. Hiện URL trên máy chủ;
|
||||
// client LAN thấy origin đang dùng.
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
let bar = null;
|
||||
let iv = null;
|
||||
const tryShow = () => {
|
||||
const caps = window.SonicRuntime && window.SonicRuntime.capabilities;
|
||||
const lan = caps && caps.lan;
|
||||
if (!lan || !lan.urls || !lan.urls.length) return false;
|
||||
if (document.getElementById('sf-lan-bar')) return true;
|
||||
const hostname = window.location.hostname;
|
||||
const isLocal = hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';
|
||||
bar = document.createElement('div');
|
||||
bar.id = 'sf-lan-bar';
|
||||
bar.style.cssText = 'position:fixed;top:8px;right:12px;z-index:9999;background:rgba(16,185,129,0.12);border:1px solid #10b981;color:#a7f3d0;font-size:11px;line-height:1.5;padding:6px 10px;border-radius:8px;max-width:min(70vw,420px);cursor:default;';
|
||||
bar.title = 'Client browser ở máy khác trên LAN mở địa chỉ này để làm việc realtime với máy chạy SonicForge';
|
||||
bar.innerHTML = isLocal
|
||||
? '<b>LAN:</b> ' + lan.urls.map(function (u) { return '<a href="' + u + '" target="_blank" style="color:#a7f3d0;text-decoration:underline">' + u + '</a>'; }).join(' · ')
|
||||
: '<b>Kết nối:</b> ' + window.location.origin;
|
||||
document.body.appendChild(bar);
|
||||
return true;
|
||||
};
|
||||
if (!tryShow()) {
|
||||
iv = setInterval(function () { if (mounted && tryShow()) clearInterval(iv); }, 700);
|
||||
setTimeout(function () { if (iv) clearInterval(iv); }, 20000);
|
||||
}
|
||||
return () => { mounted = false; if (iv) clearInterval(iv); if (bar && bar.parentNode) bar.parentNode.removeChild(bar); };
|
||||
}, []);
|
||||
// LAN badge removed per request: server IP now shown in SERVER label.
|
||||
const openPanel = id => {
|
||||
if (id === 'export') setShowExportPanel(true); else if (id === 'ai') setShowAIPanel(true); else if (id === 'python_tools') setShowPythonToolsPanel(true); else if (id === 'selection') setShowSelectionPanel(true);
|
||||
};
|
||||
@@ -16344,6 +16315,8 @@ const App = () => {
|
||||
channels: 'stereo'
|
||||
});
|
||||
const [serverStatus, setServerStatus] = useState('checking...');
|
||||
const _lan = window.SonicRuntime && window.SonicRuntime.capabilities && window.SonicRuntime.capabilities.lan;
|
||||
const serverHost = _lan && _lan.urls && _lan.urls[0] ? (function () { try { return new URL(_lan.urls[0]).hostname; } catch (e) { return null; } })() : window.location.hostname;
|
||||
const [menuOpen, setMenuOpen] = useState(null);
|
||||
const [selectedClipId, setSelectedClipId] = useState(null); // { trackId, clipId }
|
||||
const [stretchedClip, setStretchedClip] = useState(null); // { trackId, clipId, originalDuration, startTime, originalSpeed, beforeSnap }
|
||||
@@ -28488,7 +28461,7 @@ STRICT CONSTRAINTS:
|
||||
className: "flex items-center gap-2 px-2"
|
||||
}, /*#__PURE__*/React.createElement("span", {
|
||||
className: `text-xs font-bold uppercase px-1.5 py-0.5 rounded ${serverStatus === 'connected' ? 'bg-emerald-950 text-emerald-400' : serverStatus === 'checking' ? 'bg-amber-950 text-amber-400' : 'bg-red-950 text-red-400'}`
|
||||
}, "Server: ", serverStatus), /*#__PURE__*/React.createElement("button", {
|
||||
}, "Server: ", serverStatus, serverHost ? " · " + serverHost : ""), /*#__PURE__*/React.createElement("button", {
|
||||
onClick: () => setShowAIConfig(!showAIConfig),
|
||||
className: `px-1.5 py-0.5 rounded text-xs border transition ${showAIConfig ? 'bg-purple-900 text-purple-200 border-purple-700' : 'bg-zinc-800 text-zinc-400 border-zinc-700 hover:text-zinc-200'}`
|
||||
}, /*#__PURE__*/React.createElement("span", {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user