From 7006b4ea0988fc6a26d327569706af0c92453b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sat, 1 Aug 2026 09:41:10 +0200 Subject: [PATCH] fixes --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/websocket/mod.rs | 43 +-------------------------------- src/websocket/pad.rs | 2 +- static/css/styles.css | 4 ++-- static/editor.html | 44 +++++----------------------------- static/home.html | 4 ++-- static/js/auth-ui.js | 52 +++++++++++++++++++++------------------- static/js/note-editor.js | 12 ---------- static/js/socket.js | 18 -------------- static/workspace.html | 2 +- 11 files changed, 42 insertions(+), 143 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10d9bff..674b6ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,7 +2581,7 @@ dependencies = [ [[package]] name = "rustpad" -version = "0.2.16" +version = "0.2.17" dependencies = [ "argon2", "aws-config", diff --git a/Cargo.toml b/Cargo.toml index b93f504..36ab70c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustpad" -version = "0.2.16" +version = "0.2.17" edition = "2024" rust-version = "1.94" description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL" diff --git a/src/websocket/mod.rs b/src/websocket/mod.rs index e000e4f..221857b 100644 --- a/src/websocket/mod.rs +++ b/src/websocket/mod.rs @@ -33,14 +33,6 @@ struct ClientDiagnostics { timezone: Option, #[serde(default)] platform: Option, - #[serde(default)] - effective_type: Option, - #[serde(default)] - downlink_mbps: Option, - #[serde(default)] - network_rtt_ms: Option, - #[serde(default)] - save_data: Option, } #[derive(Debug, Clone)] @@ -48,7 +40,6 @@ struct RequestClientContext { client_id: String, user_agent: Option, accept_language: Option, - request_scheme: Option, } impl RequestClientContext { @@ -58,13 +49,6 @@ impl RequestClientContext { client_id: hex::encode(&digest[..8]), user_agent: diagnostic_header(headers, header::USER_AGENT.as_str(), 180), accept_language: diagnostic_header(headers, header::ACCEPT_LANGUAGE.as_str(), 100), - request_scheme: diagnostic_header(headers, "x-forwarded-proto", 12).or_else(|| { - headers - .get(header::ORIGIN) - .and_then(|value| value.to_str().ok()) - .and_then(|value| value.split_once("://").map(|(scheme, _)| scheme)) - .and_then(|value| clean_diagnostic_text(Some(value.to_owned()), 12)) - }), } } } @@ -81,23 +65,13 @@ struct DiagnosticClient { id: String, user_agent: Option, accept_language: Option, - request_scheme: Option, language: Option, timezone: Option, platform: Option, - effective_type: Option, - downlink_mbps: Option, - network_rtt_ms: Option, - save_data: Option, } #[derive(Debug, Serialize)] struct ConnectionDiagnostics { - connection_id: u64, - connected_at: String, - server_time: String, - server_version: &'static str, - transport: &'static str, heartbeat_interval_ms: u64, heartbeat_timeout_ms: u64, max_reconnect_delay_ms: u64, @@ -169,18 +143,11 @@ enum ServerMessage { } fn connection_diagnostics( - connection_id: u64, request: &RequestClientContext, client: Option, ) -> ConnectionDiagnostics { let client = client.unwrap_or_default(); - let now = chrono::Utc::now().to_rfc3339(); ConnectionDiagnostics { - connection_id, - connected_at: now.clone(), - server_time: now, - server_version: env!("CARGO_PKG_VERSION"), - transport: "websocket", heartbeat_interval_ms: HEARTBEAT_INTERVAL_MS, heartbeat_timeout_ms: HEARTBEAT_TIMEOUT_MS, max_reconnect_delay_ms: MAX_RECONNECT_DELAY_MS, @@ -194,17 +161,9 @@ fn connection_diagnostics( id: request.client_id.clone(), user_agent: request.user_agent.clone(), accept_language: request.accept_language.clone(), - request_scheme: request.request_scheme.clone(), language: clean_diagnostic_text(client.language, 40), timezone: clean_diagnostic_text(client.timezone, 80), platform: clean_diagnostic_text(client.platform, 80), - effective_type: clean_diagnostic_text(client.effective_type, 20), - downlink_mbps: client - .downlink_mbps - .filter(|value| value.is_finite()) - .map(|value| value.clamp(0.0, 10_000.0)), - network_rtt_ms: client.network_rtt_ms.map(|value| value.min(120_000)), - save_data: client.save_data, }, } } @@ -488,7 +447,7 @@ async fn handle_socket( if send_split( &mut sender, &ServerMessage::Diagnostics { - diagnostics: connection_diagnostics(connection_id, &client_context, client_diagnostics), + diagnostics: connection_diagnostics(&client_context, client_diagnostics), }, ) .await diff --git a/src/websocket/pad.rs b/src/websocket/pad.rs index 291fda8..9eca642 100644 --- a/src/websocket/pad.rs +++ b/src/websocket/pad.rs @@ -246,7 +246,7 @@ async fn handle_pad_socket( if send_pad_split( &mut sender, &PadServerMessage::Diagnostics { - diagnostics: connection_diagnostics(connection_id, &client_context, client_diagnostics), + diagnostics: connection_diagnostics(&client_context, client_diagnostics), }, ) .await diff --git a/static/css/styles.css b/static/css/styles.css index 894a7d1..93c9d3f 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -2809,7 +2809,7 @@ dialog::backdrop { z-index: 55; left: 0; bottom: calc(100% + 9px); - width: min(430px, calc(100vw - 24px)); + width: min(400px, calc(100vw - 24px)); padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; @@ -5297,7 +5297,7 @@ dialog::backdrop { right: 12px; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); left: auto; - width: min(430px, calc(100vw - 24px)); + width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 88px); overflow-y: auto; overscroll-behavior: contain; diff --git a/static/editor.html b/static/editor.html index 512107a..d572681 100644 --- a/static/editor.html +++ b/static/editor.html @@ -173,7 +173,7 @@
Connection diagnostics
-
+
Quality
Waiting
@@ -193,26 +193,10 @@
Reconnects
0
-
-
Transport
-
WebSocket
-
-
-
Heartbeat
-
-
-
-
Network
-
-
-
+
Client
-
-
Server
-
-
Last event
@@ -292,9 +276,9 @@ guest