Skip to content

Commit

Permalink
Progate names to the server
Browse files Browse the repository at this point in the history
This resolves #6.
  • Loading branch information
ekzhang committed Oct 7, 2023
1 parent d14641e commit 85e3d07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/sshx-server/src/web/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ async fn handle_socket(mut socket: WebSocket, session: Arc<Session>) -> Result<(
match msg {
WsClient::Authenticate(_) => {}
WsClient::SetName(name) => {
session.update_user(user_id, |user| user.name = name)?;
if !name.is_empty() {
session.update_user(user_id, |user| user.name = name)?;
}
}
WsClient::SetCursor(cursor) => {
session.update_user(user_id, |user| user.cursor = cursor)?;
Expand Down
8 changes: 8 additions & 0 deletions src/lib/Session.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { slide } from "./action/slide";
import { TouchZoom, INITIAL_ZOOM } from "./action/touchZoom";
import { arrangeNewTerminal } from "./arrange";
import { settings } from "./settings";
export let id: string;
Expand Down Expand Up @@ -180,6 +181,9 @@
onConnect() {
srocket?.send({ authenticate: encryptedZeros });
if ($settings.name) {
srocket?.send({ setName: $settings.name });
}
connected = true;
},
Expand All @@ -199,6 +203,10 @@
onDestroy(() => srocket?.dispose());
$: if ($settings.name) {
srocket?.send({ setName: $settings.name });
}
let counter = 0n;
async function handleCreate() {
Expand Down

0 comments on commit 85e3d07

Please sign in to comment.