feat: skip connect and terminal mount for remote sessions in openSession
When opts.sourceUrl is non-empty (remote session), skip the POST
/api/sessions/{name}/connect call and skip window._openTerminal(name).
Remote terminal connections are deferred to Phase 3.
Local sessions (empty sourceUrl) continue to work as before.
Co-authored-by: Amplifier <amplifier@amplified.dev>
This commit is contained in:
@@ -1086,10 +1086,13 @@ async function openSession(name, opts = {}) {
|
|||||||
if (fab) fab.classList.add('hidden');
|
if (fab) fab.classList.add('hidden');
|
||||||
|
|
||||||
// Connect to session (kill old ttyd, spawn new one for this session)
|
// Connect to session (kill old ttyd, spawn new one for this session)
|
||||||
|
var sourceUrl = opts.sourceUrl || '';
|
||||||
try {
|
try {
|
||||||
if (!opts.skipConnect) {
|
if (!opts.skipConnect) {
|
||||||
|
if (!sourceUrl) {
|
||||||
await api('POST', `/api/sessions/${name}/connect`);
|
await api('POST', `/api/sessions/${name}/connect`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showToast(err.message || 'Connection failed');
|
showToast(err.message || 'Connection failed');
|
||||||
return closeSession();
|
return closeSession();
|
||||||
@@ -1099,7 +1102,7 @@ async function openSession(name, opts = {}) {
|
|||||||
await animDone;
|
await animDone;
|
||||||
|
|
||||||
// Mount terminal NOW — /connect has completed, new ttyd is serving the correct session
|
// Mount terminal NOW — /connect has completed, new ttyd is serving the correct session
|
||||||
if (window._openTerminal) window._openTerminal(name);
|
if (!sourceUrl && window._openTerminal) window._openTerminal(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user