Enable reliable native window dragging and hand authenticated sessions into the selected node's complete web experience

Hop-State: A_06FPG2TG1QGADXPK4Z3JRK8
Hop-Proposal: R_06FPG2STVE3YFFK1MMCXN7R
Hop-Task: T_06FPG0V9Q74727J7JHZVD20
Hop-Attempt: AT_06FPG0V9Q4RS0GRDVR1GXVG
This commit is contained in:
2026-07-15 16:09:59 -07:00
committed by Hop
parent 0695655ccf
commit f7623457a0
6 changed files with 142 additions and 25 deletions
+31 -12
View File
@@ -238,16 +238,31 @@ function App() {
setBootstrapping(false);
return;
}
invoke<Connection>("connect", { nodeUrl: savedNode })
.then((connection) => {
async function restore() {
try {
const hasWebSession = await invoke<boolean>("has_web_session", { nodeUrl: savedNode });
if (hasWebSession) {
await invoke("open_web_app", { nodeUrl: savedNode });
return;
}
const connection = await invoke<Connection>("connect", { nodeUrl: savedNode });
setNodeUrl(connection.nodeUrl);
setNode(connection.node);
setNodeInput(displayHost(connection.nodeUrl));
setUser(connection.user);
setScreen(connection.user ? "home" : "login");
})
.catch(() => setScreen("node"))
.finally(() => setBootstrapping(false));
if (connection.user) {
await invoke("open_web_app", { nodeUrl: connection.nodeUrl });
} else {
setScreen("login");
}
} catch {
setScreen("node");
} finally {
setBootstrapping(false);
}
}
void restore();
}, []);
async function connect(event: FormEvent) {
@@ -264,7 +279,11 @@ function App() {
setNodeUrl(connection.nodeUrl);
setNode(connection.node);
setUser(connection.user);
setScreen(connection.user ? "home" : "login");
if (connection.user) {
await invoke("open_web_app", { nodeUrl: connection.nodeUrl });
} else {
setScreen("login");
}
} catch (caught) {
setError(readableError(caught));
} finally {
@@ -284,7 +303,7 @@ function App() {
password: data.get("password"),
});
setUser(response.user);
setScreen("home");
await invoke("open_web_app", { nodeUrl });
} catch (caught) {
setError(readableError(caught));
} finally {
@@ -311,7 +330,7 @@ function App() {
password,
});
setUser(response.user);
setScreen("home");
await invoke("open_web_app", { nodeUrl });
} catch (caught) {
setError(readableError(caught));
} finally {
@@ -343,7 +362,7 @@ function App() {
const name = user.displayName?.trim() || user.handle.replace(/^@/, "").split("@")[0];
return (
<main className="app-shell">
<aside className="sidebar" data-tauri-drag-region>
<aside className="sidebar" data-tauri-drag-region="deep">
<div className="sidebar-brand"><Wordmark className="sidebar-wordmark"/></div>
<nav aria-label="Main navigation">
<button className="nav-item active"><Icon name="home"/><span>Home</span></button>
@@ -360,7 +379,7 @@ function App() {
</div>
</aside>
<section className="home-content">
<header className="home-header" data-tauri-drag-region><h1>Home</h1><span className="connected-pill"><i/>Connected</span></header>
<header className="home-header" data-tauri-drag-region="deep"><h1>Home</h1><span className="connected-pill"><i/>Connected</span></header>
<div className="home-empty">
<div className="orbit-mark"><span/><span/><i/></div>
<p className="eyebrow">SESSION ESTABLISHED</p>
@@ -374,7 +393,7 @@ function App() {
return (
<main className="onboarding-shell">
<section className="signal-panel" data-tauri-drag-region>
<section className="signal-panel" data-tauri-drag-region="deep">
<SignalField/>
<div className="signal-shade"/>
<div className="panel-brand"><Wordmark className="panel-wordmark"/></div>